RMVL  2.5.0-dev
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
rm::lpss::RobotPlanner类 参考

机器人规划模块,提供 URDF 解析、正/逆运动学求解、轨迹规划等运动学功能 更多...

#include <rmvl/lpss/robot.hpp>

rm::lpss::RobotPlanner 的协作图:

Public 成员函数

 RobotPlanner (std::string_view urdf_path, std::string_view mesh_path={})
 构造机器人规划对象
 
 RobotPlanner (RobotPlanner &&) noexcept
 
RobotPlanneroperator= (RobotPlanner &&) noexcept
 
 ~RobotPlanner ()
 
void load (std::string_view urdf_path, std::string_view mesh_path={})
 重新加载机器人模型
 
void update (const msg::JointState &joint_state)
 更新关节状态,并根据正运动学重新计算 TF 树
 
const msg::JointStatejoints () const noexcept
 获取当前关节状态
 
const msg::URDFurdf () const noexcept
 获取当前 URDF 消息
 
const msg::TFtf () const noexcept
 获取当前 TF 消息
 
msg::JointTrajectory plan (const msg::JointState &target) const
 关节空间点到点规划
 
msg::JointTrajectory plan (std::string_view frame, const msg::Pose &target) const
 笛卡尔空间点到点规划
 
msg::JointTrajectory plan (std::string_view frame, const std::vector< msg::Pose > &waypoints) const
 笛卡尔空间多段途经点规划
 
msg::Pose linkpose (std::string_view link_name) const
 获取指定连杆相对于基坐标系的位姿(正运动学)
 
void setMaxVelocityScalingFactor (double factor)
 设置最大速度缩放因子
 
double getMaxVelocityScalingFactor () const noexcept
 获取当前最大速度缩放因子
 
void setMaxAccelerationScalingFactor (double factor)
 设置最大加速度缩放因子
 
double getMaxAccelerationScalingFactor () const noexcept
 获取当前最大加速度缩放因子
 

Protected 属性

std::unique_ptr< Impl > _impl {}
 

详细描述

机器人规划模块,提供 URDF 解析、正/逆运动学求解、轨迹规划等运动学功能

构造及析构函数说明

◆ RobotPlanner() [1/2]

rm::lpss::RobotPlanner::RobotPlanner ( std::string_view urdf_path,
std::string_view mesh_path = {} )

构造机器人规划对象

构造时以零位初始化所有关节状态,并生成对应的 TF 树

参数
[in]urdf_path机器人 URDF 文件路径
[in]mesh_path机器人网格文件路径前缀(可选),一般用于解析 URDF 中的 mesh 路径

◆ RobotPlanner() [2/2]

rm::lpss::RobotPlanner::RobotPlanner ( RobotPlanner && )
noexcept
函数调用图:

◆ ~RobotPlanner()

rm::lpss::RobotPlanner::~RobotPlanner ( )
函数调用图:

成员函数说明

◆ getMaxAccelerationScalingFactor()

double rm::lpss::RobotPlanner::getMaxAccelerationScalingFactor ( ) const
noexcept

获取当前最大加速度缩放因子

返回
当前加速度缩放因子
函数调用图:

◆ getMaxVelocityScalingFactor()

double rm::lpss::RobotPlanner::getMaxVelocityScalingFactor ( ) const
noexcept

获取当前最大速度缩放因子

返回
当前速度缩放因子
函数调用图:

◆ joints()

const msg::JointState & rm::lpss::RobotPlanner::joints ( ) const
noexcept

获取当前关节状态

返回
当前关节状态的常引用

◆ linkpose()

msg::Pose rm::lpss::RobotPlanner::linkpose ( std::string_view link_name) const

获取指定连杆相对于基坐标系的位姿(正运动学)

参数
[in]link_name目标连杆名称
返回
该连杆在基坐标系下的位姿
函数调用图:

◆ load()

void rm::lpss::RobotPlanner::load ( std::string_view urdf_path,
std::string_view mesh_path = {} )

重新加载机器人模型

解析新的 URDF 文件,重新构建运动学树,并以零位重新初始化所有关节状态和 TF 树

参数
[in]urdf_path机器人 URDF 文件路径
[in]mesh_path机器人网格文件路径前缀(可选),一般用于解析 URDF 中的 mesh 路径
函数调用图:

◆ operator=()

RobotPlanner & rm::lpss::RobotPlanner::operator= ( RobotPlanner && )
noexcept
函数调用图:

◆ plan() [1/3]

msg::JointTrajectory rm::lpss::RobotPlanner::plan ( const msg::JointState & target) const

关节空间点到点规划

  • 已知目标关节角,从当前关节角出发,用五次多项式插值生成平滑轨迹。
  • 不需要逆运动学,适合直接指定关节角度的场景。
参数
[in]target目标关节状态(仅使用 position 字段)
返回
关节轨迹,若关节数为 0 则返回空轨迹
函数调用图:

◆ plan() [2/3]

msg::JointTrajectory rm::lpss::RobotPlanner::plan ( std::string_view frame,
const msg::Pose & target ) const

笛卡尔空间点到点规划

  • 已知末端目标位姿,先用逆运动学(LMA 迭代)求出对应关节角,再从当前关节角出发做五次多项式插值。
  • 若目标位姿超出工作空间或逆运动学不收敛,返回空轨迹。
参数
[in]frame目标连杆名称(末端执行器所在连杆)
[in]target目标位姿(位置 + 四元数姿态)
返回
关节轨迹,IK 失败或连杆不存在时返回空轨迹
函数调用图:

◆ plan() [3/3]

msg::JointTrajectory rm::lpss::RobotPlanner::plan ( std::string_view frame,
const std::vector< msg::Pose > & waypoints ) const

笛卡尔空间多段途经点规划

  • 末端依次经过多个目标位姿,对每段分别做逆运动学 + 五次多项式插值,各段轨迹首尾拼接,每段根据关节速度/加速度限制自动估算时长。
  • 若某段逆运动学失败,返回已成功规划的部分轨迹。
参数
[in]frame目标连杆名称(末端执行器所在连杆)
[in]waypoints途经位姿列表,按顺序依次到达
返回
关节轨迹,连杆不存在时返回空轨迹
函数调用图:

◆ setMaxAccelerationScalingFactor()

void rm::lpss::RobotPlanner::setMaxAccelerationScalingFactor ( double factor)

设置最大加速度缩放因子

轨迹规划时所有关节的最大加速度将乘以该系数,值域 \((0,1]\)。

参数
[in]factor加速度缩放因子,将被截断到 \((0,1]\)范围
函数调用图:

◆ setMaxVelocityScalingFactor()

void rm::lpss::RobotPlanner::setMaxVelocityScalingFactor ( double factor)

设置最大速度缩放因子

轨迹规划时所有关节的最大速度将乘以该系数,值域 \((0,1]\)。

参数
[in]factor速度缩放因子,将被截断到 \((0,1]\)范围
函数调用图:

◆ tf()

const msg::TF & rm::lpss::RobotPlanner::tf ( ) const
noexcept

获取当前 TF 消息

函数调用图:

◆ update()

void rm::lpss::RobotPlanner::update ( const msg::JointState & joint_state)

更新关节状态,并根据正运动学重新计算 TF 树

参数
[in]joint_state新的关节状态(名称、位置、速度、力矩)

◆ urdf()

const msg::URDF & rm::lpss::RobotPlanner::urdf ( ) const
noexcept

获取当前 URDF 消息

函数调用图:

类成员变量说明

◆ _impl

std::unique_ptr<Impl> rm::lpss::RobotPlanner::_impl {}
protected