如题,想要根据官方教程为ur3机械臂配置ik-fast,
这里先放moveit官方链接,http://docs.ros.org/en/kinetic/api/moveit_tutorials/html/doc/move_group_python_interface/move_group_python_interface_tutorial.html
后面没标序号,但是过程是对的。
1
sudo apt-get install cmake g++ git ipython minizip python-dev python-h5py python-numpy python-scipy qt4-dev-tools
2
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
3
sudo apt-get install libcairo2-dev libjasper-dev libpoppler-glib-dev libsdl2-dev libtiff5-dev libxrandr-dev
4 这里到相应的src目录下或者直接在主目录下新建终端
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)
结果:
[100%] Built target osgdb_p3d [100%] Built target osgdb_serializers_osgui [100%] Built target osgdb_serializers_osganimation
之后:
sudo make install
pip install --upgrade --user sympy==0.7.1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting sympy==0.7.1
Downloading sympy-0.7.1.tar.gz (3.6 MB)
|████████████████████████████████| 3.6 MB 16 kB/s
Building wheels for collected packages: sympy
Building wheel for sympy (setup.py) ... done
Created wheel for sympy: filename=sympy-0.7.1-py2-none-any.whl size=1824444 sha256=887d9e9ddb396c4f8154d3bd15fe0fac0e2a703a19d597b02dc0b189b12c5f08
Stored in directory: /home/bigfacecat/.cache/pip/wheels/93/e1/99/8fd15f409e951320f447272d7370ee1f095d5f757181d11906
Successfully built sympy
Installing collected packages: sympy
Successfully installed sympy-0.7.1
WARNING: You are using pip version 20.2.4; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
这里出现了警告,但是我看到成功下载了,就忽略了。
5
sudo apt remove python-mpmath sudo apt-get install ros-kinetic-moveit-kinematics
6
sudo apt-get purge ros-kinetic-openrave
这里一直报错,连接失败:
export PYTHonPATH=$PYTHONPATH:`openrave-config --python-dir` 错误:22 http://cn.archive.ubuntu.com/ubuntu xenial/universe i386 fonts-gfs-olga all 1.1-5 连接失败 [IP: 91.189.91.38 80] 错误:23 http://cn.archive.ubuntu.com/ubuntu xenial/universe i386 fonts-gfs-solomos all 1.1-5 连接失败 [IP: 2001:67c:1562::15 80] 85% [正在连接 cn.archive.ubuntu.com (2001:67c:1562::18)] [2 ros-kinetic-col^C
换一种下载方式,到相应src目录下:
git clone --branch latest_stable https://github.com/rdiankov/openrave.git
结果:
处理 delta 中: 100% (67285/67285), 完成. 检查连接... 完成。
之后:
cd openrave && mkdir build && cd build cmake -DODE_USE_MULTITHREAD=ON -DOSG_DIR=/usr/local/lib64/ .. make -j$(nproc)
结果:
[100%] linking CXX shared library openravepy_configurationcache.so [100%] Built target openravepy_configurationcache
之后:
sudo make install
结果:
-- Installing: /usr/local/lib/openrave0.9-plugins/libfclrave.so -- Set runtime path of "/usr/local/lib/openrave0.9-plugins/libfclrave.so" to "/usr/local/lib:/usr/local/lib/openrave0.9-plugins
"
7
下面就是针对自己的模型配置了,这里是从github上下载的ur机械臂包,到相应目录下打开终端:
export MYROBOT_NAME="ur3_robot"
这里是看到了相关的文件配置xacro
rosrun xacro xacro --inorder -o "$MYROBOT_NAME".urdf "$MYROBOT_NAME".urdf.xacro rosrun collada_urdf urdf_to_collada "$MYROBOT_NAME".urdf "$MYROBOT_NAME".dae
结果如下,并在该目录中清楚的看到相关生成文件:
document successfully written to ur3_robot.dae
8
export IKFAST_PRECISION="5" cp "$MYROBOT_NAME".dae "$MYROBOT_NAME".backup.dae rosrun moveit_kinematics round_collada_numbers.py "$MYROBOT_NAME".dae "$MYROBOT_NAME".dae "$IKFAST_PRECISION"
一些终端的结果:
Old: -360.0000000000237 New: -360.0 Old: 360.0000000000237 New: 360.0 Old: -360.0000000000237 New: -360.0 Old: 360.0000000000237 New: 360.0 Old: -360.0000000000237 New: -360.0 Old: 360.0000000000237 New: 360.0 Old: 0 New: 0.0 Old: 0 New: 0.0
之后:
openrave-robot.py "$MYROBOT_NAME".dae --info links
有:
name index parents ----------------------------------- world 0 base_link 1 world base 2 base_link shoulder_link 3 base_link upper_arm_link 4 shoulder_link forearm_link 5 upper_arm_link wrist_1_link 6 forearm_link wrist_2_link 7 wrist_1_link wrist_3_link 8 wrist_2_link ee_link 9 wrist_3_link tool0 10 wrist_3_link ----------------------------------- name index parents
或者通过以下命令可以看到自己的模型文件图:
openrave "$MYROBOT_NAME".dae
9
可以看到标号为1-9。之后:
export PLANNING_GROUP="manipulator" export base_link="1" export EEF_link="9"
export IKFAST_OUTPUT_PATH=`pwd`/ikfast61_"$PLANNING_GROUP".cpp python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot="$MYROBOT_NAME".dae --iktype=transform6d --baselink="$base_link" --eelink="$EEF_link" --savefile="$IKFAST_OUTPUT_PATH"
export MOVEIT_IK_PLUGIN_PKG="$MYROBOT_NAME"_ikfast_"$PLANNING_GROU P"_plugin
//到src目录下,我的是自己的ur_robot。
cd ~/catkin_ws/src catkin_create_pkg "$MOVEIT_IK_PLUGIN_PKG"
rosrun moveit_kinematics create_ikfast_moveit_plugin.py "$MYROBOT_NAME" "$PLANNING_GROUP" "$MOVEIT_IK_PLUGIN_PKG" "$IKFAST_OUTPUT_PATH"
ERROR: can't find package ur3_robot_moveit_config
方法:
export MYROBOT_NAME="ur3"
再次执行上述rosrun
ERROR: can't find package ur3_robot_ikfast_manipulator_plugin
方法:
source ./devel/setup.bash rosrun moveit_kinematics create_ikfast_moveit_plugin.py "$MYROBOT_NAME" "$PLANNING_GROUP" "$MOVEIT_IK_PLUGIN_PKG" "$IKFAST_OUTPUT_PATH"
成功,之后:
catkin_make //miveit官网是catkin build
报错:
Add the installation prefix of "manipulation_msgs" to CMAKE_PREFIX_PATH or set "manipulation_msgs_DIR" to a directory containing one of the above files. If "manipulation_msgs" provides a separate development package or SDK, be sure it has been inst
方法:
sudo apt-get install ros-kinetic-manipulation-msgs catkin_make
[100%] Built target ur3_manipulator_moveit_ikfast_plugin
最后,官网提示修改相应的yaml文件。但我打开后发现他自动更改好了,如下:
官网的操作:
: kinematics_solver: _ _kinematics/IKFastKinematicsPlugin -INSTEAD OF- kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
我实际自动生成的:
manipulator: kinematics_solver: ur3_manipulator_kinematics/IKFastKinematicsPlugin kinematics_solver_attempts: 30 kinematics_solver_search_resolution: 0.005 kinematics_solver_timeout: 0.005
最后调用ur3 moveit config中的roslaunch demo 随便拖动一下机械臂,发现成功规划以及执行。



