@@ -336,7 +336,31 @@ def set_joint_position_speed(self, speed):
336
336
"""
337
337
self ._pub_speed_ratio .publish (Float64 (speed ))
338
338
339
- def set_joint_positions (self , positions , raw = False ):
339
+ def set_joint_trajectory (self , names , positions , velocities , accelerations ):
340
+ """
341
+ Commands the joints of this limb to the specified positions.
342
+
343
+ B{IMPORTANT:} 'raw' joint position control mode allows for commanding
344
+ joint positions, without modification, directly to the JCBs
345
+ (Joint Controller Boards). While this results in more unaffected
346
+ motions, 'raw' joint position control mode bypasses the safety system
347
+ modifications (e.g. collision avoidance).
348
+ Please use with caution.
349
+
350
+ @type positions: dict({str:float})
351
+ @param positions: joint_name:angle command
352
+ @type raw: bool
353
+ @param raw: advanced, direct position control mode
354
+ """
355
+ self ._command_msg .names = names
356
+ self ._command_msg .position = positions
357
+ self ._command_msg .velocity = velocities
358
+ self ._command_msg .acceleration = accelerations
359
+ self ._command_msg .mode = JointCommand .TRAJECTORY_MODE
360
+ self ._command_msg .header .stamp = rospy .Time .now ()
361
+ self ._pub_joint_cmd .publish (self ._command_msg )
362
+
363
+ def set_joint_positions (self , positions ):
340
364
"""
341
365
Commands the joints of this limb to the specified positions.
342
366
@@ -353,11 +377,9 @@ def set_joint_positions(self, positions, raw=False):
353
377
@param raw: advanced, direct position control mode
354
378
"""
355
379
self ._command_msg .names = positions .keys ()
356
- self ._command_msg .command = positions .values ()
357
- if raw :
358
- self ._command_msg .mode = JointCommand .RAW_POSITION_MODE
359
- else :
360
- self ._command_msg .mode = JointCommand .POSITION_MODE
380
+ self ._command_msg .position = positions .values ()
381
+ self ._command_msg .mode = JointCommand .POSITION_MODE
382
+ self ._command_msg .header .stamp = rospy .Time .now ()
361
383
self ._pub_joint_cmd .publish (self ._command_msg )
362
384
363
385
def set_joint_velocities (self , velocities ):
@@ -373,8 +395,9 @@ def set_joint_velocities(self, velocities):
373
395
@param velocities: joint_name:velocity command
374
396
"""
375
397
self ._command_msg .names = velocities .keys ()
376
- self ._command_msg .command = velocities .values ()
398
+ self ._command_msg .velocity = velocities .values ()
377
399
self ._command_msg .mode = JointCommand .VELOCITY_MODE
400
+ self ._command_msg .header .stamp = rospy .Time .now ()
378
401
self ._pub_joint_cmd .publish (self ._command_msg )
379
402
380
403
def set_joint_torques (self , torques ):
@@ -390,8 +413,9 @@ def set_joint_torques(self, torques):
390
413
@param torques: joint_name:torque command
391
414
"""
392
415
self ._command_msg .names = torques .keys ()
393
- self ._command_msg .command = torques .values ()
416
+ self ._command_msg .effort = torques .values ()
394
417
self ._command_msg .mode = JointCommand .TORQUE_MODE
418
+ self ._command_msg .header .stamp = rospy .Time .now ()
395
419
self ._pub_joint_cmd .publish (self ._command_msg )
396
420
397
421
def move_to_neutral (self , timeout = 15.0 ):
0 commit comments