Turtlebot3 Rasberry pi

Installation manual of turtlebot3 with Raspberry pi

Installation

Prerequisites

Turtlebot3, Raspberry pi, OpenCR board (all things are packaged in a Turtlebot3 box)

Basic installation

  • Assemble Turtlebot3, Raspberry pi and OpenCR through manual.

  • Boot Raspberry pi with micro SDCard.

  • Follow Remote PC setup.

  • Make sure ROS packages are properly installed to Raspberry pi and Remote PC.

    • If "catkin_make" command is completed without any errors, ROS is well installed.

Network configuration

  • Turtlebot3 can be connected to remote PC by wifi networks or ethernet cable.
  • To drive ROS for both components, they need to know other's ip network
    by setting "ROS_MASTER_URI" and "ROS_IP" at "~/.bashrc".
  • Turtlebot3 or Remote PC both can be "ROS_MASTER_URI".
#### Remote PC master
At Remote PC "~/.bashrc", add
ROS_MASTER_URI=http://IP_OF_REMOTE_PC:11311
ROS_IP=IP_OF_REMOTE_PC

At turtlebot3 "~/.bashrc", add
ROS_MASTER_URI=http://IP_OF_REMOTE_PC:11311
ROS_IP=IP_OF_TURTLEBOT3

#### Turtlebot3 master
At Remote PC "~/.bashrc", add
ROS_MASTER_URI=http://IP_OF_TURTLEBOT3:11311
ROS_IP=IP_OF_REMOTE_PC

At turtlebot3 "~/.bashrc", add
ROS_MASTER_URI=http://IP_OF_TURTLEBOT3:11311
ROS_IP=IP_OF_TURTLEBOT3
  • Make sure "http://" is only prefixed for "ROS_MASTER_URI". "http://" should not be added to "ROS_IP" and "ROS_HOSTNAME"

  • Connection by wifi networks

    • For Linux installed Remote PC, need to setup UBUNTU HOTSPOT to communicate only with turtlebot3.
    • After ubuntu hotspot setup, connect turtlebot3 to hidden wifi networks created by Remote PC.
    • Check ip address of Remote PC and turtlebot3 by "ifconfig" command.
  • Connection by ethernet

    • Connect Remote PC and raspberry pi by ethernet cable.
    • At Remote PC ethernet configuration, ipv4 window, set connection mode as "share with other computers".
      • This makes Remote PC and turtlebot3 connected by ethernet cable.
    • Check ip address of Remote PC and turtlebot3 by "ifconfig" command.
  • Check connection by ssh command. If connection is successfully setup, you can access to turtlebot3 with turtlebot3 ip address.

    • Do not need connect monitor, keyboard and mouse to turtlebot3 anymore!
    ssh turtlebot3_name@IP_OF_TURTLEBOT3
    

OpenCR setup with Arduino

  • OpenCR setup,

    • Make sure jump_to_fw text be printed.
    • Do not need to install Arduino on raspberry pi. Install Arduino on your Remote PC. Arduino setup(
    • Connect OpenCR to your Remote PC and run Arudino on your Remote PC.
  • Before uploading Examples/turtlebot3/turtlebot3_model/turtlebot3_core,
    need to setup first DYNAMIXEL firmware on OpenCR.

    • If not, DYNAMIXEL will not move at all.
  • In Arduino window, go to Examples/turtlebot3/turtlebot3_setup/turtlebot3_motor_setup and upload.

    • When setup DYNAMIXEL, need to connect only one DYNAMIXEL to OpenCR.
      Motor_setup firmware can not find two DYNAMIXELs at the same time.
       * Open serial monitor and check each DYNAMIXEL motor work successfully.
    • After setup two DYNAMIXELs, connect both DYNAMIXELs to OpenCR and upload turtlebot3_core.
    • After that, connect OpenCR to raspberry pi.

Move Turtlebot3

Bringup Turtlebot3

To move Turtlebot3, need to do bringup first to Turtlebot3

  • Run roscore at master node
    • If roscore gives an error, check "ROS_MASTER_URI" and "ROS_IP" in ~/.bashrc at Remote PC and Turtlebot3.
    • roscore must be executed when you connect Turtlebot3 and Remote PC.
    roscore
    
  • Bring up turtlebot3
roslaunch turtlebot3_bringup turtlebot3_robot.launch

ROSTOPIC

  • If connection is well established, you can check rostopic list after executing roscore and bringup
rostopic list
  • Can check rostopic value at Remote PC
rostopic echo /cmd_vel

Setup webcam to raspberry pi

  • Install usb_cam ros package
    • Make sure web cam is well connected via <ls /dev/video>* command
    cd ~/catkin_ws/src
    git clone https://github.com/bosch-ros-pkg/usb_cam.git
    cd ..
    catkin_make(build again)
    

Test usb_cam before connect Remote PC

  • Set ROS_MASTER_URI and ROS_HOSTNAME as localhost
At turtlebot3 "~/.bashrc", 
ROS_MASTER_URI=http://localhost:11311
ROS_HOSTNAME=localhost
  • Run ROS
    • usb_cam-test.launch file is located at ~/catkin_ws/src/usb_cam/launch/usb_cam-test.launch.
    • Do not need to execute roscore when you do roslaunch. Launch file will execute roscore itself.
    • Camera image window will be popped up.
    roslaunch usb_cam usb_cam-test.launch
    
  • Compressed image for fast transferring.
    • Need to execute roscore first when you do rosrun. rosrun just execute node.
    sudo apt-get install ros-kinetic-compressed-image-transport
    roscore
    rosrun iamge_view image_view image:=/usb_cam/image_raw _transport:=compressed
    

Multiple web cams

  • Check web cams are well connected

    • May be /dev/video0, /dev/video1, /dev/video2...
  • Launch file should be edited. Distinguishing cameras by group.

  • Check usb_cam_multi_cam.launch file.

Reference

  1. Turtlebot3 emanual
  2. Robotics blog