On E-Puck Mobile Robots for Distributed Robotics Submitted by Mohamed Isa Bin Mohamed Nasser Department of Electrical & Computer Engineering In partial fulfillment of the requirements for the Degree of Bachelor of Engineering National University of Singapore
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
On E-Puck Mobile Robots for Distributed Robotics
Submitted by
Mohamed Isa Bin Mohamed Nasser
Department of Electrical & Computer Engineering
In partial fulfillment of the
requirements for the Degree of
Bachelor of Engineering
National University of Singapore
i
ABSTRACT
This project provides tools to enable the E-Puck to be used for distributed
robotic experiments. The capabilities of the E-Puck robot for distributed robotics in
terms of communication, motion planning and localization has limitations.
For motion planning, tools to implement grid based motion paths have been
created. This includes software for path planning and synchronization codes. A
demonstration of a sample path is presented. For the limitations in communication
and localization, a second robot is developed to provide pose information and a
communication channel. The development of vision based localization is incomplete
and left for future work.
ii
ACKNOWLEDGEMENTS
I am thankful to the patience, understanding and flexibility of my Supervisor Dr.
Hai Lin throughout this project.
I would also like to thank my Graduate Assistant, Mr. Mohammad Karimadini who
has, throughout this project, given much encouragement, constructive inputs and
technical help.
iii
TABLE OF CONTENTS
ABSTRACT........................................................................................................................ I
ACKNOWLEDGEMENTS.................................................................................................... II
TABLE OF CONTENTS ...................................................................................................... III
LIST OF FIGURES............................................................................................................. III
Referring to table 3.1 for this section, the start delimiter is always 0x02. It marks
the start of the packet. There are three types of packet, namely request (REQ),
confirm (CFM), indication (IND), response (RES). Most operations are made up
of sequential sending and receiving of different packet types. For example, to
establish an SPP connection, a request type followed by a confirm type packet is
required. These sequences are found on page 102 onwards o in the software user
guide (SWUG).
The opcode is a commands identifier. It is therefore unique for each command and
the list of available commands can be found on page 100 of the SWUG.
11
The checksum is a Block Check Character (BCC) checksum of the packet type,
opcode and data length.
Byte 7 onwards is called the “packet data” area and it holds command specific
values that is stated in the corresponding command in the list on page 102
onwards of the SWUG. Finally an end delimiter marks the end of the packet.
There are many commands that are listed for the Bluetooth module. However, for
normal use, there are a few important commands that are more important than the
rest. These commands are those related to the actual sending and receiving of
packet, as well as the establishing of connection. From the experience of
implementing these commands, certain problems and workarounds that are not
explicitly defined in the guide have been encountered. Therefore, the proceeding
section will discuss these functions as well as code fragments of the actual
implementation.
3.2 Basic communication in the E-Puck
Basic communication here refers to communication that does not have any energy
saving or security requirements that is not already set in the factory settings.
As mentioned earlier, the Bluetooth module runs on 2 operating modes, namely
the transparent mode and the command mode.
3.2.1 Overview of Operation in Transparent Mode
The Figure 3.1 illustrates a high level view of the operation in transparent mode.
Both the E-Pucks involved must be set to transparent mode. It follows by either of
12
the E-Pucks initiating a establishing a connection command sequence after which
both E-Pucks has equal ability to transmit data.
Figure 3.1 : Overview of transparent mode
3.2.2 Setting to transparent mode
The Bluetooth module has an EEPROM memory to store its configuration even
after the E-Puck has been switched off. If the state of the configurations is not
known at any point of time, a quick way to ensure that the right configurations are
being used for the operation is by using a factory reset command. This command
is then followed by the setting of the required configuration parameters.
In the case of transparent mode, the required configuration after the factory reset
is the setting of the device name and PIN, followed by the setting of operation
mode to transparent mode. This sequence of configuration is shown in Figure 3.2.
13
Figure 3.2 : Initializing to Transparent Mode
Now we will proceed to the actual low level command to achieve this flowchart.
3.2.2.1 Factory Reset
The factory reset involves a request followed by a confirm.
Packet Transmissions
Table 3.2 : Restore Factory Settings
As the starting example, some parameters here shall be clarified. From Table 3.2,
under the “Opcode” row, “RESTORE_FACTORY_SETTINGS” is provided
instead of the hexadecimal number required for programmatic implementation.
This phrase is actually referring to the name of the opcode from the list of
opcodes on page 98 of the SWUG. In the same way ERROR_OK and
14
ERROR_INVALID_NO_OF_PARAMETERS refers to error codes on page 180
of the SWUG.
Since the second packet is a confirmation type packet, these error codes refer to
the possible data that can be in the corresponding byte. ERROR_OK refers to a
successful operation and takes a value 0x00. To clarify this operation, Figure 3.3
shows the actual request packet that are being sent, and the important parts of the
received packet.
Figure 3.3 : Actual Packet for Factory Reset
The confirm packet is as discussed. Notice that for the received packet, the
important portion is the error code. Also the datalength and end delimiter can be
used to check that the full packet has been received.
15
The rest of the codes for initializing the E-Puck are done in a similar manner by
referring to the SWUG for the format. To make this report concise, the subsequent
functions will have its importance described, followed by a table with the sending
and receiving packets needed that can be implemented in the same manner as the
factory reset example. The full codes used to achieve all the commands for a
normal connection has been included in the appendix.
3.2.2.2 Set Device Name
Device name is the name of the E-Puck used when it is being discovered. By
convention, the E-Pucks are named as “epuck_<ID>” where ID refers to the
corresponding ID physically labelled on the E-Puck. Setting the device name is
important so that the E-Pucks can differentiate themselves in the network.
Packet Transmissions
To set the device name, the packet transmission in Table 3.3 has to be followed.
Send request:
Receive confirm:
Table 3.3 : Write Local Name
16
3.2.2.3 Set device PIN
The Bluetooth device is connected to each other through a process called pairing.
This involves the discovery of the Bluetooth device followed by the entering of a
PIN. This PIN acts as a security mechanism to protect the device from
unauthorized access. By convention, the E-Puck’s PIN is its ID. Setting this after
factory reset is useful to ensure the right device is being connected to.
Packet Transmission
To set the device PIN, the packet transmission in Table 3.4 has to be followed.
Send Request:
Receive Confirm:
Table 3.4 : Write Device PIN
3.2.2.4 Set Transparent Mode
In order to operate in transparent mode, this configuration has to be set on both E-
Pucks involved in the communication.
Packet Transmission
To set to Transparent Mode, the packet transmission in Table 3.5 has to be
followed.
Send Request:
17
Receive Confirm:
Table 3.5 : Set to Transparent Mode
3.2.3 Establish connection
Since Bluetooth uses frequency hopping to provide a connection between two
devices, the mechanism for establishing of connection is relatively complex.
Figure 3.4 : Flowchart for Establishing Connection
From Figure 3.4, it shown that E-Puck 1 is connecting to E-Puck 2. After
configuring its settings, E-Puck 2 has to simply wait for a connection from E-Puck
1. There are three steps in order to establish a connection in the transparent mode.
Firstly, the inquiry step is the “finding” step where Bluetooth devices within the
18
network range is inquired and their details being saved in the E-Puck. This list of
Bluetooth devices then have to be parsed in the second step and only the E-Puck 2
have to be selected. Lastly, with the right E-Pucks known, we can then make a
connection. This process is shown in the Figure 3.4.
3.2.3.1 Inquiry
The inquiry command has three steps; a request followed by a confirm and then
the indicator packets which gives the information of the actual devices found.
Packet transmission
Send Request:
Receive Confirm:
Receive Indicator:
Table 3.6 : Inquiry Packets
19
3.2.3.2 Issues with the Inquiry
One issue with the inquiry process is that sometimes devices within range are not
found. This problem can solved by checking if a particular device has been found
and running the inquiry again if it has not. However, in scenarios where the
targeted devices within range are not known exactly, this error must be taken into
consideration.
Alternatively multiple runs of the inquiry command can be made and any new
devices found will be saved. Since this process is time consuming and the
discussion involves connection between known E-Pucks, this approach is not
covered. Instead a check for the targeted E-Puck will be done. This will be
covered in the selection section.
3.2.3.3 Selection of Devices
Among the ways to identify a Bluetooth device using information from the
inquiry scan, using the friendly device name has been chosen. Friendly device
name refers to the same device name covered in the preceding configuration
section. One requirement for selection through this process is that the devices of
interest must be named uniquely. Since the E-Pucks are named uniquely, this
requirement is met.
The first step is to parse the list of devices for E-Puck types. This will be a useful
process since the list of E-Pucks can be used to either find a particular E-Puck, or
updated when new runs of the inquiry is made. Updating all the non E-Puck
devices found is computationally wasteful since they are not of interest.
20
Figure 3.5 : Flowchart for Establishing Connection
The packet transmission that is involved to acquire the device friendly name is
covered next.
Packet Transmission
Send Request:
Receive Confirm:
21
Table 3.7 : Get device friendly Name
Firstly, an inquiry is made as shown in the code fragments 3.1.
int device_find=e_bt_inquiry(e_bt_present_device);
Code Fragment 3.1: Inquiry
Where device_find is the number of Bluetooth devices found and
e_bt_present_device is an array of a structure in the library called BtDevice. The
exact specification of this structure is less important in this discussion; only the
required components will be discussed. This method now populates
e_bt_present_device with information of the devices found.
Next, the array of devices e_bt_present_device is used to get the friendly names of
all the devices found as shown in Code Fragment 3.2. This is of course using the
command discussed on the previous section.
For (i=0;i<device_find;i++) { e_bt_get_friendly_name(&e_bt_present_device[i]); } Code Fragment 3.2: Get friendly names of Devices
Where device_find is the same variable from the inquiry process holding the
number of devices found though the inquiry. e_bt_get_friendly_name is the command
to acquire the friendly name of the Bluetooth device pointed to be the array
_bt_present_device[i].
It will assigned the friendly_name char array inside the BtDevice structure with a
character array of the device’s name. This array can therefore be checked if it
starts with the characters ‘e’, ‘-‘, ‘p’ , ‘u’, ‘c’, ‘k’ . In most cases the first three
22
letter is sufficient. This condition is met using the a conditional statement shown
in Code Fragment 3.3.
if((e_bt_present_device[i].friendly_name[0]=='e')& (e_bt_present_device[i].friendly_name[1]=='-')& (e_bt_present_device[i].friendly_name[2]=='p')) { // It is an E-Puck. Store the device information } Code Fragment 3.3: Select E-Pucks From List
Where i is referring to the counting variable in the For loop. When this condition
is met, it means that the device is indeed an E-Puck and the next step is to store
the device information. This step is trivial and will not be covered. The codes are
in the appendix.
3.2.3.4 Establish SPP Link
Now that the information (in the form of the BtDevice structure) of the device that
is being connected to is known, the next step is to use the command to establish
Serial Port Profile (SPP) link. This command does the actual connection to the E-
Puck itself.
The term Serial Port Profile is used because it emulates a serial connection
between the connected devices.
Packet Transmission
Send Request:
23
Receive Confirm:
Table 3.8 : Establish SPP Link
3.2.3.5 Issues with SPP Link
Similar to the problem in the inquiry command, this command often receives an
error from the confirmation. This occurs when the E-Puck referred to by the
BtDevice structure can not be found for a particular connection attempt.
A way to handle this is to keep sending the request packet until the confirmation
has no errors (ERROR_OK).
Figure 3.6 : Flowchart for Forcing SPP Link Connection
24
Code snippets for forcing establish SPP link command
The Code Fragment 3.4 shows the sending of the request packet followed by the
receiving of the confirm packet.
do{ e_send_uart1_char(send,15); // send the request packet i=0; c=0; do{ i=0; if (e_getchar_uart1(&read[i])) // read the confirm packet { c=read[i]; i++; } } while (((char)c != 0x03)||(i<(read[3]+6))); // while the end of the confirm packet // hasn’t been reached }while(read[6] !=0x00); // keep sending request packet until the // confirm packet has ERROR_OK (0x00) Code Fragment 3.4: Sending of the request packet
Where e_send_uart1_char is the command to send the packet to the Bluetooth
module through the UART. send is a character array of the request array and read
is the character array of the confirm packet.
Notice that the last line of the snippet, “while(read[6]!= 0x00)”. The seventh byte
of the confirm packet refers to the error code. Therefore this code keep sending
the request packet (send) until ERROR_OK is received.
3.2.3.6 Results from forcing establish connection
Initially this command was not successful even once out of a total of 50 tries.
After the addition of this code, it never fails to establish connection. Therefore
this is a crucial code fragment to establish connection.
3.2.4 Sending and Receiving data in Transparent Mode
25
The transparent mode emulates using a cable link between to devices. Pushing a
packet into the Tx of the UART will automatically be sent to the Rx of the
corrresponding linked UART. In this sense, the transmission in this mode is
simple.
Code snippets for data transmission in transparent mode
Sending
void e_send_uart1_char(char *send, unsigned int datalength );
Code Fragment 3.5: Send data in Transparent Mode
Where send is a character array and datalength is its length.
This method in Code Fragment 3.5 will push the data in the send array into the Tx
of the UART.
Receiving
bool e_getchar_uart1(char *read)
Code Fragment 3.6: Receive data in Transparent Mode
The method in Code Fragment 3.6 receives 1 byte of the data in the Rx channel of
the UART. It return true when a data is received and zero if there is no data to be
received. Therefore a loop is required and a check on the end delimiter OR the
datalength information in the packet must be used to separate one received packet
from another in the Rx. Code fragment 3.7 shows this operation.
do { if (e_getchar_uart1(&read[i])) // read the confirm packet { c=read[i]; i++; } } while (((char)c != 0x03)||(i<(read[3]+6))); // check if the packet has ended Code Fragment 3.7: Receive data in Transparent Mode
Here either the end delimiter of value 0x03 OR datalength + header length has
been received will mean the packet end has been met. Header length is always 6
bytes. The data length can be read from the fourth byte of confirm packet.
26
The use of an OR statement instead of an AND statement is to be conservative in
the sense that either of the condition is made sufficient. This is to prevent
deadlocks in the case some packet loss may cause either of the condition not met.
3.3 Overview of Operation in Command Mode
The transparent mode is ideal for single point to point connection. For multipoint
connections, the command mode has to be used. Since most of the methods used
in the transparent mode is also used in the command mode, this section will focus
on the additional methods used for operation in this mode. The following
flowchart shows a high level representation of communication in this mode.
Figure 3.7 : Flowchart of operation in Command Mode
The similarities of the operation under both modes are many. Both modes require
the initializing of EEPROM configuration to their respective modes for all the
27
involved devices. Both require only the Master E-Puck to establish connection
with the rest of the E-Pucks.
The main differences, command-wise, between the modes are that the command
mode has to open up multiple ports for connection with multiple E-Pucks. The
establishing of connection to these E-Pucks requires a free port for each E-Puck.
The sending and receiving of data use the port number corresponding to the
connection to a specific E-Puck specify its destination and to differentiate the
received packets.
3.3.1 Setting to command mode
The procedure to set the E-Puck to command mode is almost identical to that of
setting it to transparent mode.
Figure 3.8 : Initialization for Command Mode
28
The only difference lies in the last block where instead of setting it to transparent
mode, the appropriate command for command mode is used. For completeness,
the packet transmission to achieve this is covered.
Packet Transmission
Send Request:
Here the data in the seventh byte of the packet must be 0x00 for command mode.
Receive Confirm:
Table 3.9 : Write Operation Mode
The seventh byte is checked for ERROR_OK.
3.3.2 Open Ports
In the Bluetooth communication, each SPP link is assigned with a unique port.
These ports acts channels to identify the E-Puck involved in the transmission.
These ports have 2 states; they can either be open or closed. Hence, before
connection can be established, a command to open the required ports must be
executed first.
29
There are 30 available ports in the Bluetooth module. It is assigned using a 32-bit
mask (4 bytes). The 31st and 32nd bit must be ‘0’. The opening of the ports is best
explained with an example.
The 4 bytes of hexadecimal data used to open the ports is shown is
0x00 0x00 0x00 0x07
This is equivalent to 0x00000007. It is represented as elements of a character
array which is 1 byte each.
The binary representations of all the bytes are zeros except for the right-most byte
which is
000001112
These binary digits correspond to a port that ascends from right to left.
Binary digit 0 0 0 0 0 1 1 1
Corresponding Port
Port 8 Port 7 Port 6 Port 5 Port 4 Port 3 Port 2 Port 1
This code, therefore, opens port 1 to port 3 while closing the rest of the ports.
There’s a last twist to be aware of. The 4 bytes must be byte inverted in the
packet. Hence, it must be sent to the UART in the following byte inverted order:
0x07 0x00 0x00 0x00
Packet transmission
Send Request:
30
The “PORTS 4 bytes” is the 32 bit mask described.
Receive Confirm:
Table 3.10 : Opening of Ports
3.3.3 Establish Connection
The difference in the establishing of connection in the command mode compared
to the transparent mode is the number of SPP links to be made and the port
numbers to be specified in the SPP Link.
31
Figure 3.9 : Establishing Connection in Command Mode
In Figure 3.8, the inquiry and selection blocks is identical to the one is transparent
mode. The difference lies in the establishing of SPP link.
Table 3.11 : SPP link for Command Mode
In the request packet shown in table 3.11, there are two port parameters. On the 7th
byte, there is the local port number which defines the port of the master E-Puck
that is used for the connection. On the 14th byte, there is the remote port number
that defines the port of the slave E-Puck.
32
Assuming the slave E-Pucks has only 1 master, the remote port number can
always be set to port 1 or 0x01. Since the Master E-Puck has to connect to
multiple slaves, the local port number has to correspond to those which are set to
“open” earlier. They must also be unique for each E-Puck connection.
The SPP connections, which involves a request and a confirm packet as before,
are done sequentially for every E-Puck to be connected to by the Master E-Puck.
Code fragment 3.8 shows the establishing of multiple SPP links.
e_bt_write_local_pin_number(&e_bt_present_epuck[0].number[0]); error=e_bt_establish_SPP_link(&e_bt_present_epuck[0].address[0], 0x01); e_bt_write_local_pin_number(&e_bt_present_epuck[1].number[0]); error=e_bt_establish_SPP_link(&e_bt_present_epuck[1].address[0], 0x02); Code Fragment 3.8: Establishing multiple SPP link
Where e_bt_present_epuck[i].address[n] is the nth byte of the 4 byte address for
the ith E-Puck of the inquiry list. e_bt_present_epuck[i]. number [n] is the nth byte
of the 4 byte PIN for the ith E-Puck of the inquiry list.
In order to authenticate the PIN for every slave, the Master E-Puck change its own
PIN to that of the slave’s and revert it at the end of the code. The
e_bt_write_local_pin_number method writes the PIN of the slave E-Puck
temporarily to the master E-Puck for the establish SPP link command to occur.
The e_bt_establish_SPP_link method, handles the packet transmissions with using
the 2nd parameter as the port for the connection. It always sets the remote port to
port 1.
3.3.4 Sending and Receiving in the Command Mode
Unlike in the transparent, direct sending linking of the Tx and Rx channels of the
UART between two E-Pucks is not possible due to multiple connections from the
33
Master to the Slave. A packet needs to be constructed with enough information to
distinguish its source, when receiving, or destination, when sending.
3.3.4.1 Sending
In the transparent mode, there is no designated command to send data between E-
Pucks. The command mode requires a command due the reasons mentioned and
this command is SPP_SEND_DATA.
Packet Transmission
Send Request:
Here the payload is the character array to be sent and the payload size is its
corresponding size. Sample code has been included in the appendix to clarify the
syntax of constructing this packet.
Receive Confirm:
Table 3.12 : SPP Send Data
3.3.4.2 Receiving
34
The data received in transparent mode is the actual raw data sent by the sender.
For example when sending the character array {‘t’, ‘e’, ‘s’, ‘t’}, the data in the Tx
of the sender is directly sent to the receiver:
However in command mode, using the SPP_SEND_DATA command, The data is
sent in inverted order byte by byte in the form of packets:
3.4 Issues with Bluetooth communication
In command mode, the data that is received by the slaves, contrary to the manual,
does not contain the delimiters or comes in byte by byte. The data that is received
are the raw data itself just as in transparent mode. Master to multiple Slaves
communication is successful. The master is running an obstacle avoidance code
while the slaves are mirroring its movements.
However a persisting problem is getting the Slaves to send data back to the
master. The master is unable to receive packets from slaves in command mode
using the command SEND_SPP_DATA. This is a major problem since scatternets
cannot be formed and a robust communication network for multi agents
communication.
35
4
Motion Planning of the E-Puck Robot
Motion planning or the navigation problem is the process of translating a task that
involves movement into actual motor commands.
4.1 Dynamic vs Static
Motion planning can be divided into two categories, static and dynamic. Static
motion planning is often computed offline. The term offline computations refers
to computations that are done before the task starts often by a central unit which is
then transferred to the agents involved in the task. Static motion planning does not
take into account changes in the environment after the commencement of the task.
Dynamic motion planning is carried out online during the task itself. It is more
versatile and takes into account changes in the environment. In most cases, robots
used in distributed robotics, including the E-Pucks, have processors with low
clock speeds. This is to keep cost low for the duplication of the robot.
Consequently, dynamic motion planning algorithm often has to be kept simple
and computationally low.
4.2 Kinematics of the E-Puck
The E-Puck is a differential drive robot. Differential drive refers to two wheels
that can be driven independently in both directions, clockwise and anticlockwise.
It is important to study the kinematics of the E-Puck to identify useful models that
36
can be used for motion planning. We first look at physical specifications of the E-
Puck that affects its kinematics.
4.3 Physical Specification
The following are the physical specifications of the E-Puck that affects its
kinematics.
Motor type: Stepper Motor
Motor Speed: 1000 steps / second, 1000 steps / revolution
Wheel Diameter: 41 mm
Wheelbase length: 53 mm
The wheelbase length is defined as the length between two points of contact that
the two wheels make with the ground. This is very close to the length shown in
the following picture:
Figure 4.1 : Wheel Base Length
4.4 Model for Differential Drive
37
Figure 4.2 : Model of Differential Drive
Where l is the wheelbase length, Vl is the left wheel velocity, Vr is the right wheel
velocity, R is the turning radius, ICC is the instantaneous center of curvature, ω is
the angular velocity, Figure 4.2 shows the model for a differential drive trajectory.
The wheel input values are integers from -1000 to 1000 where negative value
steer “backwards”, zero stop the wheel and positive value steers “forward”. This
input value corresponds conveniently to physical value of steps/second. Therefore
to obtain the Vl and Vr value, from the input values, the following can be used:
Vl = Il / 1000 × π × 41
VR = IR / 1000 × π × 41
Where the resulting unit is in millimetre per second. With this, we can proceed to
use the rest of the equations that can be used to model the differential drive
trajectory.
4.5 Forward Kinematics
If the current position and orientation of the robot is known, forward kinematic is
the calculation of the new position and new orientation of the robot after a set of
known inputs is carried out at known time intervals.
38
The above equation relates the turning radius and the angular velocity to the input
wheel velocities.
Where x is the initial horizontal position, y is the vertical position and θ is the
orientation at time t. A set of (x,y, θ) is collectively known as the pose of the
robot. (x’, y’, θ’) is the pose at time (t + δt).
These equations can be used to predict the motion and pose of the E-Puck after an
array of given inputs [12].
4.6 Inverse Kinematics
Inverse kinematics is the process of determining the inputs in order to achieve a
desired pose.
4.6.1 Inverse Kinematics using Curved Trajectories
There are only 20002 combinations of left and right wheel speeds. This can be
reduced by taking steps of 10. With this, solutions for a certain destination points
can be obtained by exhaustively running through these trajectories.
4.6.2 Inverse Kinematics using straight Trajectories
39
A more practical method of dead reckoning is through straight trajectories since it
is less error prone especially from slippage. The formulas for the trajectories can
be derived from simple trigonometry.
T1 = atan2 (y’ – y, x’ – x) rad
T2 = ’ – y – T1 rad
D = ( ( x’ – x ) 2 + ( y’ – y ) 2 )1/2 mm
The process will be is hence a rotation T1 rad to face destination � Translate D
mm to destination � Rotation T2 to achieve orientation of destination pose.
4.7 Kinematics software for the E-Puck
A software has been partially developed for offline path planning. This will be
useful in order to automate the calculations especially for inverse kinematics and
also visually selecting destination points by using an overhead camera. This
section will be dedicated to the current working features of the software and its
pending features that can be further developed by later project groups.
4.7.1 Tracking the E-Pucks
In order to track the E-Pucks, a toolkit for tangible multi-touch surfaces developed
by Reactivision is used. This toolkit uses fudicial markers and tracks them using
an overhead webcam.
40
Figure 4.3 : Overhead Camera Tracking
The E-Pucks that are detected are reflected in the basic program provided as black
boxes as shown in figure 4.3. Since this display is now used for robotics, certain
visuals have been made so that analysis of the movement is enhanced. Error is
represented in red text. Error is the difference between the calculated position
based on the differential drive model and the actual position of the E-Puck. Also,
a green line is drawn to represent the velocity vector of the robots. This is make
assessment of how fast the E-Pucks are moving relative to each other, easier.
4.7.2 Forward Kinematics (software)
Figure 4.4 : Forward Kinematic Controls
The controls used for forward kinematics is rather intuitive. It is shown in Figure
4.4. One will have to use the drop down boxes to set the right wheel speed (RW
41
speed), left wheel speed (LW speed) and time at which the wheels run at the
speed. The trajectory that the E-Puck will travel at will be drawn on the display
area as a green line.
4.7.3 Inverse Kinematics using straight paths (software)
The length of the square is 12 cm and the speed to run this motion is set to 500.
Therefore 12 and 500 is appended to the front of the number sequence. This is
then copied to the MATLAB code that loads the sequences into the E-Pucks and
then acts as a communication channel. The resulting movement is shown in
Figure 6.3 in the same form as Figure 6.1.
Figure 6.3 : Actual Movement by the E-Pucks
The synchronization and movement codes perform very well. The movement code
to move from one square forward is designed to stop after travelling the distance.
1
2
3
64
In frame 2 to 3, E-Puck 3 is making two consecutive “move forward” movements
and there is no observable stoppage. Even from frame 3 to 4 where the same E-
Puck has to synchronize with the rest of the E-Pucks to move synchronously to
the next position, there is no observable delay in the two forward motions
involved. This means that the latency of the synchronization process as well as the
transmissions in the communication channel is negligible relative to the robot’s
motor response.
6.3 Results of the Laptop Robot’s Vision
The requirement of the laptop robot is the ability to localize itself. The approach
to tackle is this is a vision-based localization using landmarks. It must also be able
to tell its relative distance and bearing from the E-Pucks in order to send the E-
Pucks its global pose.
6.3.1 Stereo Vision
Experiments in stereo vision are conducted for matching, sparse to disparity map
estimation for object avoidance, object recognition and triangulation. These
experiments are geared to achieving global localization by landmark ultimately.
6.3.1.1 Matching
The correspondence problem is approached by first using the famous Scale
Invariant Features Transform (SIFT) and matching SIFT features between two
images. This has been described in chapter 6. The results for the matching using
SIFT is shown in Figure
65
Figure 6.4 : Matching using SIFT descriptors
The left image shows the left camera image with the corresponding SIFT
keypoints marked in blue. The right image shows the right camera image with the
matched keypoints between the both images connected by a blue line.
It is clear that many of the keypoints are matched wrongly. The obvious ones are
long lines that cannot be true due to the relative small distance of the two cameras
and zig zag lines that cannot be true since the image has no large distortions.
The multi scale feature matching algorithm that uses the Fischer Information to
identify matches is then used. The results are as follows:
Figure 6.5 : Matching using Multi Scale algorithm
66
Clearly more features are matched. 1887 keypoints are matched for this case of a
640x380 image. This is compared to only 131 matches using comparisons of SIFT
identifiers. The more points there are, the denser the disparity map and
consequently the weighting of image segments used to achieve a dense map will
be more accurate.
The matching is visibly accurate. Since the image is not rectified, the epipolar
lines are not aligned between the images. However it is clear that most of the
points are matched correctly by the manner that the blue lines connecting matched
features are parallel to each other for each portion of the map. The directions of
these lines are dependent on mainly the extrinsic parameters of the stereo cameras.
In this case, the cameras are not well aligned.
6.3.1.2 Disparity Map
The sparse disparity map is proportional to the radial distances of the
corresponding objects to the camera [5]. This factor can be computed as a
function of its focal length and scaling factors from pixel to focal plane. However
in this experiment, this factor is computed experimentally by measuring actual
object distances to the camera and its corresponding disparity value. The result is
a scale factor of 2100 for measurements in the units of centimetres.
After matching, a sparse disparity map is obtained. A sparse disparity map refers
to a map that does not cover almost every pixel in the image. Mean shift
segmentation is used to segment the image based on its grayscale pixel values.
These segments are weighted by the disparity map to form a dense map.
67
The dense disparity map for the SIFT matches is show in Figure 6.5.
X: 241 Y: 312
Index: NaN
RGB: 0.5, 0, 0
X: 147 Y: 184
Index: NaN
RGB: 0.5, 0, 0
100 200 300 400 500 600
50
100
150
200
250
300
350
400
450
Figure 6.5 : Dense Disparity Map using SIFT matches
Due to the low number of matches, most of the segments are not weighted. The
NaN value refers to pixels that have not been weighted. Even with enough
matches, the disparity map will clearly be inaccurate due to the visible
mismatches earlier.
68
Figure 6.6 shows the dense disparity map using the multi scale method.
X: 225 Y: 72
Index: 56.7
RGB: 0, 0, 0.625 X: 386 Y: 136
Index: 350
RGB: 0, 0.813, 1
X: 92 Y: 222
Index: 110.5
RGB: 0, 0, 0.875
X: 364 Y: 348
Index: 35.59
RGB: 0, 0, 0.563
100 200 300 400 500 600
50
100
150
200
250
300
350
400
450
Figure 6.7 : Dense disparity map using multiscale matching
X: 364 Y: 348
RGB: 232, 250, 225
X: 386 Y: 136
RGB: 9, 12, 0
X: 92 Y: 222
RGB: 225, 182, 25
X: 225 Y: 72
RGB: 237, 255, 250
Figure 6.8 : Objects selected from corresponding Scene
The lighter blue regions are regions that are further way while the darker blue
regions are those that are nearer. 4 objects are selected which can be seen with the
69
corresponding image of the scene in Figure 6.7. A can, curtain, drum shell and fan
(in grey) have been selected and the distance to the corresponding points are
measured using a tape measure manually.
The result is tabulated in the following table:
Manual measurement
(cm)
From Disparity Map (cm)
Can 35 35.6
Curtain 200 350.0
Drum shell 149 110.5
Fan 79 56.7
Table 6.2 : Comparison between Disparity Map Value with Manual Measurements
The results are not too far from the manual measurement. This segmentation
method cannot be used for localization however it can be used for obstacle
avoidance where a fuller map is required.
6.3.1.3 Object Recognition
The main aimed method for localization is through landmarks. In order to carry
out landmark localization, the laptop robot must be able to recognize the
landmarks. One way to achieve this is to have a database of objects and its
corresponding SIFT features.
Keypoints, divided in segments, are compared to a database of features which are
grouped in the segments that they are originally found. If the keypoints in one of
70
the segments in the current image does not match any from the database, it is
saved into the database.
One problem is the growing database and a growing amount of comparisons
which results from it. Therefore the maintenance of the database should also be
implemented such that objects that are less likely to be prominent should be
deleted. Due to the constraint of time, this maintenance of the database has not
implemented. The focus shall be on object recognition simply using a fixed size
database that is maintained in a first in first out fashion.
objects1.jpg
objects24.jpg
Figure 6.8 : Object Recognition, Left image is taken at an earlier time frame
This method does have some good object matches. However the segmentation
changes for every viewpoint. This causes certain segments that are selected from a
segment already in the database, but a subset of it. Because the features in the
subset are small, that segment is not recognized. In the Figure 6.8, this situation
has occured as the second segment being a subset of the first segment is not
recognized as the same object. The object is saved as object 21 instead of being
recognized as object 1.
One way to solved this is by checking whether the segments around it has been
recognized and if they have been, it implies that the segment has not been
matched well and should not be saved.
71
However this project will not delve into the policy used for matching segments
and the database maintenance. These issues will be left for future work.
6.3.1.5 Camera calibration parameters
The GML Calibration toolbox has been used to calibrate the cameras. There is no
option to find extrinsic parameter for two cameras. The left extrinsic parameters
obtained during the calibration process using a stereo pair is inverted and
multiplied with the right extrinsic parameters. Although both of these parameters
correspond to the same world before this inversion, they are often in a
inconvenient arbitrary axis based on the free position of the camera from the
calibration pattern.
6.3.1.6 Triangulation
Stereo triangulation is the process of transforming the matched points in
perspective space to Cartesian distances in Euclidean space. The stereo
triangulation function included in the MATLAB calibration toolbox has been
used. The matched points from the multi scale feature matching algorithm are
used with the calibration parameters. The results are in millimetres and shown in
Figure 6.9.
72
Figure 6.9 : Stereo Triangulation
The results are bad. The coordinates obtained does not resemble any of the
physical positions of the objects in the scene from solely the scale. Due to this
result, stereo SLAM cannot be achieved at this stage. An algorithm that finds the
transformation of points in Euclidean Space between two frames can be used to
update the pose of the robot once this issue has been resolved.
-500-400
-300
-500
0
500-500
0
500
73
7
Conclusion
This project has provided significant tools and hardware to solve the limitation of
the E-Puck robots in communication, motion planning and localization.
The step by step guide to achieving Bluetooth communication using the E-Puck
had been important. Crucial tweaks to the sending of commands in order to
achieve both multipoint and single point connection had been discovered. These
commands are not reflected in the Software User Guide of the Bluetooth module.
In motion planning the synchronization method to coordinate the grid based
movement is shown to be fast and robust. This implies the communication
channel is functional and fast. More importantly, it solves the issue of the poor
transmission quality in multipoint connection through Bluetooth which was
demonstrated in the mirroring algorithm.
For localization, significant progress has been made in the realization of a SLAM
algorithm in order to provide the E-Pucks with positional information. A method
to convert a sparse disparity into a dense one has shown decent results which can
be used for obstacle avoidance.
7.1 Future Work
Future work primarily focuses on the vision based localization techniques.
74
The laptop robot must also be able to calculate the relative pose of the E-Puck
from itself. One solution is using the Augmented Reality Toolkit (ARtookit). It
uses fudicial markers and the transformation matrix that maps the camera axis to
the marker’s position is obtained. These fudicial markers can directly obtain the
relative pose by using the translation matrix as the position and the Euler angles of
the rotational matrix as orientation.
75
REFERENCE
[1] Mondada, F., Bonani, M., Raemy, X., Pugh, J., Cianci, C., Klaptocz, A., Magnenat, S., Zufferey, J.-C., Floreano, D. and Martinoli, A. (2009) The e-puck, a Robot Designed for Education in Engineering. Proceedings of the 9th Conference on Autonomous Robot Systems and Competitions, 1(1) pp. 59-65.
[2] LMX9820/LMX9820A Bluetooth Serial Port Module - Software Users Guide, National Semiconductor, October 2006, Revision 1.6.4
[3] Sharkey, A. J. 2007. “Swarm robotics and minimalism” Connect. Sci 19, 3 (Sep. 2007), 245-260
[4] Jean-Marc Valin and François Michaud and Jean Rouat and Dominic Létourneau, “Robust Sound Source Localization Using a Microphone Array on a Mobile Robot”, Proceedings International Conference on Intelligent Robots and Systems (2003)
[5] David G. Lowe, "Distinctive image features from scale-invariant keypoints," International Journal of Computer Vision, 60, 2 (2004), pp. 91-110.
[6] Zhijun Pei, Ping Zhang, Shoumei Sun, Jinqing Gu, "Fisher Information Analysis for Matching Feature Extraction," itcs, vol. 1, pp.425-428, 2009 International Conference on Information Technology and Computer Science, 2009
[7] Gutiérrez, Á., Campo, A., Dorigo, M., Donate, J., Monasterio-Huelin, F., and Magdalena, L. 2009. Open E-puck range & bearing miniaturized board for local communication in swarm robotics. In Proceedings of the 2009 IEEE international Conference on Robotics and Automation (Kobe, Japan, May 12 - 17, 2009). IEEE Press, Piscataway, NJ, 1745-1750.
[8] Xiaolei Hou, Changbin Yu, “On the implementation of a robotic SWARM testbed”, Autonomous Robots and Agents, 2009. ICARA 2009. 4th International , pp. 27 – 32
[9] Narongdech Keeratipranon, Joaquin Sitte,”Beginners Guide to Khepera Robot Soccer”, Queensland University of Technology, 2003
[10] A.K.M. Mahtab Hossain and Wee-Seng Soh, “A Comprehensive Study Of Bluetooth Signal Parameters for Localization”, 18th Annual IEEE International Symposium on Personal, Indoor and Mobile Radio Communications (PIMRC’07)
[11] Wang, Z., Thomas, R. J., and Haas, Z. J. 2009. Performance comparison of Bluetooth scatternet formation protocols for multi-hop networks. Wirel. Netw. 15, 2 (Feb. 2009), 209-226
[12] Dudek and Jenkin, Computational Principles of Mobile Robotics. [13] V.Vezhnevets, A.Velizhev "GML C++ Camera Calibration Toolbox",
This code is mainly BTcom.c from the E-Puck code library with appended codes for Synchronization. /********************************************************************************
The reference programm to control the e-puck with the PC
Version 2.0
Michael Bonani
This file is part of the e-puck library license.
See http://www.e-puck.org/index.php?option=com_content&task=view&id=18&Itemid=45
(c) 2004-2007 Michael Bonani
Robotics system laboratory http://lsro.epfl.ch
Laboratory of intelligent systems http://lis.epfl.ch
Swarm intelligent systems group http://swis.epfl.ch
EPFL Ecole polytechnique federale de Lausanne http://www.epfl.ch