Browse Source

multirobot test

pull/116/head
yy389 1 year ago
parent
commit
de1c8c2cbd
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      hello_helpers/src/hello_helpers/hello_misc.py

+ 6
- 2
hello_helpers/src/hello_helpers/hello_misc.py View File

@ -67,12 +67,13 @@ def get_left_finger_state(joint_states):
return [left_finger_position, left_finger_velocity, left_finger_effort] return [left_finger_position, left_finger_velocity, left_finger_effort]
class HelloNode: class HelloNode:
def __init__(self):
def __init__(self, robot_name=None):
self.joint_states = None self.joint_states = None
self.point_cloud = None self.point_cloud = None
self.tool = None self.tool = None
self.mode = None self.mode = None
self.dryrun = False self.dryrun = False
self.robot_name = robot_name
@classmethod @classmethod
def quick_create(cls, name, wait_for_first_pointcloud=False): def quick_create(cls, name, wait_for_first_pointcloud=False):
@ -231,7 +232,10 @@ class HelloNode:
self.node_name = rospy.get_name() self.node_name = rospy.get_name()
rospy.loginfo("{0} started".format(self.node_name)) rospy.loginfo("{0} started".format(self.node_name))
self.trajectory_client = actionlib.SimpleActionClient('/stretch_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
if self.robot_name == None:
self.trajectory_client = actionlib.SimpleActionClient('/stretch_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
else:
self.trajectory_client = actionlib.SimpleActionClient('/'+self.robot_name+'/follow_joint_trajectory', FollowJointTrajectoryAction)
server_reached = self.trajectory_client.wait_for_server(timeout=rospy.Duration(60.0)) server_reached = self.trajectory_client.wait_for_server(timeout=rospy.Duration(60.0))
if not server_reached: if not server_reached:
rospy.signal_shutdown('Unable to connect to arm action server. Timeout exceeded.') rospy.signal_shutdown('Unable to connect to arm action server. Timeout exceeded.')

Loading…
Cancel
Save