MoveIt控制机械臂的参考程序

python版本(又waypoint)
https://blog.csdn.net/qq_33328642/article/details/122667192

python+cpp版本
https://blog.csdn.net/zzu_seu/article/details/90612876

报错及解决:Fail: ABORTED: No motion plan found. No execution attempted

设置笛卡尔坐标后,使用set_pose_target()设置目标后,再进行plan,会报错:

Fail: ABORTED: No motion plan found. No execution attempted

以下是分析过程:

  • 位置是确定可以到达的,所以首先排除位置不可达的原因。(当然,对于大多数时候,出现这个报错首先应该考虑的是这个位置是否是可达的!
  • 且使用set_random_target()和set_joint_value_target()都可以,只有set_pose_target()会报错,所以moveit应当是没有问题的
  • 在rviz里选中approx ik solutions是可以正常拖动末端然后使用规划路径的,所以猜测可能和approx这个设置有关。

参考及解决:

这里提到kdl逆运动学解算插件对低自由度机械臂的逆运动学解算不友好,
所以后面我换了TRAC-IK解算,但是还是不成功。
另一种基于解析解的IKFAST逆运动学解算插件安装配置比较麻烦,所以虽然没有成功,但是我也不想继续尝试了

关于逆运动学解算插件的更换,可以参考古月居https://mp.weixin.qq.com/s/RdVchbCFA6mUla18qOmBYA


这两个都是印证我刚刚的猜想,和approx ik solutions设置有关。

如果使用c++的话可以使用函数group.setApproximateJointValueTarget(target_pose1, "link3");来代替函数group.setPoseTarget(target_pose1,"link3");(前提是在程序里设置了tolerance)

而是如果使用python的话,可以使用函数set_joint_value_target(pose, string, bool) ,第三个参数确定是否允许误差。

这个函数的第一个参数是允许Pose或PoseStamp类型的,所以可以用作笛卡尔空间的规划,函数的具体说明如下:

def moveit_commander.move_group.MoveGroupCommander.set_joint_value_target ( self,
arg1,
arg2 = None,
arg3 = None
)
Specify a target joint configuration for the group.

  • if the type of arg1 is one of the following: dict, list, JointState message, then no other arguments should be provided.
    The dict should specify pairs of joint variable names and their target values, the list should specify all the variable values
    for the group. The JointState message specifies the positions of some single-dof joints.
  • if the type of arg1 is string, then arg2 is expected to be defined and be either a real value or a list of real values. This is
    interpreted as setting a particular joint to a particular value.
  • if the type of arg1 is Pose or PoseStamped, both arg2 and arg3 could be defined. If arg2 or arg3 are defined, their types must
    be either string or bool. The string type argument is interpreted as the end-effector the pose is specified for (default is to use
    the default end-effector), and the bool is used to decide whether the pose specified is approximate (default is false). This situation
    allows setting the joint target of the group by calling IK. This does not send a pose to the planner and the planner will do no IK.
    Instead, one IK solution will be computed first, and that will be sent to the planner.

官网链接:http://docs.ros.org/en/indigo/api/moveit_commander/html/classmoveit__commander_1_1move__group_1_1MoveGroupCommander.html#a55db2d061bbf73d05b9a06df7f31ea39

使用这个函数后就成功啦~


关于moveit的逆运动学解算不适用于低自由度机械臂还在以下地方提到:


关于IKFast:

支持的类型有:
Translation3D - 末端执行器原点达到所需的 3D 平移
可能的求解方法由ikfast.IKFastSolver.GetSolvers()设置