ros noetic moveit 的compute_cartesian_path函数详解
时间: 2024-03-19 14:44:01 浏览: 396
ROS noetic MoveIt编译出错,提示缺少软件包"manipulation_msgs"
`compute_cartesian_path`函数是MoveIt中一个非常有用的函数,可以用来计算机器人末端执行器的直线或圆弧路径。该函数的完整定义如下:
```python
def compute_cartesian_path(self, waypoints, eef_step, jump_threshold, avoid_collisions=True, path_constraints=None, attached_object_touch_links=None, moveit_msgs_opts=None):
"""
Compute a sequence of waypoints that make the end-effector move in straight line segments that follow the
poses specified as a list of waypoints.
:param waypoints: A list of waypoints that specify the poses for the end-effector to move through. Each
waypoint is specified as a `geometry_msgs.msg.PoseStamped` message.
:param eef_step: The distance in meters between consecutive waypoints on the returned path. This value
effectively controls the granularity of the computed path.
:param jump_threshold: The maximum distance in configuration space that the end-effector is
allowed to travel in a single step. If the distance between consecutive
configurations along the resulting path exceeds this value, the path is
considered invalid and will not be returned.
:param avoid_collisions: Whether to check for collisions between the robot and the environment as
the path is being computed. If collisions are detected, the computed path
will be modified to avoid the obstacles.
:param path_constraints: A `moveit_msgs.msg.Constraints` message that specifies constraints to be
enforced on the computed path. If `None`, no constraints will be used.
:param attached_object_touch_links: A list of link names that specify which links the attached object
is allowed to touch during the motion. If `None`, the default value
of the `touch_links` parameter in the `planning_scene_interface`
constructor will be used.
:param moveit_msgs_opts: Advanced options for the computation of the path. This is a dictionary of
key-value pairs, where the keys are strings and the values are either integer,
float or string values. The available options are the same as those that can be
set in the `moveit_msgs.msg.RobotTrajectory` message.
:returns: `(plan, fraction)` where `plan` is a `moveit_msgs.msg.RobotTrajectory` message that describes
the computed path, and `fraction` is a float value between 0.0 and 1.0 that specifies the
fraction of the path that was successfully computed. If `fraction` is less than 1.0, the
returned plan should be considered invalid.
"""
```
其中,参数的含义如下:
- `waypoints`:一个包含机器人末端执行器路径的列表,每个路径点都是一个`geometry_msgs.msg.PoseStamped`消息。
- `eef_step`:机器人末端执行器在计算出的路径中使用的步长,以米为单位,控制路径的粒度。
- `jump_threshold`:在计算出的路径中允许的连续步长之间的最大距离,以配置空间中的距离为单位。如果连续的配置之间的距离超过此值,则该路径被认为是无效的,不会返回。
- `avoid_collisions`:在计算路径时是否检查机器人与环境之间的碰撞。如果检测到碰撞,则计算出的路径将被修改以避免障碍物。
- `path_constraints`:一个`moveit_msgs.msg.Constraints`消息,指定要强制执行的计算路径上的约束条件。如果为`None`,则不使用任何约束。
- `attached_object_touch_links`:一个字符串列表,指定附加对象在运动过程中允许触摸的链接。如果为`None`,则将使用`planning_scene_interface`构造函数中`touch_links`参数的默认值。
- `moveit_msgs_opts`:计算路径的高级选项。这是一个键值对字典,其中键是字符串,值可以是整数、浮点数或字符串。可用选项与可以在`moveit_msgs.msg.RobotTrajectory`消息中设置的选项相同。
该函数的返回值为一个元组`(plan, fraction)`,其中`plan`是一个`moveit_msgs.msg.RobotTrajectory`消息,描述了计算出的路径,`fraction`是介于0.0和1.0之间的浮点值,指定成功计算的路径的比例。如果`fraction`小于1.0,则返回的计划应视为无效。
该函数通过计算机器人末端执行器的直线或圆弧路径,生成一条路径,将机器人从起始点运动到目标点。在计算路径时,可以指定一些约束条件,例如机器人与环境之间的碰撞,机器人的关节角度等。这使得计算出的路径更加精确和安全。
阅读全文