turtlebot2-tutorials

ROS Arduino

This tutorial provides the necessary setup for using an Arduino with ROS.

Prequisites

This section requires the catkin_ws to be initialized and the turtlebot_dabit package created.
Please click here to learn how to initialize the catkin workspace

Installing ROSSERIAL

These are the basic steps for installing ROSSERIAL and the arduino libraries. For detailed installation steps, click here

  1. ROSSERIAL is a package used to bridge ROS with devices using a serial connection
    • sudo apt install ros-kinetic-rosserial* -y
  2. Download the latest Arduino IDE if you don’t have it installed
    • Start Arduino at least once before continuing
  3. CD to your libraries folder in your Arduino Sketchbook (typically ~/Arduino)
    • cd ~/Arduino/libraries
  4. Run rosserial to generate ros_lib:
    • rosrun rosserial_arduino make_libraries.py .

Connecting to the Arduino

  1. Finding the Arduino’s mount point:
    • sudo dmesg -C
    • unplug the Arduino, replug the Arduino
    • sudo dmesg
    • Find the Device Connected info and look for:
      [ 2857.315493] usb 1-6: FTDI USB Serial Device converter now attached to ttyUSB0
  2. Make an arduino.launch file in the ~/catkin_ws/src/turtlebot_dabit/launch folder:
    • gedit arduino.launch ```xml

```

  1. Build your package using catkin
    • cd ~/catkin_ws
    • catkin_make

Verifying connection to the Arduino

  1. Launch arduino.launch
    • source ~/catkin_ws/devel/setup.sh
    • roslaunch turtlebot_dabit arduino.launch

Sending data to the Arduino

Follow our a simple Arduino subscriber tutorial

Receiving data from the Arduino

Follow our a simple Arduino publisher tutorial

Additional Tutorials

ROSSERIAL has recently improved their tutorials, and have a very wide selection of examples. Check out the ROSSerial_Arduino Tutorials

What’s Next?

Arduino Subscriber
Arduino Publisher

Troubleshooting

On some arduino’s, the port may be ttyACM0. If so, change the port in the arduino.launch and change the permissions to the portsudo chmod 777 /dev/ttyACM0

Return to the main README page