Sei sulla pagina 1di 17

Integration of a Radiation

Sensor with a Mobile Robot


under ROS

By
Leong Yik Mun

10 June 2015
Integration of a Radiation Sensor with a Mobile Robot under ROS

Author:

Leong Yik Mun


Cornelienstr. 10
63739 Aschaffenburg

Supervisor:

Prof. Dr.-Ing. Kai Borgeest

Hochschule Aschaffenburg
Fakultät Ingenieurwissenschaften
Würzburger Straße 45
D-63743 Aschaffenburg

Leong Yik Mun I


Integration of a Radiation Sensor with a Mobile Robot under ROS

Declaration of Authorship

I solemnly certify that this thesis has been written by me only without any help
other than stated. Any use of external sources are acknowledged and credited in
this thesis.

…………………………………… ……………………………………
Date Signature

Leong Yik Mun II


Integration of a Radiation Sensor with a Mobile Robot under ROS

Contents
1 Introduction ........................................................................................................ 1
2 Requirements Specifications.............................................................................. 2
2.1 System Interface .......................................................................................... 2
2.2 Hardware Interface ..................................................................................... 3
3 Software Design ................................................................................................. 5
4 Implementation .................................................................................................. 8
5 Verification ....................................................................................................... 11
6 Conclusion ........................................................................................................ 12
7 References ......................................................................................................... 13

Leong Yik Mun III


Integration of a Radiation Sensor with a Mobile Robot under ROS

1 Introduction
The EtaBot is a mobile robot which has been developed in a project by the
research team, ETARA. It has been designed to conduct search and rescue
operations autonomously. One of the abilities planned for the EtaBot is that it
should be capable of detecting radiation sources. Therefore, a radiation sensor
has to be integrated with the mobile robot. The radiation sensor has to
constantly provide the measure of radiation in a certain location to the robot for
it to move accordingly in order to find the radioactive source.
However, dealing with radiation sources can be potentially hazardous.
Hence, the EtaBot will first be installed with a light sensor and deal with light
sources. It is assumed that the search algorithm used to seek light sources can
later be applied to that of the radiation sources.

Figure 1: EtaBot

Leong Yik Mun 1


Integration of a Radiation Sensor with a Mobile Robot under ROS

2 Requirements Specifications
2.1 System Interface

The EtaBot’s movements are mainly carried out by an industrial computer


which is running under Ubuntu. ROS (Robot Operating System) operates on the
Ubuntu and is in charge of the robotic controls of the EtaBot. ROS functions by
having a master and multiple slaves. The slaves are known as nodes and in most
cases, each node represents a single task for the robot to perform.
Thus, for this assignment one node is to be programmed to handle the
reading of radiation/light and the values should be published as a ROS topic.
This node is known as a publisher node. The ROS topic is a form of message
which can then be read and interpreted by another node called a subscriber node
to perform the search algorithm. In order to simplify the further development of
this feature, a simple subscriber node is also to be programmed.

Figure 2: System Interface

Leong Yik Mun 2


Integration of a Radiation Sensor with a Mobile Robot under ROS

2.2 Hardware Interface

There are two devices to be implemented with the EtaBot. The first one is the
gamma scout which is illustrated on Figure 3.

Figure 3: Gamma Scout

The gamma scout is a radiation detector and can be used to determine radiation
sources in an area. The device has a USB port which can be connected directly to
the computer. The communication between the gamma scout and the computer
behaves like a serial connection.
Data sent and received by the gamma scout has to be in the form of 7-E-1 which
means, 7 bits, even parity bit, 1 stop bit. Therefore, every character sent or
received by the gamma scout has 8 bits, whereby the most significant bit (MSB)
is the parity bit. The parity bit is 0 when the number of 1 bit from the 0th bit till
the 6th bit is even.
The gamma scout has to receive the character “O” before it starts sending its
read value. Since the value is only valid until the 6th bit, the MSB or the parity
bit has to be inserted manually. The values of “O” in different number bases are
shown in the table below.

ASCII HEX BIN


O CF 11001111

Once the gamma scout receives the “O”, it begins sending the values read. The
data sent contains the time interval and the radiation count. The node should
extract only the radiation count and publish this value to the topic.

Leong Yik Mun 3


Integration of a Radiation Sensor with a Mobile Robot under ROS

The second device is a test circuit for the light follower.

Figure 4: Light Follower Test Circuit

The light follower is designed to imitate the gamma scout. Therefore the
connection between the light follower and computer is the same as the gamma
scout. It connects to the computer via USB and communicates like a serial port.
Instead of detecting radiation, the light follower has a photodiode which is
connected to an analogue digital converter. The measure of light is read and sent
through the USB connection.
The light follower sends and receives data in the form of 8-N-1 which resembles,
8 bit, no parity bit, 1 stop bit. It must also receive the character “O” before it
starts sending the read value. The value that has to be sent to the light follower
is displayed in different number bases below.

ASCII HEX BIN


O 4F 01001111

Since the light follower can be programmed, it is programmed so that it only


sends the required data for the detection of light sources. Unlike the gamma
scout which sends the time interval along with the read value, the light follower
only send the read value.

Leong Yik Mun 4


Integration of a Radiation Sensor with a Mobile Robot under ROS

3 Software Design
The software design of the publisher node is explained using flow charts.

Figure 5: Detecting Device


When the node is started, the device connected to the specific USB port has to be
determined. The node will firstly try to open the port. If successful, it will send
the start command “O” in the form of 8-N-1. If data is received on the node, it
checks if the data matches the one from gamma scout or the light follower and
sets the device accordingly. Although the gamma scout should not send any data
when it receives “O” in 8-N-1, it is possible that it is still online and sending data
from the previous session.
If no data is received on the node’s end after sending “O” in 8-N-1, it is sent again
in 7-E-1. If there is data being sent by the device, the device is set to be the
gamma scout. In any other cases, the node will shut down.
After the device is determined, the reading process starts.

Leong Yik Mun 5


Integration of a Radiation Sensor with a Mobile Robot under ROS

Figure 6: Reading from Light Follower

The reading process is an endless loop. For the light follower, the read process
starts by reading a line from the buffer.
The line read is handled as a string and the data sent by the light follower has a
null terminator at the start. Therefore, the string pointer is shifted once to the
right to ignore the first null terminator.
After that, the string can be converted to unsigned long int and the value is
published onto the topic.
The endless loop can be interrupted by unplugging the device which would raise
an exception or by pressing ctrl-c on the terminal which the node is running on.

Leong Yik Mun 6


Integration of a Radiation Sensor with a Mobile Robot under ROS

Figure 7: Reading from Gamma Scout


Reading from the gamma scout is also an endless loop. Firstly, a line is read from
the buffer.
Since the data sent by the gamma scout has an even parity bit, the MSB of every
character from the data has to be set to zero, so that it does not affect the values.
The next step is the extraction of the required value from the data which
removes the time interval.
Once the value is obtained, it is converted to unsigned long int and published
onto the topic.
Same as the reading process of the light follower, the loop can be terminated by
pressing ctrl-c on the terminal which the node is running on or by simply
unplugging the device.

Leong Yik Mun 7


Integration of a Radiation Sensor with a Mobile Robot under ROS

4 Implementation
In this section, the implementation of the ROS nodes on the EtaBot are
explained step-by-step. The computer used to implement these nodes must be
running under Ubuntu with ROS Indigo installed.
There should already be a catkin workspace under home. If not, the workspace
can be made and initialized by typing the following commands on the terminal.

$ source /opt/ros/indigo/setup.bash
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace

Next, the source files that has been done in this assignment are copied to the
workspace. The exact path where the files are copied to is:

~/catkin_ws/src

There are two folders which are copied and they are shown in the image below.

Figure 8: Source Files

After that, the gamma-scout/light follower is plugged in to the USB port on the
EtaBot. For the node to work, the USB device path is determined. This is done
by using the command:

$ dmesg

Leong Yik Mun 8


Integration of a Radiation Sensor with a Mobile Robot under ROS

The device path is displayed as in the diagram below.

Figure 9: Device Path


In order to set up the port for the node to read data from, the following command
is used.

$ gedit ~/catkin_ws/src/gammascout/src/publisher.cpp

On line 35, the “ttyUSB0” is changed to the one obtained from the previous step.

Figure 10: USB Port Settings

Reading from the serial port requires permission. Therefore, a check is carried
out to see if the user has permission by keying in the line:

$ groups ${USER}

The word “Dialout” has to be stated in the output.

Figure 11: Dialout Permission

Leong Yik Mun 9


Integration of a Radiation Sensor with a Mobile Robot under ROS

If it is not stated there, the user is added to the group by running the following
command and the computer is restarted.

$ sudo usermod -a -G dialout ${USER}

The ROS node is finally compiled and installed using these commands one line at
a time:

$ source /opt/ros/indigo/setup.bash
$ cd ~/catkin_ws
$ catkin_make
$ cd devel
$ source setup.bash
$ cd ~/catkin_ws
$ catkin_make install

The nodes are then ready to be started after the installation. Before they are
executed, the ROS Core has to be started with the command below.

$ roscore

Using another tab on the terminal, the publisher node is started by keying in the
following line.

$ rosrun gammascout gammascout_node

Finally, the subscriber node is started with a separate terminal.

$ rosrun gammascoutreader gammascoutreader_node

Leong Yik Mun 10


Integration of a Radiation Sensor with a Mobile Robot under ROS

5 Verification
The nodes are tested for both of the devices on the EtaBot.

Figure 12: Light Follower Test


On the light follower test, the device is detected as it is supposed to be and the
values received are verified to be correct.

Figure 13: Gamma Scout Test


The gamma scout is also tested and the node correctly identifies it. The values
received from the gamma scout are also confirmed to be right.

Figure 14: Subscriber Node Test


The subscriber is also tested and it displays the value published on the topic
correctly.

Leong Yik Mun 11


Integration of a Radiation Sensor with a Mobile Robot under ROS

6 Conclusion
The integration of the radiation sensor and the light sensor is considered to
be successful, since both of the devices could be read by the node programmed in
this assignment. The data received by the node is also correctly interpreted and
published to the ROS topic. Any other further development can easily be
continued from here on because the value published on the ROS topic can be
obtained by any other nodes.
There is however one bug which was discovered but can easily be solved.
When reading from the light follower, the device should be unplugged when the
node is stopped. If it is left plugged in, when the node is started, the device will
be detected as the gamma scout. This is because the light follower continues to
send data to the buffer even without the node running.

Leong Yik Mun 12


Integration of a Radiation Sensor with a Mobile Robot under ROS

7 References
http://wiki.ros.org/
http://www.gamma-scout.it/images/immagini_struttura/gamma-scout-online.jpg

Leong Yik Mun 13

Potrebbero piacerti anche