持续更新......
转载请标明出处!!!
在已经安装ROS-melodic之后,再进行一下操作。如果你没有安装ROS,请务必先安装。安装方法可以查看官网。
link:/melodic/Installation/Ubuntu
1 安装moveit
去官网查找安装moveit的方式,link:/install/
选择的是二进制安装方式:
在安装之前先对安装好的ROS系统更新一下,使用如下指令:
$ rosdep update$ sudo apt-get update$ sudo apt-get dist-upgrade
然后安装moveit:
$ sudo apt-get install ros-melodic-moveit
2 创建moveit的工作空间
为了区分开ROS的工作空间,新建一个ws_moveit的文件夹,作为moveit的工作空间
$ mkdir -p ws_moveit/src
然后下载教程演示的demo包到src文件夹下:
$ cd ws_moveit/srcgit clone /ros-planning/moveit_tutorials.git #moveit_tutorialsgit clone /ros-planning/panda_moveit_config.git #panda_moveit_config模型配置包URDF的xml语法格式
然后按照官网的步骤是,执行一下指令自动配齐依赖包,
rosdep install -y --from-paths . --ignore-src --rosdistro kinetic
但是melodic现在没有完整的这一方面的发布包,运行会提示类似如下的错误信息:
~/ws_moveit/src$ rosdep install -y --from-paths . --ignore-src --rosdistro melodic ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: panda_moveit_config: Cannot locate rosdep definition for [franka_description]
或者:当我配好franka_description的包后,有提示下面的问题,这样一直配置下去:
~/ws_moveit/src$ rosdep install -y --from-paths . --ignore-src --rosdistro melodic ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: franka_visualization: Cannot locate rosdep definition for [libfranka] franka_control: Cannot locate rosdep definition for [libfranka] franka_hw: Cannot locate rosdep definition for [libfranka] franka_example_controllers: Cannot locate rosdep definition for [libfranka] franka_gripper: Cannot locate rosdep definition for [libfranka]
最后,总结:在下载好moveit_tutorials和模型配置包panda_moveit_config后,继续在github上下载以下几个包,解压到src文件夹下,这样手动配置以下这些melodic没法自动配置的依赖包,然后继续执行上面的命令就可以了!!
The following NEW packages will be installed:ros-melodic-nodelet ros-melodic-nodelet-topic-tools ros-melodic-pcl-ros0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.Need to get 0 B/4,199 kB of archives.After this operation, 23.9 MB of additional disk space will be used.Selecting previously unselected package ros-melodic-nodelet.(Reading database ... 288004 files and directories currently installed.)Preparing to unpack .../ros-melodic-nodelet_1.9.16-0bionic.0906.224839_amd64.deb ...Unpacking ros-melodic-nodelet (1.9.16-0bionic.0906.224839) ...Selecting previously unselected package ros-melodic-nodelet-topic-tools.Preparing to unpack .../ros-melodic-nodelet-topic-tools_1.9.16-0bionic.0906.235625_amd64.deb ...Unpacking ros-melodic-nodelet-topic-tools (1.9.16-0bionic.0906.235625) ...Selecting previously unselected package ros-melodic-pcl-ros.Preparing to unpack .../ros-melodic-pcl-ros_1.6.2-0bionic.0907.005643_amd64.deb ...Unpacking ros-melodic-pcl-ros (1.6.2-0bionic.0907.005643) ...Setting up ros-melodic-nodelet (1.9.16-0bionic.0906.224839) ...Setting up ros-melodic-nodelet-topic-tools (1.9.16-0bionic.0906.235625) ...Setting up ros-melodic-pcl-ros (1.6.2-0bionic.0907.005643) ...#All required rosdeps installed successfully
因为配置信息太长,就直接去最后提示成功的信息了。
最终src中是这些PKG,按照名字下载即可:
franka_ros:/frankaemika/franka_ros
libfranka:/frankaemika/libfranka-release/tree/release/kinetic/libfranka
moveit_visual_tools: /PickNikRobotics/moveit_visual_tools/tree/melodic-devel
注意一定要配齐每一个包的依赖关系:然后才不会编译出错!!!如果不知道怎么配置每一个包各自的依赖包,请查看我之前的一片文章学习一下:
link: /SimileciWH/article/details/81332199
3 开始编译moveit的包
执行以下指令:
cd ws_moveit###catkin config --extend /opt/ros/melodic #不要执行官网写的这一行,下面我会解释catkin build
###catkin config --extend /opt/ros/melodic这一行是设置catkin编译构建的环境目录,对于melodic版本如果使用了,则默认的catkin构建目录就不在是你ROS的那个工作目录,全部非二进制安装的包,或者你为ROS写的包,如果在move'it的使用find package去搜这些包,都会找不到,因为这一句讲catkin的搜寻目录设置在了安装ROS的目录。当然你可以自己添加,这里避免不必要的麻烦,我不推荐执行这一句指令!!!
3.1 在执行catkin build时提示,
1)[missing] /home/simileciwh/ws_moveit/logs 2)[missing] /home/simileciwh/ws_moveit/build )
3)[missing] /home/simileciwh/ws_moveit/devel
这是因为我们没有在工作空间创建Log,Build,Devel三个文件夹,执行这个之后会自动创建,继续执行build命令
3.2 提示:/ws_moveit/src/moveit_tutorials-kinetic-devel/doc/pick_place/src/pick_place_tutorial.cpp:94:43: error: ‘tf’ has not been declared
点开/ws_moveit/src/moveit_tutorials-kinetic-devel/doc/pick_place/src/pick_place_tutorial.cpp文件后发现确实没有加入头文件tf.h所以在文件开头,添加即可解决错误
include <tf/tf.h>
至此构建成功!!!
~/ws_moveit$ catkin build ---------------------------------------------------------------Profile: defaultExtending: [explicit] /home/simileciwh/catkin_ws/develWorkspace: /home/simileciwh/ws_moveit---------------------------------------------------------------Source Space: [exists] /home/simileciwh/ws_moveit/srcLog Space:[exists] /home/simileciwh/ws_moveit/logsBuild Space: [exists] /home/simileciwh/ws_moveit/buildDevel Space: [exists] /home/simileciwh/ws_moveit/develInstall Space:[unused] /home/simileciwh/ws_moveit/installDESTDIR: [unused] None---------------------------------------------------------------Devel Space Layout:linkedInstall Space Layout: None---------------------------------------------------------------Additional CMake Args: -DCMAKE_BUILD_TYPE=ReleaseAdditional Make Args: NoneAdditional catkin Make Args: NoneInternal Make Job Server: TrueCache Job Environments:False---------------------------------------------------------------Whitelisted Packages: NoneBlacklisted Packages: None---------------------------------------------------------------Workspace configuration appears valid.---------------------------------------------------------------[build] Found '12' packages in 0.0 seconds.[build] Package table is up to date. Starting >>> franka_description Starting >>> franka_msgs Starting >>> libfrankaStarting >>> moveit_visual_toolsFinished <<< franka_description [ 0.2 seconds ] Starting >>> panda_moveit_configFinished <<< moveit_visual_tools [ 0.3 seconds ] Finished <<< panda_moveit_config [ 0.2 seconds ] Starting >>> moveit_tutorials Finished <<< franka_msgs [ 0.6 seconds ] Finished <<< moveit_tutorials[ 37.9 seconds ] Finished <<< libfranka [ 4 minutes and 3.4 seconds ] Starting >>> franka_gripper Starting >>> franka_hwStarting >>> franka_visualizationFinished <<< franka_visualization [ 13.2 seconds ] Finished <<< franka_hw [ 16.0 seconds ] Finished <<< franka_gripper [ 38.5 seconds ] Starting >>> franka_control Finished <<< franka_control [ 22.3 seconds ] Starting >>> franka_example_controllers Finished <<< franka_example_controllers[ 38.6 seconds ] [build] Summary: All 11 packages succeeded![build] Ignored: 1 packages were skipped or are blacklisted.[build] Warnings: None. [build] Abandoned: None. [build] Failed: None. [build] Runtime: 5 minutes and 43.1 seconds total. [build] Note: Workspace packages have changed, please re-source setup files to use them.
4 将编译好的包加入到环境中
$ source ~/ws_moveit/devel/setup.bash
也可以直接添加到.bashrc文件中,让其在开启新的终端时自动加载环境
$ echo 'source ~/ws_moveit/devel/setup.bash' >> ~/.bashrc
5 运行效果
执行以下命令运行demo:
$ roslaunch panda_moveit_config demo.launch rviz_tutorial:=true
最终结果,如下所示:
!!!!!在此之前,需要先设置一下RVIZ,否则什么都不会显示的!!!!!!
设置如下:
(1)点击打开的空白rviz窗口左侧的add按钮,找到MotionPlanning,确定。如下图所示:
设置完成,会看到下图内容:
继续设置:
在“Global Options”标签处,子窗口“Displays”选项卡,设置Fixed Frame为/panda_link0
然后点击“MotionPlanning”标签,找到如下显示的标签,做修改:
Robot Description---->设置成robot_description
Planning Scene Topic---->设置成/planning_scene
Planning Request---->设置成panda_arm
Planned Path---->设置成/move_group/display_planned_path
完成这些全部设置,就和我的截图一样效果了。
可以参考官网继续完后设计了:
link:https://ros-planning.github.io/moveit_tutorials/doc/quickstart_in_rviz/quickstart_in_rviz_tutorial.html
updating