baxter机器人生成并使用自定义IKFast插件

1、安装必要软件

1、安装OpenSceneGraph

  • 安装必要的库
sudo apt-get install cmake g ++ git ipython minizip python-dev python-h5py python-numpy python-scipy qt4-dev-tools
sudo apt-get install libassimp-dev libavcodec-dev libavformat-dev libavformat-dev libboost-all-dev libboost-date-time-dev libbullet-dev libfaac-dev libglew-dev libgsm1-dev liblapack-dev liblog4cxx-dev libmpfr-dev libode-dev libogg-dev libpcrecpp0v5 libpcre3-dev libqhull-dev libqt4-dev libsoqt-dev-common libsoqt4-dev libswscale-dev libswscale-dev libvorbis-dev libx264-dev libxml2-dev libxvidcore-dev
  • 源码安装OpenSceneGraph-3.4
sudo apt-get install libcairo2-dev libjasper-dev libpoppler-glib-dev libsdl2-dev libtiff5-dev libxrandr-dev
git clone https://github.com/openscenegraph/OpenSceneGraph.git --branch OpenSceneGraph-3.4
cd OpenSceneGraph
mkdir build; cd build
cmake .. -DDESIRED_QT_VERSION=4
make -j$(nproc)
sudo make install
  • 安装sympy
pip install --upgrade --user sympy==0.7.1
  • 删除mpmath
sudo apt remove python-mpmath

2、安装IKFast功能包

sudo apt-get install ros-kinetic-moveit-kinematics

3、安装OpenRave

sudo apt-get install ros-kinetic-openrave

2、创建dae文件

1、克隆baxter_custom_ikfast存储库

将Baxter分为左臂和右臂URDF,最好克隆到baxter的工作空间

git clone https://github.com/RethinkRobotics/baxter_custom_ikfast.git
cd custom_baxter_ikfast

2、提取安装接头变换

rosparam get -p /robot_description | tail -n +2 > baxter_urdf.xml

3、为每个手臂创建DAE

sudo apt-get install ros-kinetic-robot-model 

rosrun collada_urdf urdf_to_collada baxter_arm.accurate.right.urdf baxter_arm.right.dae
rosrun collada_urdf urdf_to_collada baxter_arm.accurate.left.urdf baxter_arm.left.dae
openrave0.9-robot.py baxter_arm.right.dae --info links

baxter机器人生成并使用自定义IKFast插件_第1张图片

openrave0.9-robot.py baxter_arm.right.dae --info joints

baxter机器人生成并使用自定义IKFast插件_第2张图片

4、简便计算对数据进行四舍五入保留小数后5位

 rosrun moveit_kinematics round_collada_numbers.py  baxter_arm.right.dae baxter_arm.right.rounded.dae 5
 rosrun moveit_kinematics round_collada_numbers.py  baxter_arm.left.dae baxter_arm.left.rounded.dae 5

5、生成IKFast解算器

极为耗时,相当耗时

 python  路径/ikfast.py --robot = baxter_arm.right.rounded.dae --iktype = transform6d --baselink = 1 --eelink = 10 --freeindex = 5 --savefile = baxter_right_arm_ikfast_solver.cpp
 python 路径/ikfast.py --robot = baxter_arm.left.rounded.dae --iktype = transform6d --baselink = 1 --eelink = 10 --freeindex = 5 --savefile = baxter_left_arm_ikfast_solver.cpp

6、生成插件并使用

  • 生成插件

下载moveit_robots,并把生成的baxter_right_arm_ikfast_solver.cpp/baxter_left_arm_ikfast_solver.cpp 替换moveit_robots/baxter/baxter_ikfast_left_arm_plugin和moveit_robots/baxter/baxter_ikfast_right_arm_plugin原有的cpp

  • 使用插件

修改moveit_robots/baxter中baxter_moveit_config/ kinematics.yaml

left_arm:
 # kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
 # uncomment to use ikfast kinematics plugin
 kinematics_solver: baxter_left_arm_kinematics/IKFastKinematicsPlugin
 kinematics_solver_attempts: 3
 kinematics_solver_search_resolution: 0.005
 kinematics_solver_timeout: 0.005
right_arm:
 # kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
 # uncomment to use ikfast kinematics plugin
 kinematics_solver: baxter_right_arm_kinematics/IKFastKinematicsPlugin
 kinematics_solver_attempts: 3
 kinematics_solver_search_resolution: 0.005
 kinematics_solver_timeout: 0.005

执行一下命令

  catkin_make
  catkin_make install --pkg baxter_ikfast_right_arm_plugin
  catkin_make install --pkg baxter_ikfast_left_arm_plugin

记录步骤方便以后使用,有错望指正

参考资料
IKFast运动学求解器
插件使用官方教程
自定义IKFast教程
网络资料

你可能感兴趣的:(机器人ROS)