Close

Radiation Counting - Ready for ROS

A project log for GeigerROS

A ROS enabled Geiger counter radiation sensor for easy robotic use. We use it on a Turtlebot3 robot for testing.

moritz-kttMoritz Kütt 05/22/2018 at 19:190 Comments

After we got a single radiation detectors to work with an Arduino Nano, the next step was to connect three of them to the board and write a sketch that provides the data as ROS topics using the rosserial package.

Instead of using a breadboard to connect the Arduino Nano to the detectors (and the little buzzer, see previous logs), we decided to solder it onto a half-size proto board. This makes most connections somewhat more reliable. The cables to the detectors where connected using angled pin headers.

The Arduino runs this sketch. Same as for one detector, but now with three. And with the ability to provide ROS topics. To compile the sketch, it is necessary to install the rosserial libraries for the Arduino IDE. The package provides an include file that has to be used in the sketch.

As the Nano does not have a direct connection to the ROS network, it is necessary to run an additional bridging node. For our setup, the Nano is connected via USB to the RaspberryPi of the Turtlebot3. The bridge is provided by `rosserial_python` command. Here is a small drawing possibly helping the explanation:

+---------------------------+        +---------------------------+         +---------------------------+
|                           |        |                           |         |                           |
|        `rosserial`        | Serial |    `rosserial_python`     | Network |         `roscore`         |
|      on Arduino Nano      +-------->      on RaspberryPi       +--------->         on Laptop         |
| collecting radiation data |  over  |  bridging serial to wifi  | (WiFi)  |   providing ROS master    |
|                           |  USB   |                           |         |                           |
+---------------------------+        +---------------------------+         +---------------------------+

After we compiled and loaded the sketch on the Arduino Nano, and started the bridge node on the RasberryPi, three new ROS topics became available - gamma1, gamma2 and gamma3 for the three detectors. The topics only provide output whenever one respective detector detects an event, the output is the time since the startup of the Arduino Nano in micro seconds.

It all worked well, until we started to put the other parts of the Turtlebot 3 back together. Suddenly, we ran into problems with the serial bridge. Of course - the situation is more complex than depicted in the drawing above. The Turtlebot 3 is run by OpenCR, a control module made by Robotis. It also connects to ROS over a serial/USB connection via the RasbperryPi (not shown in drawing above).

On various reboots, we figured that the USB serial devices switched the enumeration of /dev/ttyUSBx for both devices, which confused the Turtlebot Launch files. To avoid this to happen, we resorted to using the entries in /dev/serial/by-id/ for all relevant commands. For example to launch the serial bridge for the Arduino Nano:

rosrun rosserial_python serial_node.py /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AH06N8i02-if00-port0

instead of 

rosrun rosserial_python serial_node.py /dev/ttyUSB1

We also needed to change launch files of the Turtlebot 3 repository to the respective filenames. This included the file 'turtlebot3/turtlebot3_bringup/launch/turtlebot3_core.launch', and also the file 'turtlebot3/turtlebot3_bringup/launch/turtlebot3_lidar.launch' as the LIDAR also has a USB-Serial connection. The actual /dev/serial/by-id/ filenames are easy to find out - just unplug every other device except one. After doing this, we were ready to go, and all USB-Serial connections could be found after rebooting.


Discussions