用于 ROS 2 的 MoveIt 运动规划框架。
The MoveIt Motion Planning Framework for ROS 2.
在线机器人操作需要实时安全:
直接访问核心 MoveIt 组件
利用 ROS2 组件节点获得更好的性能
全局规划
局部规划
// \brief load the robot model,
// configure the planning pipeline from ROS2 parameters and
// initialize defaults
moveit_cpp_ = std::make_shared<moveit::planning_interface::MoveItCpp>(node_);
// \brief associated to a planning group
// used to setup the motion plan request and
// call the low-level planner
moveit::planning_interface::PlanningComponent arm("ur5_arm", moveit_cpp_);
/** \brief Set the goal constraints generated from target pose and robot link */
geometry_msgs::PoseStamped target_pose1;
target_pose1.header.frame_id = "base_link";
target_pose1.pose.orientation.w = 1.0;
target_pose1.pose.position.x = 0.28;
target_pose1.pose.position.y = -0.2;
target_pose1.pose.position.z = 0.5;
arm->setGoal(target_pose1, "ee_link");
/** \brief Set the goal constraints generated from a named target state */
arm->setGoal("ready");
用于如下场合:
kinematic_constraints::JointConstraint
kinematic_constraints::OrientationConstraint
kinematic_constraints::PositionConstraint
kinematic_constraints::VisibilityConstraint
例如: 使用为机器人上的连杆指定的路径约束进行规划
moveit_msgs::OrientationConstraint ocm;
ocm.link_name = "panda_link7";
ocm.header.frame_id = "panda_link0";
ocm.orientation.w = 1.0;
ocm.absolute_x_axis_tolerance = 0.1;
ocm.absolute_y_axis_tolerance = 0.1;
ocm.absolute_z_axis_tolerance = 0.1;
将此设置为计划组的路径约束
moveit_msgs::Constraints test_constraints;
test_constraints.orientation_constraints.push_back(ocm);
move_group_interface.setPathConstraints(test_constraints);
理想的属性
完整性、约束不足、提前规划、实时
std::vector<geometry_msgs::Pose> waypoints;
waypoints.push_back(start_pose);
geometry_msgs::Pose way_pose;
waypoints.push_back(way_pose);
way_pose.position.y -= 0.2;
waypoints.push_back(way_pose); // right
way_pose.position.z += 0.2;
way_pose.position.y += 0.2;
way_pose.position.x -= 0.2;
waypoints.push_back(way_pose); // up and left
现在用插值计算轨迹:
moveit_msgs::RobotTrajectory trajectory;
const double jump_threshold = 0.0;
const double eef_step = 0.01;
double fraction = move_group_interface.computeCartesianPath(waypoints, eef_step, jump_threshold, trajectory);
更多内容参考:Github之moveit2。