Turtlebot: Turtlebot development environment 开发环境搭建
Turtlebot: Turtlebot development environment 开发环境搭建
# Objectives:
- Install Turtlebot2 on Ubuntu 16.04 (ROS Kinetic)
- Install Turtlebot2 in Docker (Ubuntu 16.04)
- Install Turtlebot3 in Ubuntu 18.04 (ROS Melodic)
版本简介
- Turtlebot2
- ROS Kinetic 安装没有问题,非常容易。
- ROS Melodic 目前不支持,需要安装的话,需要自己编译源码安装。我试了试,非常复杂,没试成功,暂时搁置。
- Turtlebot3
- ROS Kinetic OK
- ROS Melodic OK
# Installation
## Install Turtlebot 2 in ROS Kinetic
```sh
sudo apt-get install ros-kinetic-turtlebot-*
```
常用源码:
```sh
git clone https://github.com/turtlebot/turtlebot.git
git clone https://github.com/turtlebot/turtlebot_simulator.git
git clone https://github.com/turtlebot/turtlebot_msgs.git
git clone https://github.com/udacity/robot_pose_ekf
git clone https://github.com/ros-perception/depthimage_to_laserscan.git
```
## Install Turtlebot 2 in ROS Melodic
```sh
https://github.com/turtlebot/turtlebot/issues/272:
I was having issues on ubuntu 18.04 with melodic. I got it to work after building packages one by one. Here is what I did and worked for me. Hope this helps.
Here are the dependent packages that you will need
turtlebot_simulator
turtlebot
turtlebot_apps
robot_pose_ekf
depthimage_to_laserscan
kobuki_msgs
kobuki_desktop
orocos-bayesian-filtering
turtlebot_msgs
joystick_drivers
kobuki_description
kobuki_bumper2pc
yocs_cmd_vel_mux
turtlebot_interactions
Below are instructions for getting each package and related dependencies.
my catkin workspace is at ~/source/workspaces/robotics/catkin_ws
cd ~/source/workspaces/robotics/catkin_ws/src
turtlebot_simulator
git clone https://github.com/turtlebot/turtlebot_simulator
turtlebot
git clone https://github.com/turtlebot/turtlebot.git
turtlebot_apps
git clone https://github.com/turtlebot/turtlebot_apps.git
robot_pose_ekf
git clone https://github.com/udacity/robot_pose_ekf
depthimage_to_laserscan
git clone https://github.com/ros-perception/depthimage_to_laserscan.git
kobuki_msgs
git clone https://github.com/yujinrobot/kobuki_msgs.git
kobuki_desktop
git clone https://github.com/yujinrobot/kobuki_desktop.git
cd kobuki_desktop/
rm -r kobuki_qtestsuite
install opencv follow instructions given below since bayesian filter depends on it
https://docs.microsoft.com/en-us/cognitive-toolkit/setup-opencv-on-linux
if you get stdlib error use -DENABLE_PRECOMPILED_HEADERS=OFF flag on cmake
orocos-bayesian-filtering
git clone https://github.com/toeklk/orocos-bayesian-filtering.git
cd ..
catkin_make
if you get errors here try building them individually
cd src/orocos-bayesian-filtering/
make
make install
cd orocos_bfl/
./configure
make
make install
sudo make install
We are not done yet, we need following dependencies...
turtlebot_msgs
cd ~/source/workspaces/robotics/catkin_ws/src
git clone https://github.com/turtlebot/turtlebot_msgs.git
joystick_drivers
first install following dependencies for joystick drivers
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
git clone https://github.com/ros-drivers/joystick_drivers.git
kobuki_description
clone entire kobuki repository some where
cd ~/repos/
git clone https://github.com/yujinrobot/kobuki.git
copy only description package to your workspace src directory
cd kobuki
cp -r kobuki_description ~/source/workspaces/robotics/catkin_ws/src/
At this point catkin_make error should be gone and you should be able to roslaunch turtlebot_gazebo but with lots of red error on console. These are due to some missing nodes in following packages.
kobuki_bumper2pc
copy from kobuki repo
cd ~/source/workspaces/robotics/catkin_ws/src/
cp -r ~/repos/kobuki/kobuki_bumper2pc .
turtlebot_interactions
git clone https://github.com/turtlebot/turtlebot_interactions.git
yocs_cmd_vel_mux
clone entire repo somewhere
cd ~/repos
git clone https://github.com/yujinrobot/yujin_ocs.git
copy only cmd_vel_mux
cd ~/source/workspaces/robotics/catkin_ws/src/
cp -r ~/repos/yujin_ocs/yocs_cmd_vel_mux/ .
cd ..
catkin_make
```
我还没有试,应该问题不大。
## Install Turtlebot 3 in ROS Kinetic
```sh
$ sudo apt-get install ros-melodic-turtlebot3-*
```
## Install Turtlebot 2 in Docker (16.04)
It is a little difficult to install Turtlebot 2 in Docker. You may encounter problem about "ros-kinetic-librealsense".
The reason is "The ros-kinetic-librealsense is based on Librelasense1 and support v4.4 kernel".
My Linux (inside Docker) version:
```sh
# uname -a
Linux yubao-GP65-Leopard-9SD 5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
# lsb_release -r
Release: 16.04
```
My host machine version:
```sh
✗ uname -a
Linux yubao-GP65-Leopard-9SD 5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
✗ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
```
We have to modify "ros-kinetic-librealsense" and install it.
Use these codes to install Turtlebot2, and I have tried. It works for me.
```sh
#####################Install turtlebot2###########################
# Fix ros-kinetic-librealsense_probem: https://github.com/IntelRealSense/librealsense/issues/4781
# basic container setup
RUN apt-get update \
&& apt-get install -y lsb-release \
&& apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 \
&& echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list \
&& apt-get update
# dependencies needed by librealsense. `deb -i` will not resolve these
RUN apt-get install -y binutils cpp cpp-5 dkms fakeroot gcc gcc-5 kmod libasan2 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libfakeroot libgcc-5-dev libgmp10 libgomp1 libisl15 libitm1 liblsan0 libmpc3 libmpfr4 libmpx0 libquadmath0 libssl-dev libssl-doc libtsan0 libubsan0 libusb-1.0-0 libusb-1.0-0-dev libusb-1.0-doc linux-headers-4.4.0-159 linux-headers-4.4.0-159-generic linux-headers-generic linux-libc-dev make manpages manpages-dev menu patch zlib1g-dev \
&& apt-get install -y libssl-dev libssl-doc libusb-1.0-0 libusb-1.0-0-dev libusb-1.0-doc linux-headers-4.4.0-159 linux-headers-4.4.0-159-generic linux-headers-generic zlib1g-dev
# modify librealsense deb (unpack, replace script, repack)
RUN apt-get download ros-kinetic-librealsense \
&& dpkg-deb -R ros-kinetic-librealsense*.deb ros-rslib/ \
&& wget https://gist.githubusercontent.com/dizz/404ef259a15e1410d692792da0c27a47/raw/3769e80a051b5f2ce2a08d4ee6f79c766724f495/postinst \
&& chmod +x postinst \
&& cp postinst ros-rslib/DEBIAN \
&& dpkg-deb -b ./ros-rslib/ ros-kinetic-librealsense_1.12.1-0xenial-20190830_icrlab_amd64.deb
# install container friendly libsense
RUN dpkg -i ros-kinetic-librealsense_1.12.1-0xenial-20190830_icrlab_amd64.deb
# lock from updates
RUN apt-mark hold ros-kinetic-librealsense
# Install Turtlebot2
RUN apt update \
&& apt-get install -y ros-kinetic-turtlebot-*
#######################################################################
```
# Test
### Turtlebot 2
```sh
roslaunch turtlebot_gazebo turtlebot_world.launch
```
Demo:
### Turtlebot 3
```sh
✗ export TURTLEBOT3_MODEL=burger
➜ RobotSimulator git:(master) ✗ roslaunch turtlebot3_gazebo turtlebot3_house.launch
```
![image-20200624195031544](https://cdn.jsdelivr.net/gh/yubaoliu/assets@image/turtlebot3_house.png)
# Possible Errors
## Error about ros-kinetic-librealsense
- Environment
- Docker
```sh
docker --version
Docker version 19.03.11, build 42e35e61f3
```
- Ubuntu 16.04
- Cuda 10.2
- Problem
```sh
ros-kinetic-turtlebot-simulator depends on ros-kinetic-turtlebot-gazebo; however:
Package ros-kinetic-turtlebot-gazebo is not configured yet.
ros-kinetic-turtlebot-simulator depends on ros-kinetic-turtlebot-stage; however:
Package ros-kinetic-turtlebot-stage is not configured yet.
ros-kinetic-turtlebot-simulator depends on ros-kinetic-turtlebot-stdr; however:
Package ros-kinetic-turtlebot-stdr is not configured yet.
dpkg: error processing package ros-kinetic-turtlebot-simulator (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Errors were encountered while processing:
ros-kinetic-librealsense
ros-kinetic-realsense-camera
ros-kinetic-turtlebot-bringup
ros-kinetic-turtlebot-navigation
ros-kinetic-turtlebot-gazebo
ros-kinetic-turtlebot-stage
ros-kinetic-turtlebot-stdr
ros-kinetic-turtlebot-simulator
E: Sub-process /usr/bin/dpkg returned an error code (1)
```
- Solution
```sh
https://github.com/IntelRealSense/librealsense/issues/2402:
The ros-kinetic-librealsense is based on Librelasense1 and support v4.4 kernel.
In case you need to deploy it with kernel 4.15 I would suggest the following:
Switch to kernel 4.4 and then install the package normally, i.e:
sudo apt-get install ros-kinetic-librealsense.
Switch to kernel 4.15 and then install librealsense2-dkms package only.
The dkms for librealsense2 is backward-compatible with all devices librealsense1 supported as well.
```
ros-kinetic-librealsense fails on install within container:
https://github.com/IntelRealSense/librealsense/issues/4781
我觉的,应该先要把 ros-kinetic-librealsense 安上,Turtlebot是依赖这个包的,然而在Docker中这个包的安装会有点麻烦。按这个链接里讲的做,最终成功了。
## TURTLEBOT3_MODEL (Turtlebot3)
```sh
✗ roslaunch turtlebot3_gazebo turtlebot3_house.launch
... logging to /tmp/ros/e2d5df6e-b606-11ea-a809-c0b883f2e8ec/roslaunch-yubao-GP65-Leopard-9SD-14058.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
RLException: Invalid tag: environment variable 'TURTLEBOT3_MODEL' is not set.
Arg xml is
The traceback for the exception was written to the log file
```
Solution:
```sh
✗ export TURTLEBOT3_MODEL=burger
```
# References
- [turtlebot-GitHub](https://github.com/turtlebot)
- [Check Kernal version, Ubuntu16.04](https://wiki.ubuntu.com/Kernel/Support?action=AttachFile&do=view&target=16.04.x+Ubuntu+Kernel+Support+Schedule.svg)
- [gaunthan/Turtlebot2-On-Melodic](https://github.com/gaunthan/Turtlebot2-On-Melodic) 没试过
- [ROS机器人实例 —— TurtleBot](https://zhuanlan.zhihu.com/p/35822939)
- [How to Launch the TurtleBot3 Simulation With ROS](https://automaticaddison.com/how-to-launch-the-turtlebot3-simulation-with-ros/)
- [Turtlebot3 Manual](https://emanual.robotis.com/docs/en/platform/turtlebot3/pc_setup/#install-ubuntu-on-remote)
- [Turtlebot入门教程-安装Turtlebot(ubuntu18.04+Melodic)](https://www.ncnynl.com/archives/201903/2884.html)
No comments