Nano入门教程软件篇-安装Turtlebot(melodic版本)
**Nano入门教程软件篇-安装Turtlebot(melodic版本) **
说明:
- 介绍如何在Nano的ubuntu 18.04系统下安装turtlebot
步骤:
先完成ROS melodic安装,参考教程
编译turtlebot过程会提示缺少opencv3.2的库文件,下面教程安装
完成opencv3.2的安装,参考教程:https://www.ncnynl.com/archives/201903/2900.html
复制所需要的库到对应的目录
cd /lib/aarch64-linux-gnu
sudo ln -s /usr/local/lib/libopencv_aruco.so.3.2.0 libopencv_aruco.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudaimgproc.so.3.2.0 libopencv_cudaimgproc.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_flann.so.3.2.0 libopencv_flann.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_phase_unwrapping.so.3.2.0 libopencv_phase_unwrapping.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_surface_matching.so.3.2.0 libopencv_surface_matching.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_bgsegm.so.3.2.0 libopencv_bgsegm.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudalegacy.so.3.2.0 libopencv_cudalegacy.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_freetype.so.3.2.0 libopencv_freetype.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_photo.so.3.2.0 libopencv_photo.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_text.so.3.2.0 libopencv_text.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_bioinspired.so.3.2.0 libopencv_bioinspired.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudaobjdetect.so.3.2.0 libopencv_cudaobjdetect.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_fuzzy.so.3.2.0 libopencv_fuzzy.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_plot.so.3.2.0 libopencv_plot.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_videoio.so.3.2.0 libopencv_videoio.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_calib3d.so.3.2.0 libopencv_calib3d.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudaoptflow.so.3.2.0 libopencv_cudaoptflow.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_hdf.so.3.2.0 libopencv_hdf.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_reg.so.3.2.0 libopencv_reg.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_video.so.3.2.0 libopencv_video.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_ccalib.so.3.2.0 libopencv_ccalib.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudastereo.so.3.2.0 libopencv_cudastereo.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_highgui.so.3.2.0 libopencv_highgui.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_rgbd.so.3.2.0 libopencv_rgbd.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_videostab.so.3.2.0 libopencv_videostab.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_core.so.3.2.0 libopencv_core.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudawarping.so.3.2.0 libopencv_cudawarping.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_imgcodecs.so.3.2.0 libopencv_imgcodecs.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_saliency.so.3.2.0 libopencv_saliency.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_viz.so.3.2.0 libopencv_viz.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudaarithm.so.3.2.0 libopencv_cudaarithm.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudev.so.3.2.0 libopencv_cudev.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_imgproc.so.3.2.0 libopencv_imgproc.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_shape.so.3.2.0 libopencv_shape.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_xfeatures2d.so.3.2.0 libopencv_xfeatures2d.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudabgsegm.so.3.2.0 libopencv_cudabgsegm.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_datasets.so.3.2.0 libopencv_datasets.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_line_descriptor.so.3.2.0 libopencv_line_descriptor.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_stereo.so.3.2.0 libopencv_stereo.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_ximgproc.so.3.2.0 libopencv_ximgproc.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudacodec.so.3.2.0 libopencv_cudacodec.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_dpm.so.3.2.0 libopencv_dpm.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_ml.so.3.2.0 libopencv_ml.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_stitching.so.3.2.0 libopencv_stitching.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_xobjdetect.so.3.2.0 libopencv_xobjdetect.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudafeatures2d.so.3.2.0 libopencv_cudafeatures2d.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_face.so.3.2.0 libopencv_face.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_objdetect.so.3.2.0 libopencv_objdetect.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_structured_light.so.3.2.0 libopencv_structured_light.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_xphoto.so.3.2.0 libopencv_xphoto.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_cudafilters.so.3.2.0 libopencv_cudafilters.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_features2d.so.3.2.0 libopencv_features2d.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_optflow.so.3.2.0 libopencv_optflow.so.3.2.0
sudo ln -s /usr/local/lib/libopencv_superres.so.3.2.0 libopencv_superres.so.3.2.0
- 安装依赖:
$ sudo apt-get install ros-melodic-kobuki-*
$ sudo apt-get install ros-melodic-ecl-streams
$ sudo apt-get install libusb-dev
$ sudo apt-get install libspnav-dev
$ sudo apt-get install ros-melodic-joystick-drivers
$ sudo apt-get install bluetooth
$ sudo apt-get install libbluetooth-dev
$ sudo apt-get install libcwiid-dev
- 新建工作空间,准备相关包
$ mkdir -p ~/turtlebot_ws/src
$ cd ~/turtlebot_ws/src
$ git clone https://github.com/turtlebot/turtlebot_simulator
$ git clone https://github.com/turtlebot/turtlebot.git
$ git clone https://github.com/turtlebot/turtlebot_apps.git
$ git clone https://github.com/udacity/robot_pose_ekf
$ git clone https://github.com/ros-perception/depthimage_to_laserscan.git #需要依赖opencv3.2
$ git clone https://github.com/yujinrobot/kobuki_msgs.git
$ git clone https://github.com/yujinrobot/kobuki_desktop.git
$ cd kobuki_desktop/
$ rm -r kobuki_qtestsuite
$ git clone https://github.com/toeklk/orocos-bayesian-filtering.git
$ git clone https://github.com/turtlebot/turtlebot_msgs.git
$ git clone https://github.com/ros-drivers/joystick_drivers.git
- 复制kobuki和yujin_ocs依赖库到turtlebot_ws/src工作空间下
$ mkdir -p ~/repos/
$ cd ~/repos/
$ git clone https://github.com/yujinrobot/kobuki.git
$ cp -r kobuki/* ~/turtlebot_ws/src/
$ git clone https://github.com/yujinrobot/yujin_ocs.git
$ cp -r yujin_ocs/yocs_cmd_vel_mux/ yujin_ocs/yocs_controllers ~/turtlebot_ws/src/
- 编译工作空间
$ cd ~/turtlebot_ws
$ rosdep install --from-paths src --ignore-src -r -y
$ catkin_make
- 添加工作空间到bashrc文件
echo "source ~/turtlebot_ws/devel/setup.bash" >> ~/.bashrc
- 启用环境变量
source ~/.bashrc
测试:
- 启动底盘
roslaunch turtlebot_bringup minimal.launch
- 显示如下:
ubuntu@AiROS-XA:~/turtlebot_ws/src$ roslaunch turtlebot_bringup minimal.launch
... logging to /home/ubuntu/.ros/log/a22c211a-7888-11e9-8396-00044bcb943f/roslaunch-AiROS-XA-6402.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
xacro: in-order processing became default in ROS Melodic. You can drop the option.
started roslaunch server http://AiROS-XA:41151/
SUMMARY
========
PARAMETERS
* /bumper2pointcloud/pointcloud_radius: 0.24
* /cmd_vel_mux/yaml_cfg_file: /home/ubuntu/turt...
* /diagnostic_aggregator/analyzers/input_ports/contains: ['Digital Input',...
* /diagnostic_aggregator/analyzers/input_ports/path: Input Ports
* /diagnostic_aggregator/analyzers/input_ports/remove_prefix: mobile_base_nodel...
* /diagnostic_aggregator/analyzers/input_ports/timeout: 5.0
* /diagnostic_aggregator/analyzers/input_ports/type: diagnostic_aggreg...
* /diagnostic_aggregator/analyzers/kobuki/contains: ['Watchdog', 'Mot...
* /diagnostic_aggregator/analyzers/kobuki/path: Kobuki
* /diagnostic_aggregator/analyzers/kobuki/remove_prefix: mobile_base_nodel...
* /diagnostic_aggregator/analyzers/kobuki/timeout: 5.0
* /diagnostic_aggregator/analyzers/kobuki/type: diagnostic_aggreg...
* /diagnostic_aggregator/analyzers/power/contains: ['Battery', 'Lapt...
* /diagnostic_aggregator/analyzers/power/path: Power System
* /diagnostic_aggregator/analyzers/power/remove_prefix: mobile_base_nodel...
* /diagnostic_aggregator/analyzers/power/timeout: 5.0
* /diagnostic_aggregator/analyzers/power/type: diagnostic_aggreg...
* /diagnostic_aggregator/analyzers/sensors/contains: ['Cliff Sensor', ...
* /diagnostic_aggregator/analyzers/sensors/path: Sensors
* /diagnostic_aggregator/analyzers/sensors/remove_prefix: mobile_base_nodel...
* /diagnostic_aggregator/analyzers/sensors/timeout: 5.0
* /diagnostic_aggregator/analyzers/sensors/type: diagnostic_aggreg...
* /diagnostic_aggregator/base_path:
* /diagnostic_aggregator/pub_rate: 1.0
* /mobile_base/base_frame: base_footprint
* /mobile_base/battery_capacity: 16.5
* /mobile_base/battery_dangerous: 13.2
* /mobile_base/battery_low: 14.0
* /mobile_base/cmd_vel_timeout: 0.6
* /mobile_base/device_port: /dev/kobuki
* /mobile_base/odom_frame: odom
* /mobile_base/publish_tf: True
* /mobile_base/use_imu_heading: True
* /mobile_base/wheel_left_joint_name: wheel_left_joint
* /mobile_base/wheel_right_joint_name: wheel_right_joint
* /robot/name: turtlebot
* /robot/type: turtlebot
* /robot_description: <?xml version="1....
* /robot_state_publisher/publish_frequency: 5.0
* /rosdistro: melodic
* /rosversion: 1.14.3
* /use_sim_time: False
NODES
/
bumper2pointcloud (nodelet/nodelet)
cmd_vel_mux (nodelet/nodelet)
diagnostic_aggregator (diagnostic_aggregator/aggregator_node)
mobile_base (nodelet/nodelet)
mobile_base_nodelet_manager (nodelet/nodelet)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
auto-starting new master
process[master]: started with pid [6415]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to a22c211a-7888-11e9-8396-00044bcb943f
process[rosout-1]: started with pid [6426]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [6434]
process[diagnostic_aggregator-3]: started with pid [6435]
process[mobile_base_nodelet_manager-4]: started with pid [6440]
process[mobile_base-5]: started with pid [6444]
process[bumper2pointcloud-6]: started with pid [6448]
process[cmd_vel_mux-7]: started with pid [6451]
- 启动键盘控制
roslaunch turtlebot_teleop keyboard_teleop.launch
- 显示如下:
ubuntu@AiROS-XA:~$ roslaunch turtlebot_teleop keyboard_teleop.launch
... logging to /home/ubuntu/.ros/log/a22c211a-7888-11e9-8396-00044bcb943f/roslaunch-AiROS-XA-6533.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://AiROS-XA:41229/
SUMMARY
========
PARAMETERS
* /rosdistro: melodic
* /rosversion: 1.14.3
* /turtlebot_teleop_keyboard/scale_angular: 1.5
* /turtlebot_teleop_keyboard/scale_linear: 0.5
NODES
/
turtlebot_teleop_keyboard (turtlebot_teleop/turtlebot_teleop_key)
ROS_MASTER_URI=http://localhost:11311
process[turtlebot_teleop_keyboard-1]: started with pid [6552]
Control Your Turtlebot!
---------------------------
Moving around:
u i o
j k l
m , .
q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%
space key, k : force stop
anything else : stop smoothly
CTRL-C to quit
currently: speed 0.2 turn 1
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号