Commit e4c29953 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

no extrusion delay, just that a pre-contour extrusion and post contour...

no extrusion delay, just that a pre-contour extrusion and post contour retraction needs to be done, add useful tools for testing (#10, #16)
parent 472cbc7b
......@@ -145,10 +145,10 @@ class Controller(object):
if contour is not None:
print("THIS NEXT TRAJ REQUIRES EXTRUSION")
self.extrude(2, 2) # extrude 2mm in 2s to get started
time.sleep(7)
pre_extrude_time = 0.2
self.extrude(10, pre_extrude_time) # extrude 10mm in 0.2s to get started
time.sleep(pre_extrude_time)
self.extrude(contour.Ext[-1], jtraj.time[-1])
time.sleep(5)
rospy.loginfo('Sending trajectory to UR5e')
self.traj_complete = False
......@@ -163,6 +163,9 @@ class Controller(object):
break
self.traj_complete = False
if contour is not None:
self.extrude(-10, 0.2)
return True
......
......@@ -13,12 +13,12 @@ from trajectory_msgs.msg import (
)
## Our libraries
from utils import load_plan, JTraj2ROS
from utils import load_plan, JTraj2ROS, speed_multiplier
from Controller import Controller
import gcode2contour as gc
def execute_plan(plan, controller, contours=None):
def execute_plan(plan, controller, contours=None, confirm=False):
"""
Executes a plan on MoveIt
......@@ -29,12 +29,16 @@ def execute_plan(plan, controller, contours=None):
# execute trajectories in plan
for i, t in enumerate(plan.trajs[0]):
i+=1
if i==1:
if i==0:
print("skipping first traj")
continue
if confirm:
a = raw_input('Press enter to continue')
if t.contour is not None:
controller.exec_ctraj(t, contour=contours[t.contour])
controller.exec_ctraj(speed_multiplier(t, 5), contour=contours[t.contour])
else:
controller.exec_ctraj(t)
return
......@@ -42,11 +46,17 @@ def execute_plan(plan, controller, contours=None):
if __name__ == '__main__':
plan1 = load_plan('origin')
calibration_test = load_plan('cal_test')
plan2, flexirex_contours = load_plan('flexirex', contours=True)
# Printing
con = Controller()
#con = Controller(disable_extruder=True)
execute_plan(plan2, con, contours=flexirex_contours)
# no printing
#con = Controller(disable_extruder=True)
#execute_plan(calibration_test, con, confirm=True)
# go to origin and stay (to check calibration)
#plan05 = copy.deepcopy(plan1)
#plan05.trajs[0].pop()
......
No preview for this file type
No preview for this file type
......@@ -58,6 +58,7 @@ default_joint_names = ['shoulder_pan_joint',
'wrist_2_joint',
'wrist_3_joint']
def JTraj2ROS(jtraj,joint_names=default_joint_names):
"""
convert JTrajectory object to ROS JointTrajectory
......@@ -72,3 +73,11 @@ def JTraj2ROS(jtraj,joint_names=default_joint_names):
j.points.append(jp)
return j
def speed_multiplier(jtraj, multiplier):
"""
used for slowing down contour execution for testing
"""
jtraj.time = [t*multiplier for t in jtraj.time]
return jtraj
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment