参考资料:http://docs.ros.org/kinetic/api/moveit_tutorials/html/doc/getting_started/getting_started.html
运行平台:VMware + ubuntu16.04 +ROS Kinetic +moveit
在上一篇成功安装ROS后,这篇讲解快速使用movit 对仿真机器人进行运动规划
1、安装moveit
如果rosdep update更新不成功,直接安装movit和python-catkin-tools
sudo apt-get install ros-kinetic-catkin python-catkin-tools
sudo apt-get install ros-kinetic-moveit
2、更新环境
source /opt/ros/kinetic/setup.bash
3、创建工作空间
mkdir -p ~/ws_moveit/src
4、下载开源代码,并放置工作空间
从 https://github.com/ros-planning/moveit_tutorials.git
下载 moveit_tutorials-kinetic-devel.zip
从https://github.com/ros-planning/panda_moveit_config.git
下载panda_moveit_config-kinetic-devel.zip
注意下载时要选择kinetic-devel进行下载
把下载好的两个包拷贝到 ws_moveit/src下,然后解压
unzip moveit_tutorials-kinetic-devel.zip
unzip panda_moveit_config-kinetic-devel.zip
5、编译工作空间
安装依赖包
cd ~/ws_moveit/src
rosdep install -y --from-paths . --ignore-src --rosdistro kinetic
配置工作空间进行编译
cd ~/ws_moveit
catkin config --extend /opt/ros/kinetic
catkin build
catkin build 编译两个包要很长一段时间,应该是虚拟器的处理核和内存设置太小了
编译完后配置环境变量
source ~/ws_moveit/devel/setup.bash
把之前的命令添加到.bashrc
echo 'source ~/ws_moveit/devel/setup.bash' >> ~/.bashrc
6、打开rviz仿真器运行movit
(1)运行demo
roslaunch panda_moveit_config demo.launch rviz_tutorial:=true
你将看到RViz仿真器
在 RViz Displays 一栏里点Add,弹出窗口,在moveit_ros_visualization 文件里,选择MotionPlanning 并点击OK
在RViz里面就可以看到机器人模型了
在Displays->Global Options->Fixed Frame 一栏下拉框中选择panda_link0 ,把机器人连杆0进行固定
在Displays->MotionPlanning-> Robot Description 一栏设置为robot_description
在Displays->MotionPlanning->Planning Scene Topic 一栏设置为planning_scene
在Displays->MotionPlanning-> Planning Request-> Planning Group 一栏设置为panda_arm
在Displays->MotionPlanning-> Planned Path->Trajectory Topic 一栏设置为move_group/display_planned_path
(2)拖动机器人
点击绿色、蓝色、红色进行XYZ拖动,旋转圈圈可以改变机器人的姿态
(3)与机器人交互
选择Displays->MotionPlanning->Planned Path ->Show Robot Visual 复选框,进行打钩
选择Displays->MotionPlanning->Scene Robot ->Show Robot Visual 复选框,取消打钩
选择Displays->MotionPlanning->Planning Request -> Query Goal Statel 复选框,打钩,可以看到目标点位置的机器人
选择Displays->MotionPlanning->Planning Request -> Query Start State 复选框,打钩,可以看到起始点位置的机器人
(4)机器人运动规划
点击MotionPlanning插件的plan按钮就可以进行运动规划了
选择Displays->MotionPlanning->Planning Path -> Show Trail 复选框,打钩,便可以规划的中间运动轨迹