Browse Source

Add vel ctrl to wrist_yaw cmd group

feature/velocity_control
Binit Shah 1 year ago
parent
commit
3bc6441815
1 changed files with 14 additions and 5 deletions
  1. +14
    -5
      stretch_core/nodes/command_groups.py

+ 14
- 5
stretch_core/nodes/command_groups.py View File

@ -134,16 +134,25 @@ class WristYawCommandGroup(SimpleCommandGroup):
self.range = range_rad self.range = range_rad
def init_execution(self, robot, robot_status, **kwargs): def init_execution(self, robot, robot_status, **kwargs):
robot_mode = kwargs['robot_mode']
if self.active: if self.active:
robot.end_of_arm.move_by('wrist_yaw',
self.update_execution(robot_status)[1],
v_r=self.goal['velocity'],
a_r=self.goal['acceleration'])
_, yaw_error = self.update_execution(robot_status, robot_mode=robot_mode)
if robot_mode == 'position':
robot.end_of_arm.move_by('wrist_yaw',
yaw_error,
v_r=self.goal['velocity'],
a_r=self.goal['acceleration'])
elif robot_mode == 'velocity':
robot.end_of_arm.get_joint('wrist_yaw').set_velocity(self.goal['velocity'], a_des=self.goal['acceleration'])
def update_execution(self, robot_status, **kwargs): def update_execution(self, robot_status, **kwargs):
robot_mode = kwargs['robot_mode']
self.error = None self.error = None
if self.active: if self.active:
self.error = self.goal['position'] - robot_status['end_of_arm']['wrist_yaw']['pos']
if robot_mode == 'position':
self.error = self.goal['position'] - robot_status['end_of_arm']['wrist_yaw']['pos']
elif robot_mode == 'velocity':
self.error = 0.0
return self.name, self.error return self.name, self.error
return None return None

Loading…
Cancel
Save