commander.move_to_named_target(warehouse_states["burn_4_hand"]) test_trajectory = exporter.convert_trajectory([{ 'name': "burn_1_hand", "interpolate_time": 0.5, 'pause_time': 1 }, { 'name': "burn_2_hand", "interpolate_time": 0.5, 'pause_time': 1 }, { 'name': "burn_3_hand", "interpolate_time": 0.5, 'pause_time': 0.5 }, { 'name': "burn_4_hand", "interpolate_time": 0.5, 'pause_time': 0.5 }, { 'name': "burn_5_hand", "interpolate_time": 0.5, 'pause_time': .5 }, { 'name': "burn_4_hand", "interpolate_time": 0.5, 'pause_time': .5 }]) while not rospy.is_shutdown(): commander.run_named_trajectory(test_trajectory)
hand_commander = SrHandCommander(hand_parameters=hand_parameters, hand_serial=hand_serial) # Define trajectory. Interpolate time (time to move to each point from previous posture) # must be specified. Pause time is optional. Names are either the default poses defined # in SRDF or are states stored in the warehouse. trajectory = [{ 'name': 'open', 'interpolate_time': 3.0 }, { 'name': 'pack', 'interpolate_time': 3.0, 'pause_time': 2 }, { 'name': 'open', 'interpolate_time': 3.0 }, { 'name': 'pack', 'interpolate_time': 3.0 }, { 'name': 'open', 'interpolate_time': 3.0 }] # Run trajectory via moveit hand_commander.run_named_trajectory(trajectory) # Run trajectory by sending directly to controllers - faster but no collision checking. hand_commander.run_named_trajectory_unsafe(trajectory, True)
# You could use the states directly: hand_commander.move_to_joint_value_target_unsafe(warehouse_states['state_2']) rospy.sleep(2) hand_commander.move_to_joint_value_target_unsafe(warehouse_states['state_1']) rospy.sleep(2) hand_commander.move_to_joint_value_target_unsafe(warehouse_states['state_2']) rospy.sleep(2) # You could translate all the named states in a trajectory: trajectory = [ { 'name': 'state_1', 'interpolate_time': 3.0 }, { 'name': 'state_2', 'interpolate_time': 3.0, 'pause_time': 1 } ] state_exporter = SrRobotStateExporter(warehouse_states) converted_trajectory = state_exporter.convert_trajectory(trajectory) hand_commander.run_named_trajectory(converted_trajectory) # Or we could repopulate the warehouse with the exported states: state_exporter = SrRobotStateExporter(warehouse_states) state_exporter.repopulate_warehouse()