ROS Ubuntu18.04 Melodic下Turtlebot功能包移植教程

843
5
2020年11月12日 09时27分

TurtleBot-Tutorial教程移植测试

TurtleBot-Tutorial

本文根据对官方提供的TURTLEBOT功能包内的每一个功能包进行编译测试,并对出现问题的功能包纠错与更新实现了跨版本移植;

arbotix_ros 移植编译正常


ar_track_alvar 移植编译正常


depthimage_to_laserscan 移植测试失败,终端提示错误

TurtleBot-Tutorial/depthimage_to_laserscan/src/DepthImageToLaserScanNodelet.cpp

第60行代码
PLUGINLIB_DECLARE_CLASS(depthimage_to_laserscan, DepthImageToLaserScanNodelet, depthimage_to_laserscan::DepthImageToLaserScanNodelet, nodelet::Nodelet);
修订如下
PLUGINLIB_EXPORT_CLASS(depthimage_to_laserscan::DepthImageToLaserScanNodelet, nodelet::Nodelet)

修订完成后,移植编译正常


hector_slam 移植编译正常


m-explore 移植编译正常


navigation 移植测试失败,终端提示错误

替换navigation包
https://github.com/ros-planning/navigation.git
通过在终端中键入如下命令进行下载
git clone https://github.com/ros-planning/navigation.git

修订完成后,移植编译正常


rbx1 移植编译正常


robot_voice 移植测试失败,终端提示错误

下载科大迅飞 SDK 参考文章

  1. 首先需要进行账号注册方可下载SDK
  2. 进入控制台
  3. 创建新服务
  4. 服务创建完成后返回主页进入SDK下载
  5. 解压下载的SDK,并执行以下命令,将libmsc.so文件拷贝至/usr/lib路径下
cd Linux_iat1227_tts_online1227_5f7c3a77/libs/x64/
sudo cp libmsc.so /usr/lib/

修订完成后,移植编译正常


rosbag 移植编译正常


rplidar_ros 移植编译正常


slam_gmapping 移植编译正常


turtlebot 移植编译正常


turtlebot3 移植编译正常


turtlebot_apps 移植编译正常


vision_detector 移植编译正常


vision_tensorflow 移植编译正常

测试

在rviz上仿真

调出TurtleBot3机器人模型

/TurtleBot-Tutorial/turtlebot3/turtlebot3_simulations/turtlebot3_fake/launch
roslaunch turtlebot3_fake turtlebot3_fake.launch

turtlebot3_fake.launch

<launch>
  <!-- Set the arg which name model and the default value from the enviroment TURTLEBOT3_MODEL -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>

 <!-- Set the param which name is tb3_model and the value is from the arg model -->
  <param name="tb3_model" value="$(arg model)"/>

 <!-- load the xml file which contain the turtlebot3_description patn -->
 <!-- Set the arg model which value from the arg model -->
  <include file="$(find turtlebot3_bringup)/launch/includes/description.launch.xml">
    <arg name="model" value="$(arg model)" />
  </include>

 <!-- Start a node which name turtlebot3_fake_node and pkg name is turtlebot3_fake and type is turtlebot3_fake_node , also output the log in the screen -->
  <node pkg="turtlebot3_fake" type="turtlebot3_fake_node" name="turtlebot3_fake_node" output="screen" />

 <!-- Start a node which name robot_state_publisher and pkg name is robot_state_publisher and type is robot_state_publisher , also output the log in the screen -->
 <!-- Set the param which name is publish_frequency and type is double , value is 50.0 -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
    <param name="publish_frequency" type="double" value="50.0" />
  </node>

 <!-- Start a node whic name rviz and pkg is rviz and type is rviz , and args is a rviz config where is in the /turtlebot3_fake/rviz/turtlebot3_fake.rviz -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find turtlebot3_fake)/rviz/turtlebot3_fake.rviz"/>
</launch>

description.launch.xml

<launch>
 <!-- Set arg name is model -->
  <arg name="model"/>

 <!-- Set arg name is urdf_file and default value is a path which point to /turtlebot3_description/urdf/turtlebot3_model(value).urdf.xacro -->
 <!-- Set param name is robot_description and load the arg urdf_file which is turtlebot3_description to the param server -->
  <arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro'" />
  <param name="robot_description" command="$(arg urdf_file)" />
</launch>

在启动的终端中可以看到如下输出

SUMMARY
========

PARAMETERS
 * /robot_description: <?xml version="1....
 * /robot_state_publisher/publish_frequency: 50.0
 * /rosdistro: melodic
 * /rosversion: 1.14.9
 * /tb3_model: waffle_pi

NODES
  /
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rviz (rviz/rviz)
    turtlebot3_fake_node (turtlebot3_fake/turtlebot3_fake_node)

使TurtleBot3可以通过键盘控制

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

turtlebot3_teleop_key.launch

<launch>
 <!-- Set arg which name is model and default value from the enviroment TURTLEBOT3_MODEL -->
 <!-- Set param which name is model and value from the arg which name is model -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <param name="model" value="$(arg model)"/>

 <!-- turtlebot3_teleop_key already has its own built in velocity smoother -->
 <!-- Start a node which name turtlebot3_teleop_keyboard and pkg name is turtlebot3_teleop and type is turtlebot3_teleop_key , also output the log in the screen -->
  <node pkg="turtlebot3_teleop" type="turtlebot3_teleop_key" name="turtlebot3_teleop_keyboard"  output="screen">
  </node>
</launch>

发表评论

后才能评论

评论列表(5条)

  • pf3gg_9828 2021年1月18日 下午12:40

    老师您好,我想请问catkin_make出现下面这个错误怎么办

    CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
    execute_process(/home/chy/catkin_ws/build/catkin_generated/env_cached.sh
    “/usr/bin/python2” “/usr/bin/empy” “–raw-errors” “-F”
    “/home/chy/catkin_ws/build/catkin_generated/order_packages.py” “-o”
    “/home/chy/catkin_ws/build/catkin_generated/order_packages.cmake”
    “/opt/ros/melodic/share/catkin/cmake/em/order_packages.cmake.em”) returned
    error code 1
    Call Stack (most recent call first):
    /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
    /opt/ros/melodic/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)
    CMakeLists.txt:69 (catkin_workspace)

    — Configuring incomplete, errors occurred!
    See also “/home/chy/catkin_ws/build/CMakeFiles/CMakeOutput.log”.
    See also “/home/chy/catkin_ws/build/CMakeFiles/CMakeError.log”.
    Makefile:320: recipe for target ‘cmake_check_build_system’ failed
    make: *** [cmake_check_build_system] Error 1
    Invoking “make cmake_check_build_system” failed

    • 吴凯荣 回复 pf3gg_9828 2021年1月18日 下午4:17

      我这篇文章讲述的是对Turtlebot整个功能包,依次添加每一个里面的功能包进行测试的,你这个报错没有明确的问题指向,其次我也不是很清楚,你可以像我一样,以此添加依赖的功能包,依次编译,按照我上面梳理的步骤以及解决方案就可以实现移植了

  • dabing3000 2020年12月11日 下午4:17

    gmapping和amcl的包是源码编译还是二进制安装?是否在turtlebot2的底盘上实际运行过?

    • 吴凯荣 回复 dabing3000 2020年12月12日 上午1:31

      直接二进制安装即可,在Gazebo仿真中实现过

    • dabing3000 回复 吴凯荣 2020年12月15日 上午10:47

      我测试过了,一切正常。有一点小问题是turtlebot_description有些文件修改了,需要根据报错调整一下。