Skip to content

Commit 11a590a

Browse files
author
Andrew Lui
committed
the documentation is updated with addition of the new function move_and_rotate.
1 parent 7aa3fcb commit 11a590a

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

arm_commander/commander_moveit.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ def current_joint_positons_as_list(self, print=False) -> list:
327327
return joint_values
328328

329329
# returns the pose (as xyzq list of 7 floats) of a link (link_name) in a frame of reference (reference_frame)
330-
def pose_in_frame_as_xyzq(self, query_frame:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print=False) -> list:
330+
def pose_in_frame_as_xyzq(self, query_link:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print=False) -> list:
331331
""" Get the pose of a link as a list of 7 floats (xyzq)
332332
333-
:param query_frame: The name of the frame to be queried, defaults to the end-effector
334-
:type query_frame: str, optional
333+
:param query_link: The name of the frame to be queried, defaults to the end-effector
334+
:type query_link: str, optional
335335
:param reference_frame: The name of the frame of reference, defaults to the world/default
336336
:type reference_frame: str, optional
337337
:param ros_time: The time when the pose is queried, defaults to current time
@@ -342,19 +342,19 @@ def pose_in_frame_as_xyzq(self, query_frame:str=None, reference_frame:str=None,
342342
:return: The pose in the format of a list of 7 floats (xyzq)
343343
:rtype: list
344344
"""
345-
query_frame = self.END_EFFECTOR_LINK if query_frame is None else query_frame
346-
pose = self.pose_in_frame(query_frame, reference_frame, ros_time)
345+
query_link = self.END_EFFECTOR_LINK if query_link is None else query_link
346+
pose = self.pose_in_frame(query_link, reference_frame, ros_time)
347347
xyzq = pose_tools.pose_to_xyzq(pose.pose)
348348
if print:
349-
rospy.loginfo(f'Frame {query_frame} tranformed into {reference_frame}: {xyzq} ')
349+
rospy.loginfo(f'Frame {query_link} tranformed into {reference_frame}: {xyzq} ')
350350
return xyzq
351351

352352
# returns the pose (as xyzrpy list of 6 floats) of a link (link_name) in a frame of reference (reference_frame)
353-
def pose_in_frame_as_xyzrpy(self, query_frame:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print=False) -> list:
353+
def pose_in_frame_as_xyzrpy(self, query_link:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print=False) -> list:
354354
""" Get the pose of a link as a list of 6 floats (xyzrpy)
355355
356-
:param query_frame: The name of the frame to be queried, defaults to the end-effector
357-
:type query_frame: str, optional
356+
:param query_link: The name of the frame to be queried, defaults to the end-effector
357+
:type query_link: str, optional
358358
:param reference_frame: The name of the frame of reference, defaults to the world/default
359359
:type reference_frame: str, optional
360360
:param ros_time: The time when the pose is queried, defaults to current time
@@ -365,19 +365,19 @@ def pose_in_frame_as_xyzrpy(self, query_frame:str=None, reference_frame:str=None
365365
:return: The pose in the format of a list of 6 floats (xyzrpy)
366366
:rtype: list
367367
"""
368-
query_frame = self.END_EFFECTOR_LINK if query_frame is None else query_frame
369-
pose = self.pose_in_frame(query_frame, reference_frame, ros_time)
368+
query_link = self.END_EFFECTOR_LINK if query_link is None else query_link
369+
pose = self.pose_in_frame(query_link, reference_frame, ros_time)
370370
xyzrpy = pose_tools.pose_to_xyzrpy(pose.pose)
371371
if print:
372-
rospy.loginfo(f'Frame {query_frame} tranformed into {reference_frame}: {xyzrpy} ')
372+
rospy.loginfo(f'Frame {query_link} tranformed into {reference_frame}: {xyzrpy} ')
373373
return xyzrpy
374374

375375
# returns the pose (as PoseStamped) of a link (link_name) in a frame of reference (reference_frame)
376-
def pose_in_frame(self, query_frame:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print:bool=False) -> PoseStamped:
376+
def pose_in_frame(self, query_link:str=None, reference_frame:str=None, ros_time:rospy.Time=None, print:bool=False) -> PoseStamped:
377377
""" Get the pose of a link as a PoseStamped
378378
379-
:param query_frame: The name of the input frame that is to be transformed into the reference frame, default to end-effector
380-
:type query_frame: str, optional
379+
:param query_link: The name of the input frame that is to be transformed into the reference frame, default to end-effector
380+
:type query_link: str, optional
381381
:param reference_frame: The name of the frame of reference, defaults to the world/default
382382
:type reference_frame: str, optional
383383
:param ros_time: The time when the pose is queried, defaults to current time
@@ -386,18 +386,18 @@ def pose_in_frame(self, query_frame:str=None, reference_frame:str=None, ros_time
386386
:return: The pose as a PoseStamped
387387
:rtype: PoseStamped
388388
"""
389-
query_frame = self.END_EFFECTOR_LINK if query_frame is None else query_frame
389+
query_link = self.END_EFFECTOR_LINK if query_link is None else query_link
390390
reference_frame = self.WORLD_REFERENCE_LINK if reference_frame is None else reference_frame
391391
# reference frame is the target frame to which the query frame is to be transformed
392392
transform:TransformStamped
393393
try:
394-
transform = self.tf_buffer.lookup_transform_full(reference_frame, rospy.Time(), query_frame, rospy.Time(), self.WORLD_REFERENCE_LINK, rospy.Duration(0.5))
394+
transform = self.tf_buffer.lookup_transform_full(reference_frame, rospy.Time(), query_link, rospy.Time(), self.WORLD_REFERENCE_LINK, rospy.Duration(0.5))
395395
pose_stamped = pose_tools.transform_to_pose_stamped(transform)
396396
except Exception as e:
397397
rospy.logerr(f'Invalid parameter or TF error: {e}')
398398
raise
399399
if print:
400-
rospy.loginfo(f'Frame {query_frame} tranformed into {reference_frame}: {pose_stamped} ')
400+
rospy.loginfo(f'Frame {query_link} tranformed into {reference_frame}: {pose_stamped} ')
401401
return pose_stamped
402402

403403
# returns the pose (as Pose) of a link (link_name) of the default move_group planning frame

docs/source/API_SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ The `wait` parameter is another common feature that specifies the call is asynch
103103
| move_displacement | The dx, dy, and dz | cartesian path |
104104
| move_to_position | The target x, y, and z, the reference frame, and path planning | |
105105
| rotate_to_orientation | The target roll, pitch, and yaw, the reference frame, and path planning | |
106+
| move_and_rotate | The target x, y, z, roll, pitch, and yaw, the reference frame, and path planning | |
106107
| move_to_pose | Pose, PoseStamped, a 6-list (xyzrpy) or a 7-list (xyzqqqq) | |
107108

108109
The following functions accepts multiple positions or poses in one move command. The path is always cartesian.

docs/source/TUTORIAL_PART1.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ arm_commander.move_to_position(x = 0.4, y = 0.2, wait=True)
177177
arm_commander.reset_state()
178178
```
179179

180-
181180
### Move using a displacement
182181

183182
The function `move_displacement()` commands the robot arm to move based on a displacement from the current position. The following source code is from `simple_move_4.py`. The end-effector will move 10 cm ten times.
@@ -197,6 +196,8 @@ The default values of the three component parameters are the current values.
197196

198197
### Move to Both Position and Orientation
199198

199+
There are two functions for moving to a both specified position and orientation.
200+
200201
The function `move_pose()` commands the end-effector to move to a target pose, which can be of type `Pose` or `PoseStamped`.
201202
```python
202203
pose = Pose()
@@ -225,9 +226,10 @@ xyzrpy = [0.4, 0.0, 0.4, 3.14, 0.0, 0.6]
225226
arm_commander.move_to_pose(xyzrpy, wait=True)
226227
arm_commander.reset_state()
227228
```
228-
229229
![Animation of the Movement](../assets/ArmCommander-SimpleMove5.gif)
230230

231+
However, the function `move_pose()` accepts only fully specified pose. On the other hand, the function `move_and_rotate()` supports partially specified xyzrpy, and the unspecified components are defaulted to the current values.
232+
231233
### Cartesian Movement
232234

233235
The function `move_position()` supports both cartesian path planning (with collision avoidance) and algorithmic path planning (based on a path planner).

0 commit comments

Comments
 (0)