Elisa-3 and Overo Extension: Difference between pages

From GCtronic wiki
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
=Overview=
This is a mini how-to of the e-puck extension board for the Gumstix Overo COM.
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3_and_charger.JPG <img width=350 src="http://www.gctronic.com/doc/images/Elisa3_and_charger.JPG">]</span> <br/>
Elisa-3 is an evolution of the [http://www.gctronic.com/doc/index.php/Elisa Elisa] robot based on a different microcontroller and including a comprehensive set of sensors:
* [http://www.atmel.com/dyn/products/product_card.asp?part_id=3632 Atmel 2560] microcontroller (Arduino compatible)
* central RGB led
* 8 green leds around the robot
* IRs emitters
* 8 IR proximity sensors ([http://www.vishay.com/docs/83752/tcrt1000.pdf Vishay Semiconductors Reflective Optical Sensor])
* 4 ground sensors ([http://www.fairchildsemi.com/ds/QR/QRE1113.pdf Fairchild Semiconductor Minature Reflective Object Sensor])
* 3-axis accelerometer ([http://www.freescale.com/files/sensors/doc/data_sheet/MMA7455L.pdf Freescale MMA7455L])
* RF radio for communication ([http://www.nordicsemi.com/kor/Products/2.4GHz-RF/nRF24L01P Nordic Semiconductor nRF24L01+])
* micro USB connector for programming, debugging and charging
* IR receiver
* 2 DC motors
* top light diffuser
* selector
The robot is able to self charge using the charger station, as shown in the previous figure. The following figure illustrates the position of the various sensors: <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3-mainComp-digital-white.png <img width=400 src="http://www.gctronic.com/doc/images/Elisa3-mainComp-digital-white.png">]</span>


==Useful information==
=Minimal getting started=
* the top light diffuser and robot are designed to lock together, but the diffuser isn't fixed and can thus be removed as desired; the top light diffuser, as the name suggests, helps the light coming from the RGB led to be smoothly spread out, moreover the strip attached around the diffuser let the robot be better detected from others robots. Once the top light diffuser is removed, pay attention not to look at the RGB led directly. In order to remove the top light diffuser simply pull up it, then to place it back on top of the robot remember to align the 3 holes in the diffuser with the 3 IRs emitters and push down carefully untill the diffuser is stable; pay attention to not apply too much force on the IRs emitters otherwise they can bend and stop working.
{| style="color:black; background-color:#ffffcc;" cellspacing="0" border="1"
<span class="plainlinks">[http://www.gctronic.com/doc/images/Diffuser-pull-up.jpg <img width=200 src="http://www.gctronic.com/doc/images/Diffuser-pull-up.jpg">]</span>
|
<span class="plainlinks">[http://www.gctronic.com/doc/images/Diffuser-push-down.jpg <img width=200 src="http://www.gctronic.com/doc/images/Diffuser-push-down.jpg">]</span><br/>
# upload the [http://www.gctronic.com/doc/index.php/E-Puck#Standard_firmware standard firmware] to the e-puck robot and put selector in position 10
* when the top light diffuser is fit on top of the robot, then in order to change the selector position you can use the tweezers; the selector is located near the front-left IR emitter, as shown in the following figure:
# connect the USB cable: mini-USB to the extension module and the other side to the PC
<span class="plainlinks">[http://www.gctronic.com/doc/images/selector-tweezers.jpg <img width=200 src="http://www.gctronic.com/doc/images/selector-tweezers.jpg">]</span>
# execute a terminal program (e.g. minicom) and configure the connection with 115200-8N1. The serial device path should be typically something like "/dev/ttyUSB0". Make sure that the flow control parameter of minicom called "Hardware" is set to "No".
* if you encounter problems with the radio communication (e.g. lot of packet loss) then you can try moving the antenna that is a wire near the robot label. Place the antenna as high as possible, near the plastic top light diffuser; try placing it in the borders in order to avoid seeing a black line on the top light diffuser when the RGB led is turned on.
# switch on the robot; now the terminal should display the Gumstix Overo booting information (booting time 25-30 seconds)
<span class="plainlinks">[http://www.gctronic.com/doc/images/Antenna-position.jpg <img width=200 src="http://www.gctronic.com/doc/images/Antenna-position.jpg">]</span>
# login with user=root, password=root
<span class="plainlinks">[http://www.gctronic.com/doc/images/Antenna-diffuser.jpg <img width=200 src="http://www.gctronic.com/doc/images/Antenna-diffuser.jpg">]</span>
|}
 
<font style="color:red"> Anyway you're encouraged to read all the documentation since you'll find more detailed explanations. </font>
 
=Introduction=
<span class="plainlinks">[http://www.gctronic.com/doc/images/Ext+robot1.jpg <img width=200 src="http://www.gctronic.com/doc/images/Ext+robot1.jpg">]</span> <br/>
This introductory section explains the minimal procedures needed to work with the Gumstix Overo computer-on-module (COM) mounted on the e-puck extension board and gives a general overview of the available demos and scripts shipped with the micro sd. You can also refer to [http://projects.gctronic.com/Gumstix/extension-instructions.pdf extension-instructions] that is a document containing the most important information in order to start working with the extension. The extension is mostly an interface between the e-puck robot and the Gumstix Overo COM.
 
Gumstix Overo COM: [http://www.gumstix.com product information] and [http://www.gumstix.org programming information],
 
==Full package==
The full package content is:
* e-puck extension with Gumstix Overo COM and micro sd card already inserted
* USB adapter for the micro sd
* A to mini-B USB cable
* USB wifi dongle
* external power adapter
* USB host adapter
The standard COM mounted on the e-puck extension is the Gumstix Overo EarthSTORM COM. Some extensions were delivered with the Gumstix Overo SandSTORM COM, don't worry, the main difference between the two COMs is that the SandSTORM has no flash memory, but the flash isn't necessary since the system is booted from the micro sd.
 
==Requirements==
In order to connect to the extension through the mini USB the FTDI driver need to be installed. If a serial port is automatically created when connecting the robot to the computer you're done otherwise visit the following site and download the drivers for your architecture (32 or 64 bits) [http://www.ftdichip.com/Drivers/VCP.htm FTDI drivers].
 
==General procedure==
The e-puck extension board for the Gumstix Overo COM comes with a pre-configured system ready to run without any additional configuration. The whole system is installed on a micro sd and is composed of:
* U-Boot (bootloader customized for the hardware)
<!--* OMAP35x Linux PSP [https://www-a.ti.com/downloads/sds_support/targetcontent/psp/omap35x/index.html https://www-a.ti.com/downloads/sds_support/targetcontent/psp/omap35x/index.html] (linux kernel) -->
* OMAP35x Linux TI-PSP [http://arago-project.org/git/people/?p=sriram/ti-psp-omap.git;a=summary http://arago-project.org/git/people/?p=sriram/ti-psp-omap.git;a=summary] (linux kernel)
* some demos and useful scripts in the /home/root directory
It's important to note that the flash isn't reprogrammed, so it will contain the factory system.
 
In order to access the system from a PC (console mode), the following steps must be performed:
# connect the USB cable: mini-USB to the extension module and the other side to the PC
# execute a terminal program (e.g. minicom) and configure the connection with 115200-8N1. The serial device path should be typically something like "/dev/ttyUSB0". Make sure that the flow control parameter of minicom called "Hardware" is set to "No".
# switch on the robot; now the terminal should display the Gumstix Overo booting information (booting time 25-30 seconds)
# login with user=root, password=root
 
==Wireless setup==
Before proceding with the following configurations be sure that the WiFi dongle is well recognized, refer to section [http://www.gctronic.com/doc/index.php/Overo_Extension#WiFi_dongle WiFi_dongle].
===Wireless configuration using a script===
The script ''setupWifi'' placed under /home/root/scripts is used to configure easily the wireless network (managed mode) and need to be adapted to your specific situation. The script is shown below:
<pre>
#!/bin/bash
ifconfig wlan0 up
iwconfig wlan0 essid SSID key HEX_KEY
iwconfig wlan0 ap MAC_ADDRESS
iwconfig wlan0 rate 54M
ifconfig wlan0 LOCAL_IP netmask SUBNET_MASK
route add default gw GATEWAY_IP
</pre>
To know the available wifi networks and related information such as mac address of the access point, you can issue the command ''iwlist scanning wlan0''.
 
On some platforms, udev may rename the network interface ''wlan0.'' In this event, the 'setupWifi' script will return several errors, some of which will say "No Such Device." To identify your network interfaces, use the commands ''ifconfig'' or ''iwconfig.'' These will provide a listing of your devices, and their current states. Identify the appropriate interface (typically ''wlan#'' where "#" is a number) and replace ''wlan0'' in the above script with this.
 
If you're using dhcp, you can instead adapt the script ''setupWifiDhcp'' found under /home/root/scripts:
<pre>
#!/bin/bash
ifconfig wlan0 up
iwconfig wlan0 essid SSID key HEX_KEY
iwconfig wlan0 ap MAC_ADDRESS
iwconfig wlan0 rate 54M
dhclient wlan0
</pre>
 
The parameters that must be customized are shown in capitals; after that you can execute the script typing ''./setupWifi'' (or ''./setupWifiDhcp'') and after a while a message should be displayed indicating that the wireless is ready. You can test the network configuration using ''ping''.
 
It may be necessary to create a directory if you get the error "can't create /var/lib/dhcp/dhclient.leases: No such file or directory." Use the ''mkdir'' command
 
<pre>
mkdir /var/lib/dhcp
</pre>
 
Usually, when the Wifi dongle is connected to the AP, a message is written in the message buffer of the kernel. The following bash code snippet can be used to make sure that the connection is well established when the program returns:
<pre>
#!/bin/bash
echo Wait until the Wifi is connected to the AP
while true
do
  #the text "link becomes ready" can vary according the Wifi dongle
  a=$(dmesg | grep wlan0 | grep "link becomes ready")
  if [ -n "$a" ]
  then
    echo Wifi enabled!
    exit
  fi
  sleep 1
done
</pre>
 
In order for the ''setupWifi'' or ''setupWifiDhcp'' scripts to be run during boot, copy the appropriate script into the ''init.d'' directory with the other start/stop scripts.
<pre>
cp -i ~/scripts/setupWifi /etc/init.d/setupWifi
</pre>
Then determine which run level the system is using with the command:
<pre>
runlevel
</pre>
This should return "N #" where # is the run level number. Create a link to your script in the ''init.d'' directory within the directory ''/etc/rc#.d'' Name the link ''S##setupWifi.'' The number ## (customarily 2 digits, which you choose) determines where in the startup sequence your script will be run. It is good advice to choose a number just smaller than the largest in the ''rc#.d'' directory, this way the script is not called before lower-level ones. The creation of this link can be done with the following command (where # and ## must be changed to their appropriate values).
<pre>
ln -i -s /etc/init.d/setupWifi /etc/rc#.d/S##setupWifi
</pre>


==Robot charging==
===Wireless configuration using a wpa_supplicant===
The Elisa-3 can be piloted in the charger station in order to be automatically self charged; there is no need to unplug the battery for charing. The following figures shows the robot approaching the charger station; a led indicates that the robot is in charge:
Alternativerly, the Wifi connection can be set up by using both [http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] and the native wifi setup. This has the advantage to be more robust against failure. In order to do that, the Wifi interface can be added to /etc/network/interfaces, this way:
<br/>
<pre>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3-charger-out.jpg <img width=300 src="http://www.gctronic.com/doc/images/Elisa3-charger-out.jpg">]</span>
auto wlan0
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3-charger-in.jpg <img width=350 src="http://www.gctronic.com/doc/images/Elisa3-charger-in.jpg">]</span> <br/>
iface wlan0 inet static
address 192.168.1.2
netmask 255.255.255.0
wpa-conf /path/to/wifi.conf #this should be replaced by the absolute location of wifi.conf
</pre>
 
And the related wifi.conf
<pre>
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
  ssid="myssid" #this should be replaced by your ssid
  scan_ssid=1
  key_mgmt=NONE
  wep_key0=1234567890 #this should be replaced by your WEP key
  wep_tx_keyidx=0
}
</pre>


The microcontroller is informed when the robot is in charge and this information is also transferred to the PC in the ''flags'' byte; this let the user be able to pilote the robot to the charger station and be informed when it is actually in charge. More information about the radio protocol can be found in the section [http://www.gctronic.com/doc/index.php/Elisa-3#Communication Communication].
In this example, static IPs and WEP encryption have been used. DHCP and other encryption can be obviously used by following the documentation both of the linux native network setup and of [http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant].


Moreover the robot is also charged when the micro USB cable is connected to a computer; pay attention that if the USB cable is connected to a hub, this one need to be power supplied.
===Network performance===
To test the network performance you could use the ''iperf'' tool installed on the system. In the server side you must issue the following command (either for TCP or UDP testing), after which the server machine is listening for incoming data:
<pre>
iperf -s      [TCP]
iperf -s -u  [UDP]
</pre>
In the client side you must type:
<pre>
iperf -c SERVER-IP                  [TCP]
iperf -c SERBER-IP -u -b 50000000    [UDP]
</pre>
Where ''SERVER-IP'' must be changed accordingly to the network configuration.


The following video shows the Elisa-3 piloted through the radio to the charging station using the monitor application: {{#ev:youtube|kjliXlQcgzw}}
==Package manager==
If you have an internet connection up and running you can update and install easily new packages with ''opkg''. Some of the useful operations you could do are:
* update repositories: <code>opkg update</code>
* update installed packages and kernel; pay attention that the camera driver is based on the provided kernel and upgrading it will prevent the use of the camera: <code>opkg upgrade</code>
* list of software currently installed on the machine: <code>opkg list_installed</code>
* install a new package (perl in the example): <code>opkg install perl</code>
* remove a pacakge (perl in the example): <code>opkg remove perl</code>
* list of all packages available to be installed: <code>opkg list</code>


==Top light diffuser==
===opkg update failed===
From February 2013 onwards the Elisa-3 is equipped with a new top light diffuser designed to fit perfectly in the 3 IRs emitters of the robot. The diffuser is made of plastic (3d printed), it is more robust and it simplifies the removal and insertion. Here is an image:<br/>
If you get errors on reaching the default repo sources you can try changing them by following these steps:
<span class="plainlinks">[http://www.gctronic.com/doc/images/elisa3-new-case.jpg <img width=350 src="http://www.gctronic.com/doc/images/elisa3-new-case-small.jpg">]</span>
# make a copy of the current repo: <code>mv /etc/opkg/base-feed.conf /dest-dir</code>
# add the new repo: <code>echo 'src/gz base http://feeds.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base' > /etc/opkg/base-feed.conf</code>
# opkg update
The procedure shows how to change the <code>base</code> repo, the same need to be done for all others repos.


=Hardware=
==USB ports==
The following figures show the main components offered by the Elisa-3 robot and where they are physically placed: <br/>
The e-puck extension board for the Gumstix Overo COM comes with two USB interfaces called USB host and USB otg. If you try inserting devices that require more energy than the one permitted on the otg, the device will not be enabled automatically. In these cases you can use the three scripts ''usbup'', ''usbdown'' and ''usbenable'' to respectively power up, power down and enable the USB device; they're placed under /home/root/scripts. These scripts are intended for primary use with the USB otg port, even if they're suitable for both ports (otg and host).
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3.1-hw-schema-top.jpg <img width=550 src="http://www.gctronic.com/doc/images/Elisa3.1-hw-schema-top.jpg">]</span> <br/>
* ''./usbup otg'' (or ''./usbup host''): power on the usb device
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3-hw-schema-bottom3.jpg <img width=400 src="http://www.gctronic.com/doc/images/Elisa3-hw-schema-bottom3.jpg">]</span> <br/>
* ''./usbdown otg'' (or ''./usbdown host''): power off the usb device
* ''./usbenable otg'' (or ''./usbenable host''): activate the usb device (now is in the usb device list)


==Power autonomy==
==Demos==
The robot is equipped with two batteries for a duration of about 3 hours at normal usage (motors run continuously, IRs and RGB leds turned on).
A specific firmware must be charged on the e-puck to run the Gumstix Overo linked demos, refer to section [http://www.gctronic.com/doc/index.php/Overo_Extension#E-puck_firmware E-puck firmware].
<span class="plainlinks">[http://www.gctronic.com/doc/images/Power-autonomy.jpg <img width=800 src="http://www.gctronic.com/doc/images/Power-autonomy.jpg">]</span> <br/>


==Detailed specifications==
===Serial test on the Gumstix Overo COM===
{| border="1"
This small program read and write from a serial port (non-canonical mode). For more information on the usage refers to [http://docwiki.gumstix.org/index.php?title=Sample_code/C/Serial sertest] ([http://projects.gctronic.com/Gumstix/sertest.tar.gz sertest sources]). It's placed under /home/root/demos/gumstix-common, and it's called ''sertest''.
|'''Feature'''
|'''Technical information'''
|-
|Size, weight
|50 mm diameter, 30 mm height, 39 g
|-
|Battery, autonomy
|LiIPo rechargeable battery (2 x 130 mAh, 3.7 V). About 3 hours autonomy. Recharging time about 1h e 30.
|-
|Processor
|Atmel ATmega2560 @ 8MHz (~ 8 MIPS); 8 bit microcontroller
|-
|Memory
|RAM: 8 KB; Flash: 256 KB; EEPROM: 4 KB
|-
|Motors
|2 DC motors with a 25:1 reduction gear; speed controlled with backEMF
|-
|Magnetic wheels
|Adesion force of about 1 N (100 g) depending on surface material and painting<br/> Wheels diamater = 9 mm <br/>Distance between wheels = 40.8 mm
|-
|Speed
|Max: 60 cm/s
|-
|Mechanical structure
|PCB, motors holder, top white plastic to diffuse light
|-
|IR sensors
|8 infra-red sensors measuring ambient light and proximity of objects up to 6 cm; each sensor is 45° away from each other <br/> 4 ground sensors detecting the end of the viable surface (placed on the front-side of the robot)
|-
| IR emitters
| 3 IR emitters (2 on front-side, 1 on back-side of the robot)
|-
|Accelerometer
|3D accelerometer along the X, Y and Z axis
|-
|LEDs
|1 RGB LED in the center of the robot; 8 green LEDs around the robot
|-
|Switch / selector
|16 position rotating switch
|-
|Communication
| Standard Serial Port (up to 38kbps)<br/> Wireless: RF 2.4 GHz; the throughput depends on number of robot: eg. 250Hz for 4 robots, 10Hz for 100 robots; up to 10 m
|-
|Remote Control
|Infra-red receiver for standard remote control commands
|-
|Expansion bus
|Optional connectors: 2 x UART, I2C, 2 x PWM, battery, ground, analog and digital voltage
|-
|Programming
|C/C++ programming with the AVR-GCC compiler ([http://winavr.sourceforge.net/ WinAVR] for Windows). Free compiler and IDE (AVR Studio / Arduino)
|}


=Communication=
===Advanced sercom===
==Wireless==
Once the new firmware is running on the e-puck, the selector must be set in position 10 to run the advanced sercom for the Gumstix Overo. <br/>
The radio base-station is connected to the PC through USB and transfers data to and from the robot wirelessly. In the same way the radio chip ([http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01P nRF24L01+]) mounted on the robot communicates through SPI with the microcontroller and transfers data to and from the PC wirelessly.<br/>
Now you can type (after being in /home/root/demos/gumstix-common) ''./sertest -p /dev/ttyS0 -b 230400'' (or simply ''./ser+ENTER'') to enter the e-puck menu in console mode; for a list of all available commands type ''h+ENTER''. After stopping the sertest program (CTRL+C), the display may not respond correctly; to reset the display run the script ''r'' by simply typing ''./r+ENTER''. Now the display should behave normally.<br/>
The robot is identified by an address that is stored in the last two bytes of the microcontroller internal EEPROM; the robot firmware setup the radio module reading the address from the EEPROM. This address corresponds to the robot id written on the label placed under the robot and should not be changed.<br/>
For more information about the advanced sercom refer to the page [http://www.gctronic.com/doc/index.php/Advanced_sercom_protocol Advanced sercom protocol].
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa-communication.jpg <img width=400 src="http://www.gctronic.com/doc/images/Elisa-communication.jpg">]</span><br/>


===Packet format - PC to radio to robot===
===Images grabbing (camera driver)===
The 13 bytes payload packet format is shown below (the number in the parenthesis expresses the bytes):
<!-- A small utility called ''v4l2grab'' was used for grabbing JPEGs from V4L2 devices ([http://github.com/twam/v4l2grab http://github.com/twam/v4l2grab]). <br/>
{| border="1"
In order to get an image from the e-puck camera you need to follow these steps:
| Command (1)  
# load the driver typing (after being in /home/root/demos) ''insmod po6030cam.ko po6030_format=1''; a message should be displayed indicating that the camera is successfully detected
| Red led (1)
# run the program typing (after being in /home/root/demos) ''./v4l2grab -o image.jpg''
| Blue led (1)  
For more information on the options available refer to ''./v4l2grab -h''.
| Green led (1)
-->
| IR + Flags (1)
A small application called ''v4l2grab'' ([http://projects.gctronic.com/Gumstix/v4l2grab-2buff-rev17-13.08.14.zip v4l2grab.zip]) based on [http://github.com/twam/v4l2grab http://github.com/twam/v4l2grab] was used for grabbing JPEGs from V4L2 devices. In order to get an image from the e-puck camera you need to run the program typing (after being in <code>/home/root/demos/gumstix-common/</code>) <code>./v4l2grab -o image.jpg</code>. The application communicates also with the robot through the serial line to know the camera orientation and rotates the image automatically in case the camera is rotated (refer to section [http://www.gctronic.com/doc/index.php/E-Puck#Camera e-puck camera] for more information on camera orientation).
| Right motor (1)  
For more information on the options available refer to the help by typing<code>./v4l2grab -h</code>.
| Left motor (1)  
| Small green leds (1)  
| Flags2 (1)
| Remaining 5 bytes are unused
|}


* Command: 0x27 = change robot state; 0x28 = goto base-station bootloader (this byte is not sent to the robot)
===Images transfer (camera driver)===
* Red, Blue, Green leds: values from 0 (OFF) to 100 (ON max power)
This demo is divided in two parts: one running on the e-puck extension board for the Gumstix Overo COM that continuously request images to the e-puck camera and transfers them over UDP, and the other running on a PC that acts as a server and is listening for the images visualizing them as soon as they are available. A network link must be established between the two in order to run this demo; for more information on how to configure the network refer to the section [http://www.gctronic.com/doc/index.php/Overo_Extension#Wireless_setup Wireless setup].
* IR + flags:
** first two bits are dedicated to the IRs:
*** 0x00 => all IRs off
*** 0x01 => back IR on
*** 0x02 => front IRs on
*** 0x03 => all IRs on
** third bit is reserved for enabling/disabling IR remote control (0=>disabled, 1=>enabled)
** fourth bit is used for sleep (1 => go to sleep for 1 minute)
** fifth bit is used to calibrate all sensors (proximity, ground, accelerometer) and reset odometry
** sixth bit is reserved (used by radio station)
** seventh bit is used for enabling/disabling onboard obstacle avoidance
** eight bit is used for enabling/disabling onboard cliff avoidance
* Right, Left motors: speed expressed in 1/5 of mm/s (i.e. a value of 10 means 50 mm/s); MSBit indicate direction: 1=forward, 0=backward; values from 0 to 127
* Small green leds: each bit define whether the corresponding led is turned on (1) or off (0); e.g. if bit0=1 then led0=on
* Flags2:
** bit0 is used for odometry calibration
** remaining bits unused
* Remaining bytes free to be used


====Optimized protocol====
First of all you need to start the server ([http://projects.gctronic.com/Gumstix/Receiver.zip Receiver QT project]). The application is a Qt project, so the compilation may be handled easily with [https://wiki.qt.io/Category:Tools::QtCreator Qt Creator]; alternatively [http://doc.qt.io/qt-5/qmake-manual.html qmake] can be used. The usage is very simple: the server listening port and the protocol (only UDP available at the moment) must be selected first, then click on the button ''Connect''; at this moment the application is waiting images.<br/>
The communication between the pc and the base-station is controlled by the master (computer) that continuously polls the slave (base-station); the polling is done once every millisecond and this is a restriction on the maximum communication throughput. To overcome this limitation we implemented an optimized protocol in which the packet sent to the base-station contains commands for four robots simultaneously; the base-station then separate the data and send them to the correct robot address. The same is applied in reception, that is the base-station is responsible of receiving the ack payloads of 4 robots (64 bytes in total) and send them to the computer. This procedure let us have a throughput 4 times faster.
On the e-puck extension board side, you need to run the program typing (after being in /home/root/demos) ''./v4l2grab-send -o image.jpg -i SERVER_IP -p SERVER_PORT -f 0 -t 0''. ''SERVER_IP'' is the address of the PC and ''SERVER_PORT'' should be the same as configured when the receiver was started. The ''f'' option indicates the format (in this case RGB) and ''t'' indicates the transfer mode (0=UDP, 1=TCP).
<!--
<!--
- ack returned must be up to 16 bytes (max 64 bytes for the usb buffer); the same number of bytes returned by the robot as ack payload has to be read then by the pc!!
On the e-puck extension board side, you need to follow these steps:
- la base-station ritorna "2" quando l'ack non è stato ricevuto;
# load the driver typing (after being in /home/root/demos) ''insmod po6030cam.ko po6030_format=0''; a message should be displayed indicating that the camera is successfully detected
# run the program typing (after being in /home/root/demos) ''./v4l2grab-send -o image.jpg -i SERVER_IP -p SERVER_PORT -f 0 -t 0''. ''SERVER_IP'' is the address of the PC and ''SERVER_PORT'' should be the same as configured when the receiver was started. The ''f'' option indicates the format (in this case RGB) and ''t'' indicates the transfer mode (0=UDP, 1=TCP but still not available).
-->
-->
For more information on the options available refer to ''./v4l2grab-send -h''. <br/>
The sources for the sender, that is an extension of the ''v4l2grab'' application, could be found in the following link [http://projects.gctronic.com/Gumstix/v4l2grab-send.zip v4l2grab-send.zip]; in order to compile the application the ''Makefile'' must be modified specifying the path to the cross-compiler (for more information on cross-compilation for the OMAP3530 processor refers to [http://focus.ti.com/docs/prod/folders/print/omap3503.html http://focus.ti.com/docs/prod/folders/print/omap3503.html]).


===Packet format - robot to radio to PC===
===Music player===
The robot send back to the base-station information about all its sensors every time it receive a command; this is accomplished by using the "ack payload" feature of the radio module. Each "ack payload" is 16 bytes length and is marked with an ID that is used to know which information the robot is currently transferring. The sequence is the following (the number in the parenthesis expresses the bytes):
This isn't really a demo, it's only one of the possible way on how to listen something from the extension module. The system comes with a tool called [http://www.mplayerhq.hu/ mplayer] that supports many multimedia formats. You can use it to play for example an mp3 file in this way:
{| border="1"
<pre>
|ID=3 (1)
mplayer file.mp3
|Prox0 (2)
</pre>
|Prox1 (2)
You can then adjust the volume with either the ''alsamixer'' graphical tool (adjusting DAC2 control) or using the command line tool ''amixer''; the following command can be used for instance to set the volume to 80%:
|Prox2 (2)
<pre>
|Prox3 (2)
amixer set 'DAC2 Analog' 80%
|Prox5 (2)
</pre>
|Prox6 (2)
 
|Prox7 (2)
==File transfer==
|Flags (1)
===ssh===
|-
The e-puck extension board for the Gumstix Overo COM supports ssh connections through dropbear (small SSH 2 server and client) that is installed on the system.<br/>
|||||||||||||||||
To exchange file between the module and the PC, the ''scp'' tool (secure copy) will be used; the general command is the following:
|-
<pre>
|ID=4 (1)
scp user@ip:path-to-file file-name
|Prox4 (2)
</pre>
|Ground0 (2)
As an example of transfer a file from the PC to the extension, let the PC user be ''stefano'' and its IP be 192.168.1.10, then the command will be:
|Ground1 (2)
<pre>
|Ground2 (2)
scp stefano@192.168.1.10:/home/stefano/file-to-send prova
|Ground3 (2)
</pre>
|AccX (2)
The file ''file-to-send'' will be renamed in ''prova'' and placed in the current directory.
|AccY (2)
 
|TV remote (1)
If you are working in Windows you can use [http://winscp.net WinSCP] to exchange data between the robot and the computer.
|-
 
|||||||||||||||||
===zmodem===
|-  
The following instructions to exchange data between the extension and the computer refer to ''minicom'' as the terminal.<br/>
|ID=5 (1)
If you want to receive a file, that is transfer a file from the PC to the e-puck extension board for the Gumstix Overo COM, you need to follow these steps:
|ProxAmbient0 (2)
# open a terminal window with minicom; now you access the linux system in console mode
|ProxAmbient1 (2)
# type ''lrz''
|ProxAmbient2 (2)
# press ''CTRL+A'' and then ''S''
|ProxAmbient3 (2)
# select ''zmodem'' and navigate to find the file you want to tranfer
|ProxAmbient5 (2)
# select the file with the ''SPACEBAR'' and then press ''ENTER'' to start the transfer
|ProxAmbient6 (2)
# when transfer is complete press ''ENTER'' once more to come back to the command line
|ProxAmbient7 (2)
For more information type ''lrz -h''.
|Selector (1)
 
|-
If you want to send a file, that is transfer a file from the e-puck extension board to the PC, you need to follow these steps:
|||||||||||||||||
# open a terminal window with minicom; now you access the linux system in console mode
|-
# type ''lsz file-name'', where ''file-name'' is the file you want to transfer
|ID=6 (1)
# when transfer is complete press ''ENTER'' to return to the command line
|ProxAmbient4 (2)
The file will be placed in the directory where minicom is started. For more information type ''lsz -h''.
|GroundAmbient0 (2)
|GroundAmbient1 (2)
|GroundAmbient2 (2)
|GroundAmbient3 (2)
|AccZ (2)
|Battery (2)
|Free (1)
|-
|||||||||||||||||
|-  
|ID=7 (1)
|LeftSteps (4)
|RightSteps (4)
|theta (2)
|xpos (2)
|ypos (2)
|Free (1)
|
|
|}


Pay attention that the base-station could return "error" codes in the first byte if the communication has problems:
==Extension LEDs==
* 0 => transmission succeed (no ack received though)
The e-puck extension board for the Gumstix Overo COM comprises 8 new small leds that can be turned on/off easily from the file system in this way:
* 1 => ack received (should not be returned because if the ack is received, then the payload is read)
<pre>
* 2 => transfer failed
echo 1 > /sys/class/gpio/gpio7x/value  [turn on]
echo 0 > /sys/class/gpio/gpio7x/value  [turn off]
</pre>
where x ranges from 0 to 7. For more information on gpio refer to the section [http://www.gctronic.com/doc/index.php/Overo_Extension#GPIO_-_pins_mode GPIO - pins mode].


Packet ID 3:
==File system image==
* Prox* contain values from 0 to 1023, the greater the values the nearer the objects to the sensor
You can download the entire system running on the micro sd released with the e-puck extension board from the following links: [http://projects.gctronic.com/Gumstix/epuck-overo-e2fs-12.08.14.tar.gz file system] and [http://projects.gctronic.com/Gumstix/epuck-overo-fat-30.03.15.tar.gz FAT] (with camera driver 1.3). <br/>
* The ''Flags'' byte contains these information:
In order to prepare the micro sd you can use a script ([http://projects.gctronic.com/Gumstix/prepareMicroSD.sh prepareMicroSD.sh]), in which you need only to specify where to find the two previously downloaded files and run it (''./prepareMicroSD.sh /path/to/dev'') to have your micro sd ready to be used. Alternatively you can have a look the gumstix documentation on how to [https://www.gumstix.com/support/getting-started/create-bootable-microsd-card/ create a bootable microsd card].<br/>
** bit0: 0 = robot not in charge; 1 = robot in charge
<!--
** bit1: 0 = button pressed; 1 = button not pressed
<font style="color:red"> A new camera driver release (1.1) is available, refer to section [http://www.gctronic.com/doc/index.php/Overo_Extension#Camera_driver Camera driver] for information on how to update the system</font>. <br/>
** bit2: 0 = robot not charged completely; 1 = robot charged completely
-->
** the remainig bits are not used at the moment
If you experience problems in booting from mmc enter u-boot and issue the following command:
<pre>
nand erase 240000 20000
reset
</pre>
Moreover if you need you can find pre-built images for the Gumstix Overo in the following link: [http://gumstix.org/download-prebuilt-images.html http://gumstix.org/download-prebuilt-images.html].
===Sources===
The complete kernel sources (comprising the camera driver) can be downloaded from the following link [http://projects.gctronic.com/Gumstix/gctronic-ti-psp-omap-2.6.32-12.08.14.zip gctronic-ti-psp-omap-2.6.32-12.08.14.zip] if you want to try to build it your own (anyway you don't need to do it because the released micro SD is ready to run with this system). The system is based on:
<!--* [http://www.sakoman.com/feeds/omap3/glibc/images/overo/201005041130/ sakoman's pre-built file system image]-->
* sakoman's pre-built file system image
* [http://arago-project.org/git/people/?p=sriram/ti-psp-omap.git;a=summary ti-psp-2.6.32 kernel]


Packet ID 4:
===Camera driver===
* Prox4 contains values from 0 to 1023, the greater the values the nearer the objects to the sensor
The driver of the camera is open-source, you can download the code in the section [http://www.gctronic.com/doc/index.php/Overo_Extension#Sources kernel source]. The driver is located in <code>/ti-psp-omap/drivers/media/video/po6030cam.c</code>; related ISP code is located in <code>/ti-psp-omap/drivers/media/video/isp</code>.
* Ground* contain values from 512 to 1023, the smaller the value the darker the surface
====Release notes====
* AccX and AccY contain raw values of the accelerometer; the range is between -64 to 64
:1.0
* TV remote contains the last interpreted command received through IR
* support for PO6030 camera (front e-puck camera or camera of omnicam module version 1)
* support for RGB565 output format
* only 640x480 resolution images
:1.1
* added support for PO3030 camera
* added support for YUV422 output format
* brightness, contrast, saturation, auto-white balance, red gain, blue gain controls available
:1.2
* exposure control available
* support for 480x480 color and greyscale images
:1.3
* added support for PO8030 camera


Packet ID 5:
====System update====
* ProxAmbient* contain values from 0 to 1023, the smaller the values the brighter the ambient light
In order to update the system released in the micro sd with the new driver you need to download the kernel modules from [http://projects.gctronic.com/Gumstix/driver-update/1.3/linux-2.6.32.tar.gz linux-2.6.32.tar.gz] and the kernel image from
* Selector contains the value of the current selector position
[http://projects.gctronic.com/Gumstix/driver-update/1.3/uImage uImage]. Then:
# insert the micro sd in the computer; two partitions will be recognized
# copy the kernel image (uImage) in the FAT partition
# extract the kernel modules in the second partition:
## cd path/to/partition
## sudo tar zxvf path/to/kernel-modules
# unmount the micro sd from the computer and insert it in the extension; at first boot type ''depmod -a'' and reboot


Packet ID 6:
==Daemon==
* ProxAmbient4 contains values from 0 to 1023, the smaller the values the brighter the ambient light
It can be useful to start a daemon at the end of the boot process in order to run your own program at the start up of the e-puck (when the console mode won't be accessible). This can be done by placing your program executable into ''/etc/init.d'' and then:
* GroundAmbient* contain values from 0 to 1023, the smaller the values the brighter the ambient light
<pre>
* AccZ contains raw values of the accelerometer; the range is between 0 and -128 (upside down)
cp /path/to/your/executable /usr/sbin/mainProgram
* Battery contains the sampled value of the battery, the values range is between 780 (battery discharged) and 930 (battery charged)
cd /etc/init.d
update-rc.d mainProgram defaults 99
</pre>


Packet ID 7:
The daemon can be removed by removing these files:
* LeftSteps and RightSteps contain the sum of the sampled speed for left and right motors respectively (only available when the speed controller isn't used; refer to xpos, ypos and theta when the speed controller is used)
<pre>
* theta contains the orientation of the robot expressed in 1/10 of degree (3600 degrees for a full turn); available only when the speed controller is enabled
rm /etc/rc*/*mainProgram*
* xpos and ypos contain the position of the robot expressed in millimeters; available only when the speed controller is enabled
</pre>


=Software=
Remember to give execution permission to the program by typing <code>chmod +x mainProgram</code>.


==Robot==
=Hardware=
===Requirements===
The following figure shows the main components offered by the e-puck extension for the Gumstix Overo COM and their interconnection with the e-puck robot and the Gumstix Overo COM.<br/>
In order to communicate with the robot through the micro USB the FTDI driver need to be installed. If a serial port is automatically created when connecting the robot to the computer you're done otherwise you need to download the drivers for your system and architecture:
<span class="plainlinks">[http://www.gctronic.com/doc/images/Gumstix-schema.jpg <img width=600 src="http://www.gctronic.com/doc/images/Gumstix-schema.jpg">]</span> <br/>
* [http://www.ftdichip.com/Drivers/CDM/CDM%20v2.10.00%20WHQL%20Certified.exe Windows Vista/XP], [http://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.10%20WHQL%20Certified.exe Windows 7/8/10 (run as administrator)]
In particular there are:
* Ubuntu: when the robot is connected the port will be created in <code>/dev/ttyUSB0</code> (no need to install a driver)
* a Gumstix Overo COMs: compatible with all Gumstix Overo COM models. The communication between the Gumstix Overo COM (OMAP 35xx) and the e-puck (dsPIC) is handled with a serial line at 230400 baud
* [http://www.ftdichip.com/drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg Mac OS X 10.3 to 10.8 (32 bit)], [http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg Mac OS X 10.3 to 10.8 (64 bit)], [http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_3.dmg Mac OS X 10.9 and above]; after installing the driver the port will be created in <code>/dev/tty.usbserial-...</code>; you can find a guide on how to install the driver in the following link [http://www.ftdichip.com/Support/Documents/AppNotes/AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf]
* a mini-usb connector (console) used to enter the linux system through a terminal
All the drivers can be found in the official page from the following link [http://www.ftdichip.com/Drivers/VCP.htm FTDI drivers].
* one usb otg and one usb host: these two connectors are really useful to connect whatever peripheral you need, like a WiFi dongle or simply a pen drive to extend the memory
* a speaker ([http://projects.gctronic.com/Gumstix/datasheet-speaker.pdf speaker specification]): with Linux running on the Gumstix Overo COM, it's really easy play any audio format you need or implement a speech synthesizer. If the user prefer to have the speaker on the extension linked to the e-puck processor, it can simply be done changing two small resistors
* 8 LEDs: have you ever seen a board without leds?! Anyway they are completely controllable through GPIO lines (gpio70-gpio77), for detailed information refer to section [http://www.gctronic.com/doc/index.php/Overo_Extension#GPIO_-_pins_mode GPIO - pins mode]
* an I2C connector (@5 V)
* a rotary selector: one could choose what program is running on the e-puck based on the selector position
* 2 long range infrared proximity sensors ([http://projects.gctronic.com/Gumstix/datasheet-long-range.pdf long range specification]) <!-- , up to 15-20 cm -->
* the PixelPlus PO6030 camera remains mounted on the robot, but you could receive image from it by using the OMAP ISP (Camera Interface Subsystem); this way we can receive up to 18 frames per second (VGA color images)


===AVR Studio 4 project===
The following figure illustrates where the components are physically placed on the e-puck extension board for the Gumstix Overo COM. <br/>
The projects are built with [http://www.atmel.com/tools/STUDIOARCHIVE.aspx AVR Studio 4] released by Atmel. <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Gumstix-schema2.jpg <img width=600 src="http://www.gctronic.com/doc/images/Gumstix-schema2.jpg">]</span> <br/>


====Basic demo====
==Electrical schema==
This project is thought to be a starting point for Elisa-3 newbie users and basically contains a small and clean main with some basic demos selected through the hardware selector that show how to interact with robot sensors and actuators.
The circuit diagram of the e-puck extension for Gumstix Overo COM is available to the community on the following link [http://projects.gctronic.com/Gumstix/GC_EXT5_V3.pdf electrical schema].
The project source can be downloaded from [http://projects.gctronic.com/elisa3/Elisa3-firmware-basic-rev243-21.03.18.zip Elisa-3 basic firmware source]; the hex file can be directly downloaded from [http://projects.gctronic.com/elisa3/Elisa3-firmware-basic-rev243-21.03.18.hex Elisa-3 basic firmware hex]. To program the robot refer to section [http://www.gctronic.com/doc/index.php/Elisa-3#Programming Programming]. <br/>
Selector position and related demo:
* 0: no speed controller activated => free running (all others positions have the speed controller activated)
* 1: obstacle avoidance enabled
* 2: cliff avoidance enabled (currently it will simply stop before falling and stay there waiting for commands)
* 3: both obstacle and cliff avoidance enabled
* 4: random RGB colors and small green leds on
* 5: robot moving forward with obstacle avoidance enabled and random RGB colors


====Advanced demo====
==Long range proximity sensors==
This is an extension of the ''basic demo project'', basically it contains some additional advanced demos.
The following chart illustrates the long range proximity sensors response towards a white surface. These results should be considered indicative.<br/>
The project source can be downloaded from [http://projects.gctronic.com/elisa3/Elisa3-firmware-advanced-rev240-13.03.18.zip Elisa-3 advanced firmware source]; the hex file can be directly downloaded from [http://projects.gctronic.com/elisa3/Elisa3-firmware-advanced-rev240-13.03.18.hex Elisa-3 advanced firmware hex]. To program the robot refer to section [http://www.gctronic.com/doc/index.php/Elisa-3#Programming Programming]. <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/IR-characterization.jpg <img width=400 src="http://www.gctronic.com/doc/images/IR-characterization.jpg">]</span>
Selector position and related demo:
* 0: no speed controller activated => free running (all others positions have the speed controller activated)
* 1: obstacle avoidance enabled
* 2: cliff avoidance enabled (currently it will simply stop before falling and stay there waiting for commands)
* 3: both obstacle and cliff avoidance enabled
* 4: random RGB colors and small green leds on
* 5: robot moving forward with obstacle avoidance enabled and random RGB colors
* 6: robot testing and address writing through serial connection (used in production)
* 7: automatic charging demo (refer to section [http://www.gctronic.com/doc/index.php/Elisa-3#Videos Videos]), that is composed of 4 states:
** random walk with obstacle avoidance
** search black line
** follow black line that lead to the charging station
** charge for a while
* 8: autonomous odometry calibration (refer to section [http://www.gctronic.com/doc/index.php/Elisa-3#Autonomous_calibration Autonomous calibration])
* 9: write default odometry calibration values in EEPROM (hard-coded values); wait 2 seconds before start writing the calibration values
* 10: robot moving forward (with pause) and obstacle avoidance enabled; random RGB colors and green led effect
* 11: local communication: robot alignment
* 12: local communication: 2 or more robots exchange data sequentially
* 13: local communication: listen and transmit continuously; when data received change RGB color
* 14: local communication: RGB color propagation
* 15: clock calibration (communicate with the PC through the USB cable to change the OSCCAL register); this position could also be used to remote contol the robot through the radio (only speed control is enabled)


===Arduino IDE project===
A zoom in the bigger distances shows that the values returned from the sensors are still usable to react to obstacles.
The project is built with the Arduino IDE 1.0 freely available from the [http://arduino.cc/ official Arduino website]. In order to build the Elisa-3 firmware with the Arduino IDE 1.0 the following steps has to be performed:<br/>
*1. download the [http://arduino.cc/hu/Main/Software Arduino IDE 1.0] (later versions should be also fine, last tried is 1.8.5, refer to [http://arduino.cc/en/Main/Software Arduino Software]) and extract it, let say in a folder named <code>arduino-1.0</code><br/>
*2. download the [http://projects.gctronic.com/elisa3/Elisa3-lib-rev241-13.03.18.zip Elisa-3 library] and extract it within the libraries folder of the Arduino IDE, in this case <code>arduino-1.0\libraries</code>; you should end up with a <code>Elisa3</code> folder within the libraries. If you start the Arduino IDE now you can see that the <code>Elisa-3</code> library is available in the menu <code>Sketch=>Import Library...</code> (or <code>Sketch=>Include Lirary</code> in later IDE versions)<br/>
*3. the file <code>boards.txt</code> in the Arduino IDE folder <code>arduino-1.0\hardware\arduino</code> (or <code>arduino-1.x\hardware\arduino\avr</code> in later IDE versions) need to be changed to contain the definitions for the Elisa-3 robot, add the following definitions at the end of the file:
<pre>
##############################################################


elisa3.name=Elisa 3 robot
<chart width="600" height="300" legend_title="Legend" x_type="length" x_unit="cm" x_title="Distance" y_type="general" y_unit="ADC value" y_title="Prox">
Prox;14;203
Prox;16;154
Prox;18;128
Prox;20;105
Prox;22;88
Prox;24;78
Prox;26;70
</chart>


elisa3.upload.tool=avrdude
==WiFi dongle==
elisa3.upload.protocol=stk500v2
===Zyxel===
elisa3.upload.maximum_size=258048
The WiFi dongle shipped with the extension board for the Gumstix Overo COM is a ZyXEL NWD271N USB adapter, 802.11n compatible. It's based on an Atheros chipset, for more infromation about the linux driver visit the following site [http://linuxwireless.org/en/users/Drivers/ar9170 http://linuxwireless.org/en/users/Drivers/ar9170]. <br/>
elisa3.upload.speed=57600
The measured throughput with the e-puck extension and provided wifi dongle is '''20 Mb/s'''. <br/>
The consumption of the wifi dongle is 100 mA in standby and 300 mA when active.
elisa3.bootloader.low_fuses=0xE2
<!--During prototyping another WiFi dongle was used, the Trendnet -->
elisa3.bootloader.high_fuses=0xD0
elisa3.bootloader.extended_fuses=0xFF
elisa3.bootloader.path=stk500v2-elisa3
elisa3.bootloader.file=stk500v2-elisa3.hex
elisa3.bootloader.unlock_bits=0x3F
elisa3.bootloader.lock_bits=0x0F


elisa3.build.mcu=atmega2560
===Edimax===
elisa3.build.f_cpu=8000000L
A new WiFi dongle is shipped starting from January 2012, it is the Edimax EW-7811Un, based on a Realtek chipset (RTL8192cu).  
elisa3.build.board=AVR_ELISA3
The device isn't recognized automatically at boot, so you need to follow these steps in order to enable and use it:
elisa3.build.core=arduino
# turn on the robot and login with <code>user=root, password=root</code>
elisa3.build.variant=mega
# only needed if the wifi dongle is connected to the USB OTG: type <code>./scripts/gumstix-common/usbenable otg</code>. Don't worry about the warning <code>usb 1-1: new config #1 exceeds power limit by 400mA</code>
# type <code>insmod 8192cu.ko</code> (the kernel module is located in /home/root); the wifi dongle should be recognized and a wlanX device created
# type <code>ifconfig wlanX up</code> (where X is a number) to turn on the device; now the wifi can be configured and used normally
The following figures show how the device is mounted on the extension: on the left the WiFi dongle is connected to the USB HOST connector (pay attention to the position on the connector), on the right the WiFi dongle is connected to the USB OTG (this is needed when using an [http://www.gctronic.com/doc/index.php/Omnivision_Module_V2 omnivsion extension]):<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/Gumstix-nano-wifi.jpg <img width=400 src="http://www.gctronic.com/doc/images/Gumstix-nano-wifi.jpg">]</span>
<span class="plainlinks">[http://www.gctronic.com/doc/images/edimax-otg.jpg <img width=350 src="http://www.gctronic.com/doc/images/edimax-otg-small.jpg">]</span> <br/>


##############################################################
==Consumption==
</pre>
The consumption of the robot and extension is 300 mA; with the Zyxel wifi dongle inserted (standby) the consumption goes up to 400 mA; when the wifi dongle becomes active, the consumption reaches 700 mA. If the wifi isn't used it can be turned off completely using the usb scripts [http://www.gctronic.com/doc/index.php/Overo_Extension#USB_ports http://www.gctronic.com/doc/index.php/Overo_Extension#USB_ports].
*4. this step need to be performed only with later IDE versions, when you receive a warning like this <code>Bootloader file specified but missing...</code> during compilation.<br/> In this case place the [http://projects.gctronic.com/elisa3/stk500v2-rev222.hex bootloader hex file] you can find in the [http://www.gctronic.com/doc/index.php/Elisa-3#Bootloader Bootloader section] in the directory <code>arduino-1.x\Arduino\hardware\arduino\avr\bootloaders\</code> and name it <code>stk500v2-elisa3.hex</code>
*5. download the [http://projects.gctronic.com/elisa3/Elisa3-arduino.zip Elisa-3 project file] and open it with the Arduino IDE (you should open the file "''elisa3.ino''")
*6. select <code>Elisa-3 robot</code> from the <code>Tools=>Board</code> menu; click on the <code>Verify</code> button to build the project
*7. to upload the resulting hex file, attach the micro usb and set the port from the <code>Tools=>Serial Port</code> menu consequently; turn on the robot and click on the <code>Upload</code> button


You can download the Arduino IDE 1.0.5 for Linux (32 bits) containing an updated avr toolchain (4.5.3) and the Elisa3 library from the following link [http://projects.gctronic.com/elisa3/arduino-1.0.5-linux32.zip arduino-1.0.5-linux32.zip]. <br/>
Two different tests were performed to provide an estimation of the duration of the battery:
If the <code>Tools->Serial Port</code> menu is grayed out then you need to start the Arduino IDE in a terminal typing <code>sudo path/to/arduino</code>.<br/>
# e-puck and gumstix active (gumstix sends commands via serial to robot; movement every 3s lasting 1s at 30% of maximum speed): '''3h and 30 minutes'''
# e-puck, gumstix and wifi active (same as above, moreover wifi active all the time with continuous ping): '''1h and 25 minutes'''


If you want to have access to the compiler options you can download the following project [http://projects.gctronic.com/elisa3/Elisa3-arduino-makefile.zip Elisa3-arduino-makefile.zip] that contains an Arduino IDE project with a Makefile, follow the instructions in the "readme.txt" file in order to build and upload to the robot.
==External power==
In the package you'll find also an external power adapter that will be useful during development of your applications. As power supply you could use the one of the e-puck battery charger. The following figure shows the power supply cable, the external power cable and the extension.<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/External-power.jpg <img width=400 src="http://www.gctronic.com/doc/images/External-power.jpg">]</span> <br/>
You need to simply attach the power supply in one side, and the other side of the external power cable on top of the extension (near the USB plug). Once the cable is connected a green led should turn on indicating that the extension is running. <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/External-power-attached.jpg <img width=400 src="http://www.gctronic.com/doc/images/External-power-attached.jpg">]</span> <br/>
The external power cable could also be plugged in when the extension is mounted on the e-puck, but '''<font style="color:red"> pay attention to not turn on the robot when the external cable supplies the energy, otherwise there could be serious damages of the devices and the battery</font>'''.


===Aseba===
==3.3V and 5V source==
Refer to the page [{{fullurl:Elisa-3 Aseba}} Elisa-3 Aseba].
The 3.3 V comes from the e-puck robot and the 5V comes from the gumstix extension. The gumstix extension can be used alone (without the robot attached to it) but some things are related to the 3.3 V thus without the robot connected they will not work; an example are the RGB leds of the omnivion module, that need the robot to be connected to the extension in order to be used.


===Matlab===
=Software=
<span class="plainlinks">[http://www.gctronic.com/doc/images/elisa3-matlab.jpg <img width=200 src="http://www.gctronic.com/doc/images/elisa3-matlab-small.jpg">]</span><br/>
==E-puck firmware==
The [http://www.e-puck.org/index.php?option=com_content&view=article&id=29&Itemid=27 ePic2] Matlab interface was adapted to work with the Elisa-3 robot. The communication is handled with the radio module. Both Matlab 32 bits and 64 bits are supported (tested on Matlab R2010a) Follow these steps to start playing with the interface:
<!-- The firmware that has to be uploaded on the e-puck when working with the extension for Gumstix Overo COM can be downloaded from [http://projects.gctronic.com/E-Puck/DemoGCtronic-gumstix/DemoGCtronic-gumstix.hex hex]; the related MPLAB project can also be downloaded from [http://projects.gctronic.com/E-Puck/DemoGCtronic-gumstix/DemoGCtronic-gumstix.zip MPLAB project]. -->
# program the robot with the [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo advanced demo]
Refers to the section [http://www.gctronic.com/doc/index.php/E-Puck#Standard_firmware E-Puck Standard firmware] for the firmware that need to be uploaded to the robot.
# place the selector in position 15 (to pilot the robot through the interface with no obstacle and no cliff avoidance)
Essentially in this firmware a new version of the ''advanced sercom'' is included (selector position 10) in which the bluetooth communication is replaced by the serial line communication, running at 230400 between robot and gumstix. Moreover the I2C is disabled temporary from the dsPIC side (the dsPIC cannot communicate through I2C) in order to avoid conflicts. As a last note, the body led and front led aren't anymore usable with the extension due to the two extra long range proximity sensors and for power saving purposes the motors are configured to the minimum energy consumption during movement.<br/>
# connect the radio base-station to the computer
The values of the two extra proximity sensors can be retrieved with the command ''N'' in the ''advanced sercom'' (selector position 10); the last two values returned by the command refer to these proximity sensors (the others values refer to the proximity sensors mounted on the e-puck as usual).
# download the [http://projects.gctronic.com/elisa3/elisa3-ePic-rev235-03.10.17.zip ePic2 for Elisa-3] and extract it
# open (double click) the file ''main.m''; once Matlab is ready type ''main+ENTER'' and the GUI should start
# click on the ''+'' sign (top left) and insert the robot address (e.g 3307), then click on ''Connect''


===Webots simulator===
===Project building===
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa-3-webots.png <img width=200 src="http://www.gctronic.com/doc/images/Elisa-3-webots-small.png">]</span><br/>
Refer to section [http://www.gctronic.com/doc/index.php/E-Puck#Project_building Project building] for information on how to build the project for the e-puck firmware.
The following features have been included in the Elisa-3 model for the [http://www.cyberbotics.com/ Webots simulator]:
* proximity sensors
* ground sensors
* accelerometer
* motors
* green leds around the robot
* RGB led
* radio communication


You can donwload the Webots project containig the Elisa-3 model (proto) and a demonstration world in the following link [http://projects.gctronic.com/elisa3/Elisa-3-webots.zip Elisa-3-webots.zip].
==Cross compilation==
If you want to develop some applications that will run on the gumstix you need to firstly download the toolchain.


You can download a Webots project containing a demonstration world illustrating the usage of the radio communication between 10 Elisa-3 robots and a supervisor in the following link [http://projects.gctronic.com/elisa3/Elisa-3-webots-radio.zip Elisa-3-webots-radio.zip]. Here is a video of this demo:<br/>
If you're using Ubuntu you can simply type <code>sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi</code> to install the required toolchain (have a look at [http://www.gumstix.org/basic-cross-compilation.html http://www.gumstix.org/basic-cross-compilation.html] and [http://wiki.gumstix.org/index.php?title=Toolchain http://wiki.gumstix.org/index.php?title=Toolchain] for more information).
{{#ev:youtube|IEgCo3XSESU}}


===Onboard behaviors===
Alternatively when you need to handle external dependencies is better using the toolchain integrated in OpenEmbedded (${OVEROTOP}/tmp/cross or ${OVEROTOP}/tmp/sysroots/i686-linux/usr/armv7a/bin/ with recent version) if you have it in your system. For more information refers to the [http://wiki.gumstix.org/index.php?title=Category:How_to_-_OpenEmbedded gumstix wiki].<br/>
The released firmware contains two basic onboard behaviors: obstacle and cliff avoidance. Both can be enabled and disabled from the computer through the radio (seventh bit of flags byte for obstacle avoidance, eight bit of flags byte for cliff avoidance).
The following videos show three robots that have their obstacle avoidance enabled:{{#ev:youtube|EbroxwWG-x4}} {{#ev:youtube|q6IRWRlTQeQ}}


===Programming===
For other linux systems you can find a toolchain in the following link [http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/] (30 days trial); this toolchain is useful for small programs:
The robot is pre-programmed with a serial bootloader. In order to upload a new program to the robot a micro USB cable is required. The connection with the robot is shown below:<br/>
# download the Lite Edition, you'll have a file named something like ''arm-2009q3-67-arm-none-linux-gnueabi.bin''
<span class="plainlinks">[http://www.gctronic.com/doc/images/Elisa3.1-programming.jpg <img width=400 src="http://www.gctronic.com/doc/images/Elisa3.1-programming.jpg">]</span> <br/>
# open a terminal, go to the directory of the file, type ''chmod +x arm-2009q3-67-arm-none-linux-gnueabi.bin'', after execute the file ''./arm-2009q3-67-arm-none-linux-gnueabi.bin'' to start the installation
# follow the installation steps; you have to choose where to install the toolchain, this is the path you will specify in the makefile


If you are working with the Arduino IDE you don't need to follow this procedure, refer instead to section [http://www.gctronic.com/doc/index.php/Elisa-3#Arduino_IDE_project Arduino IDE project].
Once a toolchain is installed in the system the process will be simply something like this:
# develop your application as you do normally in your developing machine
# cross-compile in your developing machine using the tools previously downloaded
# copy the executable in the extension's micro SD and run it
You can download the [http://projects.gctronic.com/Gumstix/helloworld.zip hello world example] containing a makefile in which you have to specify the path to the toolchain you previously installed in order to build the program; you can use it for others programs.<br/>
Refer to section [http://www.gctronic.com/doc/index.php/Overo_Extension#Demos http://www.gctronic.com/doc/index.php/Overo_Extension#Demos] for some application examples.


<font style="color:red">'''If you encounter some problem during programming (e.g. timeout problems) you can try following this sequence: turn on the robot, unplug the robot from the computer, plug the robot into the computer, it will make some blinks; when the blinks terminate execute the programming command again.<br/>'''</font>
Of course you can also install the compiler directly on the embedded system and build the applications from it, but the process will take longer due to limited computational power compared to a developing machine.
<font style="color:red">'''Beware that every time you need to re-program the robot you need to unplug and plug again the cable to the computer.'''</font>


====Windows 7====
===External dependencies===
# Download the [http://projects.gctronic.com/elisa3/programming/AVR-Burn-O-Mat-Windows7.zip Windows 7 package] and extract it. The package contains also the FTDI driver.
Some applications may require external libraries not contained within the standard toolchain package. For instance if your application depends on ''libjpeg'' then you need to tell the cross-compiler where to look to find this library (compiled for the target machine) otherwise your application will not be compiled. If you have OpenEmbedded installed in your system you could simply bitbake the external dependencies (in our example ''bitbake jpeg'') and then compile your application. Instead if you rely on the CodeSourcery toolchain you need to follow these steps:
# Execute the script <code>config.bat</code> and follow the installation; beware that this need to be done only once. The script will ask you to modify the registry, this is fine (used to save application preferences).
# download the sources of the library
# Connect the robot to the computer; the COM port will be created.
# cross-compile the library
# Run the application <code>AVR Burn-O-Mat.exe</code>; you need to configure the port to communicate with the robot:
# install the library (and include files) in the right places
## click on <code>Settings => AVRDUDE</code>
# compile your application
## in the <code>AVRDUDE Options</code>, on <code>Port</code> enter the name of the port just created when the robot was connected to the computer (e.g. COM10); then click <code>Ok</code>
# In the <code>Flash</code> section search the hex file you want to upload on the robot.
# Turn on the robot, wait the blinks terminate and then click on <code>Write</code> in the <code>Flash</code> section.
# During the programming the robot will blink; at the end you'll receive a message saying <code>Flash succesfully written.</code>


====Mac OS X====
==Ground sensor==
The following procedure is tested in Max OS X 10.10, but should work from Mac OS X 10.9 onwards; in these versions there is built-in support for the FTDI devices.
It's possible to use contemporaneously both the e-puck extension for gumstix overo and the ground sensor; in this case the camera and the ground sensor will share the same I2C bus and like the camera, also the ground sensor will not be anymore reachable from the e-puck side, but only from the overo side. <br/>
# Download the [http://projects.gctronic.com/elisa3/programming/AVR8-Burn-O-Mat-MacOsX.zip Mac OS X package] and extract it.
The I2C bus is configured to work at 400 KHz in the system running on the gumstix overo, thus we need to change the bus speed to 100 KHz in order to communicate with the ground sensor module; the simplest way is to set a kernel parameter in u-boot:
# Execute the script <code>config.sh</code> in the terminal, it will ask you to install the Java Runtime Environment; in case there is a problem executing the script try with <code>chmod +x config.sh</code> and try again. Beware that this need to be done only once.
# enter u-boot by pressing any key at boot start
# Connect the robot to the computer; the serial device will be created (something like <code>/dev/tty.usbserial-AJ03296J</code>).
# type the command <code>setenv i2cspeed 3,100</code>; this init the I2C bus 3 to 100 KHz
# Run the application <code>AVR Burn-O-Mat</code>; you need to configure the port to communicate with the robot:
# type the command <code>setenv mmcargs setenv bootargs console=${console} i2c_bus=${i2cspeed} ${optargs} mpurate=${mpurate} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype} </code>; basically we pass an additional parameter to the kernel that is the <code>i2c_bus=${i2cspeed}</code>
## click on <code>Settings => AVRDUDE</code>
# type the command <code>saveenv</code> to save the environment changes
## in the <code>AVRDUDE Options</code>, on <code>Port</code> enter the name of the port just created when the robot was connected to the computer; then click <code>Ok</code>
# type <code>boot</code> to start booting
# In the <code>Flash</code> section search the hex file you want to upload on the robot.
Pay attention that all the peripherals connected to the bus will now work at 100 KHz, thus also the e-puck camera and the LSM330 (accelerometer + gyroscope) present with e-puck HwRev 1.3.<br/>
# Turn on the robot, wait the blinks terminate and then click on <code>Write</code> in the <code>Flash</code> section.
If you want to set back the bus speed to 400 KHz you need to follow steps 2-4, by setting the <code>i2cspeed</code> u-boot environment variable with <code>setenv i2cspeed 3,400</code>.<br/>
# During the programming the robot will blink; at the end you'll receive a message saying <code>Flash succesfully written.</code>
Communicating with the ground sensor is as easy as open a device and reading from it; a source code example can be found in the following link [http://projects.gctronic.com/Gumstix/groundsensor.c http://projects.gctronic.com/Gumstix/groundsensor.c]. You will find this application example in the <code>/home/root/demos/gumstix-common</code> directory; start it by executing <code>./i2c_groundsensors</code> and the sensors values will be displayed in the terminal.<br/>
Make sure that you have installed the last system update otherwise you'll encounter some problems.<br/>
You can find more information about the I2C and gumstix in the following links:
* [http://wiki.gumstix.org/index.php?title=I%C2%B2C http://wiki.gumstix.org/index.php?title=I%C2%B2C]
* [http://wiki.gumstix.org/index.php?title=Category:How_to_-_i2c http://wiki.gumstix.org/index.php?title=Category:How_to_-_i2c]
* [http://108.163.188.242/~jumpnowt/index.php?option=com_content&view=article&id=69&Itemid=78 http://108.163.188.242/~jumpnowt/index.php?option=com_content&view=article&id=69&Itemid=78]
<!--
===Examples===
====Images transfer (serial line)====
The application "transfer_images" running on the Gumstix Overo COM performs a request of a variable number of images to the e-puck and transfers them over either TCP or UDP to a server machine (a connection must be configured on both sides before running this program). For more information on the usage refers to the help (-h option). This demo works with the ''advanced sercom'' protocol, so the new e-puck firmware must be already charged and selector 10 must be chosen.<br/>
In order to compile the application the Makefile must be modified specifying the path to the cross-compiler (for more information on cross-compilation for the OMAP3530 processor refers to [http://focus.ti.com/docs/prod/folders/print/omap3503.html http://focus.ti.com/docs/prod/folders/print/omap3503.html]).
[[image:ImageReceiver.jpeg|thumb|Image receiver application.]]
The application "ImageReceiver" running on the server machine is used to visualize the images received from the e-puck. <br/>
The usage is very simple: the server listening port and the protocol must be first selected and then the button "Connect" clicked; at this moment the application is waiting images.
The application is a Qt project, so the compilation may be handled easily with [http://www.qtsoftware.com/products/developer-tools Qt Creator]; alternatively [http://doc.trolltech.com/4.2/qmake-manual.html qmake] can be used.


====Linux====
It's worth to note that the server application must be started before sending images, thus the "ImageReceiver" application must be first executed on the PC side, and the "transfer_images" application must be then executed on the Gumstix Overo side.
The following procedure was tested in Ubunut 12.04, but a similar procedure can be followed in newer systems and other Linux versions.<br/>
You can find a nice GUI for <code>avrdude</code> in the following link [http://burn-o-mat.net/avr8_burn_o_mat_avrdude_gui_en.php http://burn-o-mat.net/avr8_burn_o_mat_avrdude_gui_en.php]; you can download directly the application for Ubuntu from the following link [http://projects.gctronic.com/elisa3/programming/avr8-burn-o-mat-2.1.2-all.deb avr8-burn-o-mat-2.1.2-all.deb].<br/>
Double click the package and install it; the executable will be <code>avr8-burn-o-mat</code>.<br/>
Beware that the application requires the Java SE Runtime Environment (JRE) that you can download from the official page [http://www.oracle.com/technetwork/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/index.html], alternatively you can issue the command <code>sudo apt-get install openjdk-8-jre</code> in the terminal.


The application need a bit of configuration, follow these steps:
[http://www.gctronic.com/doc/images/Image_transfer.tar Download Transfer images (Linux)] <br/>
:1. connect the robot to the computer, the serial device will be created (something like /dev/USB0)
[http://www.gctronic.com/doc/images/Image_receiver.tar Download Image receiver (Linux)]
:2. to use the USB port the permissions need to be set to read and write issueing the command <code>sudo chmod a+rw /dev/ttyUSB0</code>
:3. start the application and click on <code>Settings => AVRDUDE</code>
:4. set the location of <code>avrdude</code> and the related configuration file (refer to the previous section when <code>avrdude</code> was installed to know the exact location); the configuration file is in <code>/etc/avrdude.conf</code>
:3. click <code>OK</code>, close the application and open it again (this is needed to load the configuration file information); click on <code>Settings => AVRDUDE</code>
:4. select <code>stk500v2</code> as the <code>Programmer</code>
:5. set the serial port connected to the robot (<code>/dev/ttyUSB0</code>)
:6. in <code>additional options</code> insert <code>-b 57600</code>, you will end up with a window like the following one:
<span class="plainlinks">[http://www.gctronic.com/doc/images/avrdude-gui.png <img width=400 src="http://www.gctronic.com/doc/images/avrdude-gui-small.png">]</span>
:7. click <code>OK</code>; select <code>ATmega2560</code> in the <code>AVR type</code>
:8. in the <code>Flash</code> section search the hex file you want to upload on the robot; select <code>Intel Hex</code> on the right
:9. connect the robot to the computer, turn on the robot, wait the blinks terminate and then click on <code>Write</code> in the <code>Flash</code> section
:10. during the programming the robot will blink; at the end you'll receive a message saying <code>Flash succesfully written.</code>


====Command line====
====Images grabbing (serial line)====
The [http://www.ladyada.net/learn/avr/setup-win.html avrdude] utility is used to do the upload, you can download it directly from the following links depending on your system:
This application, running on the Overo COM, requests to the e-puck a customizable number of images that can be parametrized by size, zoom factor, type (gray-scale or color) and window position and save them as bmp; for more information on the usage refers to the help (-h option). This demo works with the ''advanced sercom'' protocol, so the new e-puck firmware must be already charged and selector 10 must be chosen.<br/>
* [http://projects.gctronic.com/elisa3/programming/WinAVR-20100110-install.exe Windows]; <code>avrdude</code> will be installed in the path <code>C:\WinAVR-20100110\bin\avrdude</code>; avrdude version 5.10
In order to compile the application the Makefile must be modified specifying the path to the cross-compiler like with the "Images transfer" application.
* [http://projects.gctronic.com/elisa3/programming/CrossPack-AVR-20131216.dmg Mac OS X]; <code>avrdude</code> will be installed in the path <code>/usr/local/CrossPack-AVR/bin/avrdude</code>; to check the path issue the commmand <code>which avrdude</code> in the terminal; avrdude version 6.0.1
* Ubuntu (12.04 32-bit): issue the command <code>sudo apt-get install avrdude</code> in the terminal; <code>avrdude</code> will be installed in the path <code>/usr/bin/avrdude</code>; to check the path issue the commmand <code>which avrdude</code> in the terminal; avrdude version 5.11.1


Open a terminal and issue the command <code>avrdude -p m2560 -P COM10 -b 57600 -c stk500v2 -D -Uflash:w:Elisa3-avr-studio.hex:i -v</code><br/>
[http://www.gctronic.com/doc/images/GrabCustomImages.tar Download Grab custom images (Linux)]
where <code>COM10</code> must be replaced with your com port and <code>Elisa3-avr-studio.hex</code> must be replaced with your application name; in Mac OS X the port will be something like <code>/dev/tty.usbserial-...</code>, in Ubuntu will be <code>/dev/ttyUSB0</code>.<br/>
The [http://www.gctronic.com/doc/index.php/Elisa-3#Basic_demo Basic demo] and [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo Advanced demo] have this command contained in the file <code>program.bat</code> in the <code>default</code> directory within the project, this can be useful for Windows users.<br/>


===Internal EEPROM===
-->
The internal 4 KB EEPROM that resides in the microcontroller is pre-programmed with the robot ID in the last two bytes (e.g. if ID=3200 (0x0C80), then address 4094=0x80 and address 4095=0x0C). The ID represents also the RF address that the robot uses to communicate with the computer and is automatically read at startup (have a look a the firmware for more details).<br/>
Moreover the address 4093 is used to save the clock calibration value that is found during production/testing of the robots; this value hasn't to be modified otherwise some functionalities such as tv remote control could not work anymore. For more information on clock calibration refers to the applicaiton note [http://projects.gctronic.com/elisa3/AVR053-Calibration-RC-oscillator.pdf AVR053: Calibration of the internal RC oscillator].<br/>
The Elisa-3 robot supports an autonomous calibration process and the result of this calibration is saved in EEPROM starting at address 3946 to 4092.<br/>
<font style="color:red">'''The size of usable EEPROM is thus 3946 bytes (0-3945) and the remaining memory must not be modified/erased.'''</font>


In order to program the eeprom an AVR programmer is required, we utilize the Pocket AVR Programmer from Sparkfun (recognized as USBtiny device); then with the [http://www.ladyada.net/learn/avr/setup-win.html avrdude] utility the following command has to be issued:
==OpenCV==
The Open Computer Vision Library has more than 500 algorithms, documentation and sample code for real time computer vision; you can download it from [http://sourceforge.net/projects/opencvlibrary/ http://sourceforge.net/projects/opencvlibrary/], and find information about it from the official wiki [http://docs.opencv.org/index.html http://docs.opencv.org/index.html]. <br/>
The released system comes with OpenCV version 2.0.0 pre-installed and a demo that shows an example of what can be performed with this library. The demo let the robot follow a black filled circle placed in front of it; if the circle is moved right or left the robot turns consequently. The following figure shows an example of the circle detected by the robot:<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/circle-detection.jpg <img width=200 src="http://www.gctronic.com/doc/images/circle-detection.jpg">]</span> <br/>
In order to start the demo follows these steps:
# turn on the robot with the gumstix extension and login as ''root'' with password ''root''
# go to the directory ''/home/root/demos/gumstix-common'' and execute ''./v4l2grab-opencv -o image.jpg''
# the demo should return the number of circles detected and save a resulting image showing the circles detected if any
Alternatively you can use the following script, that launches the demo and send it through serial (using zmodem) iteratively:
<pre>
<pre>
avrdude -p m2560 -c usbtiny -v -U eeprom:w:Elisa3-eeprom.hex:i -v -B 1
#!/bin/bash
while true; do
./v4l2grab-opencv -o image.jpg -q 50
lsz img1.jpg
done
</pre>
</pre>
where ''Elisa3-eeprom.hex'' is the EEPROM memory saved as Intel Hex format ([http://projects.gctronic.com/elisa3/Elisa3-eeprom.hex eeprom example]); a possible tool to read and write Intel Hex format is [http://projects.gctronic.com/elisa3/G32setup_12004-intel-hex-editor.exe Galep32 from Conitec Datensysteme].<br/>
Alternatively a program designed to writing to these EEPROM locations can be uploaded to the robot, in case an AVR programmer isn't available. The project source can be downloaded from [http://projects.gctronic.com/elisa3/Elisa3-eeprom-write.zip Elisa3-eeprom-write.zip]; it is simply needed to modify the address, rebuild and upload to the robot.


===Bootloader===
The source code can be downloaded from the following link [http://projects.gctronic.com/Gumstix/v4l2grab-opencv-rev15.zip v4l2grab-opencv.zip].  
In case the bootloader of the Elisa-3 is erased by mistake, then you can restore it by using an AVR programmer. You can download the bootloader from here [http://projects.gctronic.com/elisa3/stk500v2-rev242-20.03.18.hex stk500v2.hex]; the source code is available here [http://projects.gctronic.com/elisa3/bootloader-stk500v2-rev242-20.03.18.zip bootloader-stk500v2.zip].<br/>
<code>Avrdude</code> can be used to actually write the bootloader to the robot with a command similar to the following one:<br/>
<code>avrdude -p m2560 -c stk500v2 -P COM348 -v -U lfuse:w:0xE2:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -V -U flash:w:stk500v2.hex:i -v -B 2</code><br/>
Here we used a programmer recognized as a serial device (port COM348) that utilizes the <code>stk500v2</code> protocol.


==Base-station==
<!--
This chapter explains informations that aren't needed for most of the users since the radio module is ready to be used and don't need to be reprogrammed. Only if you are interested in the firmware running in the radio module and on how to reprogram it then refer to section [http://www.gctronic.com/doc/index.php/Elisa#Base-station http://www.gctronic.com/doc/index.php/Elisa#Base-station] (chapter 4.2) of the Elisa robot wiki.
====Opencv-linux 1.1pre1 version====
OpenCV can be easily installed on the Gumstix Overo COM, following these steps:


==PC side==
:1. [http://sourceforge.net/projects/opencvlibrary/ Donwload] OpenCV.
This section gives informations related to the radio module connected to the computer; if you don't have a radio module you can skip this section.
:2. Extract the content (tar -xzvf opencv-1.1pre1.tar.gz) of the file in a directory, let it be in "opencv".
===Elisa-3 library===
:3. Open a terminal, and access the directory (cd path/to/opencv).
This library simplify the implementation of applications on the pc side (where the RF module is connected) that will take control of the robots and receive data from them. Some basic examples will be provided in the following sections to show how to use this library.<br/>
:4. Configure the environment in order to use the cross-compilation tools (if you installed OpenEmbedded, you can find these tools in /tmp/cross/bin/ within the OE main directory): <br/>
The project is built with [http://www.codeblocks.org/ Code::Blocks (mingw)] and requires [http://www.libusb.info libusb-1.0] since it is used to communicate with the radio base-station. The source code of the library can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-rev237-29.01.18.zip pc-side-elisa3-library], it includes <code>libusb-1.0.21</code>.<br/>
<pre>
export CC=/path_to_OE_home_dir/tmp/cross/bin/arm-angstrom-linux-gnueabi-gcc
export CXX=/path_to_OE_home_dir/tmp/cross/bin/arm-angstrom-linux-gnueabi-g++
</pre>
:5. Now configure OpenCV with the following command; in this configuration several packages are disabled (e.g. gtk) because useless when using console mode to work with the gumstix. Another important option is ''prefix'', which tell where the OpenCV library will be installed. For more information on the configuration refers to the help (--help).<br/>
<pre>
./configure --host=arm-linux --build=i686-linux --prefix=/install_dir_path/ --without-gthread --without-gtk --without-python --disable-apps
</pre>
:6. Type ''make'' and then ''make install''; the directory specified with the ''prefix'' options will contain the compiled library.
:7. Copy the content of this directory to the gumstix, for example in an external SD card.
:8. Before trying to execute an OpenCV based application, you must specify to the system where to find the OpenCV library; you can do this by typing the following command; alternatively it's possible to install directly the library in the /usr/lib directory in the system.
<pre>
export LD_LIBRARY_PATH=/path_to_OpenCV/lib
</pre>


Compilation on Windows:
A detailed tutorial on the OpenCV setup for Gumstix can be found in the following link [http://danielbaggio.blogspot.com/2009/01/compiling-opencv-for-gumstix.html Compiling OpenCV for Gumstix].
*  within the libusb-1.0 package you'll find the header "libusb.h" (under /include/libusb-1.0/) and the library "libusb-1.0.a" (in this case under /MinGW32/static/ since we use MinGW) that should be copied or referenced in the compiler headers/libraries
* add the linker flag "-lusb-1.0" in the project in order to build successfully
* the Code::Blocks project provided has already these configurations set <br/>


Compilation on Linux / Mac OS X:
====Later versions (> 1.1)====
* required libraries: libusb-1.0, libusb-1.0-dev, libncurses5, libncurses5-dev
It's possible to have the OpenCV framework available on your system in two ways:
* build: under the "/linux" folder within the project directory there is a makefile, simply type <code>make clean && make</code> on a terminal to build the library
:1. if OpenEmbedded and bitbake are already configured in the system you can simply type ''bitbake opencv'' and then install the libraries on the micro-sd of the overo
:2. if you have internet access from the overo you can use the package manager by typing ''opkg install opencv'' (it takes a while to complete)
-->


===Multiplatform monitor===
<!--
The demo is a command line monitor that shows all the sensors information (e.g. proximity, ground, acceleromter, battery, ...) and let the user move the robot and change its colors and behavior with the keyboard. The data are sent using the protocol described in the previous section. <br/>
Later versions of OpenCV (current is 2.0.0) rely on [http://www.cmake.org/ CMake], the cross-platform, open-source build system.You can install it in Ubuntu by typing ''sudo apt-get install cmake''; you can also install a nice front-end for CMake by typing ''sudo apt-get install cmake-gui''; in this way the configuration process of OpenCV becomes easier.<br>
The following figures show the monitor on the left and the available commands on the right. <br/>
Follow the steps afterwards to get the newer version of OpenCV compiled for the gumstix:
<span class="plainlinks">[http://www.gctronic.com/doc/images/Cmd-line-monitor.jpg <img width=400 src="http://www.gctronic.com/doc/images/Cmd-line-monitor.jpg">]</span>
:1. [http://sourceforge.net/projects/opencvlibrary/ Donwload] OpenCV.
<span class="plainlinks">[http://www.gctronic.com/doc/images/Pc-side-commands2.jpg <img width=400 src="http://www.gctronic.com/doc/images/Pc-side-commands2.jpg">]</span>
:2. Extract the content (tar -xzvf opencv-2.0.0.tar.gz) of the file in a directory, let it be in "opencv".
<br/>
:3. Start the CMake interface, by typing in a terminal ''cmake-gui''.
:4. ...to be finished!
-->


The project is built with [http://www.codeblocks.org/ Code::Blocks (mingw)] and requires the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library]. <br/>
==Accelerometer and gyroscope (e-puck HWRev 1.3)==
The source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-1-robot-rev238-29.01.18.zip pc-side single robot]. <br/>
When the e-puck extension for gumstix overo is mounted on the e-puck hardware revision 1.3 the same I2C bus is shared by all the devices (camera, accelerometer, gyroscope) and the overo; since there is only one master (the overo) these devices will not be anymore reachable from the e-puck side. <br/>
The I2C bus is configured to work at 400 KHz in the system running on the gumstix overo and this is fine to work with the accelerometer and gyroscope. <br/>
Communicating with the accelerometer and gyroscope is as easy as open a device and reading from it; a source code example can be found in the following link [http://projects.gctronic.com/Gumstix/i2c_lsm330.c i2c_lsm330.c]. You will find this application example in the <code>/home/root/demos/gumstix-common</code> directory; start it by executing <code>./i2c_lsm330</code>, type <code>0</code> to get the accelerometer values or <code>1</code> to get the gyroscope values printed on the terminal.<br/>
The values of the accelerometer and gyroscope read from the gumstix through the I2C are 16 bits (1g = 16384); beware that regarding the accelerometer values there is a mismatch between the values read from the gumstix through I2C and the values read from the [{{fullurl:Advanced sercom protocol}} advanced sercom protocol] through Bluetooth, the latter are converted in the firmware to maintain compatibility with older e-puck hardware revisions.<br/>
The orientation of the accelerometer for the values read from the gumstix through the I2C is also different from the one used in the e-puck firmware; the orientation is shown below, the x axis points forward, the y axis points left and the z axis points upward:<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/epuck-acc-directions1.3.png <img width=150 src="http://www.gctronic.com/doc/images/epuck-acc-directions1.3.png">]</span><br/>
===Python===
An example in python is available from the following link [http://projects.gctronic.com/Gumstix/i2c_lsm330.py i2c_lsm330.py]. In order to run the script, some additional dependencies need to be installed in the system, follow these steps:
# configure the network in order to have internet access
# update the package manager repos:
##<code>echo 'src/gz base http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/' > /etc/opkg/base-feed.conf</code>
##<code>echo 'src/gz python http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/python/' > /etc/opkg/python-feed.conf</code>
# add <code>arch armv7a-vfp-neon 45</code> to the file <code>/etc/opkg/arch.conf</code>
# <code>opkg update</code>
# <code>opkg -force-overwrite install python-smbus</code>
# optionally you can also remove some warnings related to the update by running the following script [http://projects.gctronic.com/omnicam/remove-warnings.sh remove-warnings.sh]
Once the system is configured you can start the script by executing <code>python i2c_lsm330.py</code>, type <code>0</code> to get the accelerometer values or <code>1</code> to get the gyroscope values printed on the terminal.<br/>


====Windows====
==ROS==
Execution:
We tested ROS on the gumstix extension with the Yocto system. Follow these steps to get ROS running on the e-puck extension:
* install the driver contained in the [http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-Studio nRFgo Studio tool] if not already done; this let the base-station be recognized as a WinUSB device (bootloader), independently of whether the libusb library is installed or not
:1. prepare a micro sd following the instructions from [http://gumstix.org/create-a-bootable-microsd-card.html http://gumstix.org/create-a-bootable-microsd-card.html]
* once the driver is installed, the pre-compiled "exe" (under <code>\bin\Release</code> dir) should run without problems; the program will prompt you the address of the robot you want to control
:2. download the file system and fat from the following links: [http://projects.gctronic.com/Gumstix/yocto-ros-3.5.7-FAT.tar.gz yocto-ros-3.5.7-FAT.tar.gz], [http://projects.gctronic.com/Gumstix/yocto-ros-3.5.7-rootfs.tar.gz yocto-ros-3.5.7-rootfs.tar.gz]
:3. login with user=root and empty password
:4. issue the following commands to enable the WiFi dongle:
::<code>echo host > /sys/bus/platform/devices/musb-hdrc/mode</code>
::<code>echo -n 1 > /sys/bus/usb/devices/2-1/bConfigurationValue</code>
:5. follow the instructions from [https://github.com/gumstix/yocto-manifest/wiki/ROS-on-Gumstix#the-fun-part https://github.com/gumstix/yocto-manifest/wiki/ROS-on-Gumstix#the-fun-part] to run a demo
<!--
We tested ROS on the gumstix extension with the Yocto pre-built system. Follow these steps to get ROS running on the e-puck extension:
:1. download the Yocto pre-built image from [https://www.gumstix.com/software/software-downloads/ https://www.gumstix.com/software/software-downloads/] (Overo Series COMs)
:2. prepare a micro sd following the instructions from [http://gumstix.org/create-a-bootable-microsd-card.html http://gumstix.org/create-a-bootable-microsd-card.html]
:3. configure the network settings in order to get internet access (at the moment you need to plug the WiFi dongle on the USB host)
:4. follow the instructions from [https://github.com/gumstix/yocto-manifest/wiki/ROS-on-Gumstix#one-time-on-system-setup https://github.com/gumstix/yocto-manifest/wiki/ROS-on-Gumstix#one-time-on-system-setup] (skip step 1)
If you prefer you can directly download the file system and fat from the following links: [http://projects.gctronic.com/Gumstix/yocto-ros-3.5.7-FAT.tar.gz yocto-ros-3.5.7-FAT.tar.gz], [http://projects.gctronic.com/Gumstix/yocto-ros-3.5.7-rootfs.tar.gz yocto-ros-3.5.7-rootfs.tar.gz].
-->


Compilation:<br/>
==Python==
the Code::Blocks project should already be setup to reference the Elisa-3 library headers and lib files, anyway you need to put this project within the same directory of the Elisa-3 library, e.g. you should have a tree similar to the following one:
In order to install python 2.6 on the e-puck extension for Gumstix follow these steps:
* Elisa-3 demo (parent dir)
# download the package [http://projects.gctronic.com/Gumstix/python-gumstix.tar.gz python-gumstix.tar.gz]
** pc-side-elisa3-library (Elisa-3 library project)
# extract the package: <code>tar -zxvf python-gumstix.tar.gz</code>
** pc-side-elisa3-library-1-robot (current project)
# remove the micro sd from the robot and connect it to your computer; two partitions will be opened, one called <code>FAT</code> and the other called <code>overo</code> containing the file system (the partitions name could be a little different)
# copy the content of the decompressed file to the same position in the <code>overo</code> partition:
##<code>sudo cp -R /python-gumstix/usr/lib/* /overo/usr/lib</code>
##<code>sudo cp /python-gumstix/usr/bin/* /overo/usr/bin</code>


====Linux / Mac OS X====
Alternatively if you have access to internet you can use the package manager:
The project was tested to work also in Ubuntu and Mac OS X (no driver required). <br/>
# <code>opkg install python</code>
Compilation:
# <code>opkg install python-modules</code>
* you need to put this project within the same directory of the Elisa-3 library
# <code>opkg install python-pyserial</code>
* build command: go under "linux" dir and type <code>make clean && make</code>
Execution:
* <code>sudo ./main</code>


===Communicate with 4 robots simultaneously===
In order to test your python installation you can download the following script [http://projects.gctronic.com/Gumstix/printhelp.py printhelp.py]; execute it by typing <code>python printhelp.py</code>.
This example shows how to interact with 4 robots simlutaneously, basically it shows the sensors information (proximity and ground) coming from 4 robots and let control one robot at a time through the keyboard (you can change the robot you want to control). The project requires the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library]; the source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-4-robots-rev166-18.06.14.zip pc-side 4 robots]. For building refer to the section [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor Multiplatform monitor].
This is a minimal example of serial communication in python that let the gumstix communicate with the robot; basically it opens a serial connection with the robot and ask the available commands that you can use to get sensors data and change actuators state.<br/>
Another example is available here [http://projects.gctronic.com/Gumstix/getprox.py getprox.py]; in this script the values of the proximities are requested to the robot and printed to the console. The data are requested in binary format, for more information about the communication protocol refer to the section [http://www.gctronic.com/doc/index.php/Overo_Extension#Advanced_sercom advanced sercom].


===Obstacle avoidance===
=Configuration=
This demo implements the ''obstacle avoidance'' behavior controlling the robot from the pc through the radio; this means that the robot reacts only to the commands received using the basic communication protocol and has no intelligence onboard. The demo uses the information gathered from the 3 front proximity sensors and set the motors speed accordingly; moreover the rgb leds are updated with a random color at fixed intervals. <br/>
==Graphic mode==
The project requires the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library]; the source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-obstacle-avoidance-rev167-18.06.14.zip pc-side-obstacle-avoidance]. For building refer to the section [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor Multiplatform monitor]. <br/>
The resolution of the monitor can be modified in the u-boot command line, that can be entered at booting. In the u-boot command line type:
The following video shows the result: <br/>
<pre>
{{#ev:youtube|F_b1TQxZKos}}
setenv dvimode "1280x720MR-16@60"
saveenv
boot
</pre>
Now the configuration is saved in the flash; if your monitor doesn't support the current resolution, repeat the procedure with a different configuration (change the resolution numbers).


It is available also the same example but with 4 robots controlled simultaneously; the source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-obstacle-avoidance-4-robots-rev168-18.06.14.zip pc-side-obstacle-avoidance-4-robots]<br/>
Note that the DVI Controller ([http://projects.gctronic.com/Gumstix/tfp410.pdf TFP410]) mounted on Summit and Tobi supports resolutions from VGA (640x480) to UXGA (1600x1200).
It is easy to extend the previous example in order to control many robots, here is the code that controls 8 robots simultaneously [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-obstacle-avoidance-8-robots-rev169-18.06.14.zip pc-side-obstacle-avoidance-8-robots].


===Cliff avoidance===
Useful files to look at:
This demo implements the ''cliff avoidance'' behavior controlling the robot from the pc through the radio; as with the ''obstacle avoidance'' demo,  the robot reacts only to the commands received from the radio. The demo uses the information gathered from the 4 ground sensors to stop the robot when a cliff is detected (threshold tuned to run in a white surface); moreover the rgb leds are updated with a random color at fixed intervals. <br/>
* linux_source_home/drivers/video/modedb.c: explains what's the mean of the dvimode names
The project requires the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library]; the source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-cliff-avoidance-rev170-18.06.14.zip pc-side-cliff-avoidance]. For building refer to the section [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor Multiplatform monitor]. <br/>
* linux_source_home/Documentation/fb/viafb.modes: list of available modes usable with the ''fbset'' tool
The following video shows the result: <br/>
{{#ev:youtube|uHy-9XXAHcs}}


===Set robots state from file===
==GPIO - pins mode==
This project show how to send data to robots for which we will know the address only at runtime, in particular the content of the packets to be transmitted is parsed from a csv file and the interpreted commands are sent to the robots one time. The project requires the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library]; the source can be downloaded from [http://projects.gctronic.com/elisa3/pc-side-elisa3-library-from-file-rev174-18.06.14.zip pc-side from file]. For building refer to the section [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor Multiplatform monitor]. <br/>
There are three different ways to read GPIO lines:
:1. Kernel space: GPIO lines handled through an API
:2. User space:
::2.1. standard filesystem commands like ''cat'' and ''echo'' (static configuration)
::2.2 direct physical memory access using ''devmem2'' or with a C application (dynamic configuration)


=Odometry=
Afterward will be explained how to handle the GPIO lines on the Gumstix Overo COM in all different methods; information about this topic were found from various sites, but especially from the [http://sourceforge.net/p/gumstix/mailman/ mailing list]. Moreover for a general howto on GPIO refers to the linux documentation [https://www.kernel.org/doc/Documentation/gpio/gpio.txt "KernelSrc/Documentation/gpio.txt"].
The odometry of Elisa-3 is quite good even if the speed is only measured by back-emf. On vertical surfaces the absolute angle is given by the accelerometer measuring g... quite a fix reference without drifting ;-)<br/>
A fine calibration of the right and left wheel speed parameters might give better results.
However the current odometry is a good estimate of the absolute position from a starting point.
The experiments are performed on a square labyrinth and the robot advances doing obstacle avoidance. The on-board calculated (x,y,theta) position is sent to a PC via radio and logged for further display.<br/>
<span class="plainlinks">[http://www.gctronic.com/img/odometry-vertical.jpg <img width=400 src="http://www.gctronic.com/img/odometry-vertical-small2.jpg">]</span> <br/>
Details about the code can be found in the [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo advanced-demo] project, in particular the ''motors.c'' source file. The PC application used for logging data is the [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor_.28pc_side.29 monitor].
==Autonomous calibration==
Since the motors can be slightly different a calibration can improve the behavior of the robot in terms of maneuverability and odometry accuracy.
An autonomous calibration process is implemented onboard: basically a calibration is performed for both the right and left wheels in two modes that are forward and backward with speed control enabled. In order to let the robot calibrate istelf a white sheet in which a black line is drawed is needed; the robot will measure the time between detection of the line at various speeds. The calibration sheet can be downloaded from the following link [http://projects.gctronic.com/elisa3/calibration-sheet.pdf calibration-sheet.pdf]. <br/>
In order to accomplish the calibration the robot need to be programmed with the [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo advanced firmare] and a specific command has to be sent to the robot through the radio module or the TV remote; if you are using the radio module you can use the [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor_.28pc_side.29 monitor application] in which the letter ''l (el)'' is reserved to launch the calibration, otherwise if you have a TV remote control you can press the button ''5''.
The sequence is the following:<br/>
1. put the selector in position 8<br/>
2. place the robot near the black line as shown below; the left motor is the first to be calibrated. Pay attention to place the right wheel as precise as possible with the black line<br/>
[http://www.gctronic.com/doc/images/elisa3-calibration-1.jpg <img width=300 src="http://www.gctronic.com/doc/images/elisa3-calibration-1_small.jpg">]
[http://www.gctronic.com/doc/images/elisa3-calibration-2.jpg <img width=300 src="http://www.gctronic.com/doc/images/elisa3-calibration-2_small.jpg">]<br/>
3. once the robot is placed  you can type the ''l (el)'' command (or press the button ''5''); wait a couple of minutes during which the robot will do various turns at various speed in the forward direction and then in the backward direction<br/>
4. when the robot terminated (robot is stopped after going backward at high speed) you need to place it in the opposite direction in order to calibrate the right motor, as shown below.<br/>
[http://www.gctronic.com/doc/images/elisa3-calibration-3.jpg <img width=300 src="http://www.gctronic.com/doc/images/elisa3-calibration-3_small.jpg">]<br/>
5. once the robot is placed you can type again the ''l (el)'' command (or press the button ''5'')<br/>
6. when the robot finish, the calibration process is also terminated.<br/>


The previous figures show a robot without the top diffuser, anyway you don't need to remove it!
===Kernel space===


=Tracking=
===User space===
==Assembly documentation==
====Static configuration====
You can download the documentation from here [http://projects.gctronic.com/elisa3/tracking-doc.pdf tracking-doc.pdf].<br/>
Each of the microprocessor IO pins can be configured to work in different ways for different purposes; in case we desire a certain pin to be configured as a gpio line, we must modify the function assigned to that pin (mux configuration) in the U-Boot board configuration file, that for the Gumstix Overo COM is located at "U-BootSrc/board/overo/overo.h". <!-- you can have a look at it [http://www.sakoman.net/cgi-bin/gitweb.cgi?p=u-boot-omap3.git;a=blob;f=board/overo/overo.h;h=4c7ac27fa6818d4f474bc42330134fd0a5520a37;hb=HEAD here].--> <br/>
Have a look also at the video:<br/>
{{#ev:youtube|92pz28hnteY}}<br/>


==SwisTrack==
To know which modes are available for the pins consult the chapter ''7-System Control Module'' (more specifically ''7.4.4-Pad Functional Multiplexing and Configuration'') in the [http://projects.gctronic.com/Gumstix/omap35xx-TRM.pdf OMAP35x TRM]. <br/>
Some experiments are done with the [https://en.wikibooks.org/wiki/SwisTrack SwisTrack software] in order to be able to track the Elisa-3 robots through the back IR emitter, here is a resulting image with 2 robots:<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/elisa-3-tracking-2robots.jpg <img width=300 src="http://www.gctronic.com/doc/images/elisa-3-tracking-2robots-small.jpg">]</span><br/>
The pre-compiled SwisTrack software (Windows) can be downloaded from the following link [http://projects.gctronic.com/elisa3/SwisTrackEnvironment-10.04.13.zip SwisTrack-compiled]. <!--; it contains also the configuration for the Elisa-3 named ''elisa-3-usb.swistrack''.<br/> -->
<!--
We used the ''Trust Spotlight Pro'' webcam, removed the internal IR filter and placed an external filter that let trough the red-IR wavelength. This filter configuration eases the tracking of the robots. The camera parameters (brightness=-64, contrast=0, saturation=100, gamma=72, gain=0) where tuned to get the best possible results, if another camera would be used a similar tuning has to be done again.
-->


The following video shows the tracking of 5 robots:<br/>
Assume we want to have the possibility to switch on and off a led attached to the line gpio70; in order to accomplish this task, we need to follow these steps:
{{#ev:youtube|33lrIUux_0Q}}<br/>
The SwisTrack software lets you easily log also the resulting data that you can then elaborate, here is an example taken from the experiment using 5 robots:<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/swistrack-output.jpg <img width=300 src="http://www.gctronic.com/doc/images/swistrack-output-small.jpg">]</span><br/>


The following video shows the test done with 20, 30 and 38 Elisa-3 robots, the tracking is still good; it's important to notice that we stopped to 38 Elisa-3 robots because are the ones we have in our lab.<br/>
:'''1.''' Modify the board configuration file "overo.h" specifying that the pin has to behave as a gpio line:
{{#ev:youtube|5LAccIJ9Prs}}<br/>
<pre>
MUX_VAL(CP(DSS_DATA0), (IDIS | PTU | DIS | M4)) /*DSS_DATA0 => GPIO70*/\
</pre>
:*IDIS = input disable, namely output pin
:*PTU = pull type up, but could be also PTD (pull type down) because of the third parameter
:*DIS = disable pull type up/down
:*M4 = mode 4 (gpio)
:This give us a GPIO pin that is output and not pulled up or down.
:'''2.''' Build U-Boot and place the generated ''u-boot.bin'' image in the flash ([http://www.gumstix.org/how-to/70-writing-images-to-flash.html Writing images to onboard nand]) or in a micro sd card ([http://www.gumstix.org/create-a-bootable-microsd-card.html Creating a bootable microSD card])
:'''3.''' After login, we can see all the GPIO pins that have been exported by the kernel to userspace in the /sys/class/gpio/ directory. In order to access the gpio70 line, we should export it first, by typing:
<pre>
echo "70" > /sys/class/gpio/export
</pre>
:Now the following line is active /sys/class/gpio/gpio70.
:'''4.''' At this point we must configure the direction of the exported line and set a logical value (1 or 0) to that line, we can do that by typing:
<pre>
echo "high" > /sys/class/gpio/gpio70/direction
</pre>
:This command set the pin in output and give it a value of 1.
:'''5.''' Finally we can switch on or off the led, by setting the value of the gpio line:
<pre>
echo "value" > /sys/class/gpio/gpio70/value
</pre>
:Where value=1 means switch on, and value=0 means switch off.


==Position control==
We developed a simple position control example that interacts with Swistrack through a TCP connection and control 4 robots simultaneously; the orientation of the robots is estimated only with the Swistrack information (delta position), future improvements will integrate odometry information. The following video shows the control of 4 robots that are driven in a ''8-shape''.<br/>
{{#ev:youtube|ACaGNEQHayc}}<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/tracking-8shape.jpg <img width=300 src="http://www.gctronic.com/doc/images/tracking-8shape-small.jpg">]</span><br/>
All the following projects require the [http://www.gctronic.com/doc/index.php/Elisa-3#Elisa-3_library Elisa-3 library], for building refer to the section [http://www.gctronic.com/doc/index.php/Elisa-3#Multiplatform_monitor Multiplatform monitor].


* Horizontal position control (4 robots): the source code can be downloaded from [http://projects.gctronic.com/elisa3/position-control-pattern-horizontal-4-robots-rev198-02.07.14.zip position-control-pattern-horizontal-4-robots.zip] (Code::Blocks project).<br/>
In order to automate the process of creating a gpio line accessible through "/sys/class/gpio/", we must modify the board configuration file in the kernel source; this file can be found in "KernelSrc/arch/arm/mach-omap2/board-overo.c" (and related definitions in "KernelSrc/arch/arm/plat-omap/include/mach/board-overo.h"). These files must contain instructions to initialize the gpio line that we want to export in user space and set their direction and initial value. <br/>
One of the characteristics of the Elisa-3 robot is that it can move in vertical thanks to its magnetic wheels, thus we developed also a vertical position control that use accelerometer data coming from the robot to get the orientation of the robot (more precise) instead of estimating it with the Swistrack information, you can download the source code from the following link:
Consider the previous example in which we would like to control a led with the gpio70 pin; for this purpose the following instructions must be added in the board configuration file ''board.overo.c'' within the ''overo_init'' function:
* Vertical position control (4 robots): [http://projects.gctronic.com/elisa3/position-control-pattern-vertical-4-robots-rev199-02.07.14.zip position-control-pattern-vertical-4-robots.zip] (Code::Blocks project).<br/>
<pre>
We developed also an example of position control that control a single robot (code adapted from previous example) that can be useful during the initial environment installation/testing; you can download the source code from the following link:
if ((gpio_request(70, "OVERO_GPIO_DD00") == 0) && (gpio_direction_output(70, 1) == 0)) {
* Horizontal position control (1 robot): [http://projects.gctronic.com/elisa3/position-control-pattern-horizontal-1-robot-rev197-02.07.14.zip position-control-pattern-horizontal-1-robot.zip] (Code::Blocks project).<br/>
gpio_export(70, 0);
Another good example to start playing with the tracking is an application that lets you specify interactively the target point that the robot should reach; you can download the source code of this application from the following link:
gpio_set_value(70, 1); //not really needed, the initial output value is set with gpio_direction_output
* Go to target point: [http://projects.gctronic.com/elisa3/position-control-goto-pos-horizontal-1-robot-rev196-02.07.14.zip position-control-goto-pos-horizontal-1-robot.zip] (Code::Blocks project).<br/>
} else {
printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_DD00\n");
}
</pre>
After this modification we need to build the kernel and copy it to the flash or micro sd card, and after login we will have the /sys/class/gpio/gpio70 line automatically active.<br/>
For more information on the previous snippet code refers to [https://www.kernel.org/doc/Documentation/gpio/gpio.txt "KernelSrc/Documentation/gpio.txt"].


==Utilities==
<!--
In order to adjust the IR camera position it is useful to have an application that turn on the back IR of the robots. The following application [http://projects.gctronic.com/elisa3/back-IR-on-4-robots-rev182-30.06.14.zip back-IR-on-4-robots-rev182-30.06.14.zip] is an example that turn on the back IR of 4 robots, their addresses are asked to the user at the execution.
Read a value
Set a pin in input
-->


=Local communication=
====Dynamic configuration====
{{#ev:youtube|7bxIR0Z3q3M}}<br/>
If you aren't familiar with modifying and building U-Boot and kernel, you would probably choose to modify the pin configuration at runtime, without the need to touch any board configuration file. The only way to change the configuration of the pins is to access directly the physical memory of the microprocessor, in particular its configuration registers. <br/>
The [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo advanced firmware] is needed in order to use the local communication. You can find some examples on how to use this module in the main, refers to demos in selector position from 11 to 14. <br/>
The utility [http://buildroot.uclibc.org/downloads/sources/devmem2.c devmem2] allows for easy reading and writing of the memory; after building and installing this utility on the Gumstix Overo COM, you are ready to change the ports functionality. Consider the previous example of the led on gpio70, to change the pin mode to gpio you must issue the following command:
Here are some details about the current implementation of the communication module:
<pre>
* use the infrared sensors to exchange data, thus during reception/transmission the proximity sensors cannot be used to avoid obstacles; in the worst case (continuous receive and transmit) the sensor update frequency is about 3 Hz
devmem2 0x480020DC b 0x14
* bidirectional communication
</pre>
* id and angle of the proximity sensor that received the data are available
''0x480020DC'' is the address of the register we want to write to and can be found observing the table 7-4 on chapter 7.4.4.3 of the [http://projects.gctronic.com/Gumstix/omap35xx-TRM.pdf OMAP35x TRM]; ''b'' means we want to write a byte to that register and finally ''0x14'' is the value we want to write. The pin mode depends on the last three bits, in this case the mode is set to 4, namely the pin is a gpio. From now on we can follow steps from 3 to 5 of the previous chapter to switch on and off the led.
* the throughput is about 1 bytes/sec
* maximum communication distance is about 5 cm
* no reception/transmission queue (only one byte at a time)
* the data are sent using all the sensors, cannot select a single sensor from which to send the data. The data isn't sent contemporaneously from all the sensors, but the sensors used are divided in two groups of 4 alternating sensors (to reduce consumption)


=ROS=
An example on modifying the pins configuration through the C programming language can be found in the following link [http://docwiki.gumstix.org/index.php?title=Sample_code/C/gpregs gpregs.c].
This chapter explains how to use ROS with the elisa-3 robots; the radio module is needed here. Basically all the sensors are exposed to ROS and you can also send commands back to the robot through ROS. The ROS node is implemented in cpp. Here is a general schema:<br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/elisa-ros-schema.png <img width=450 src="http://www.gctronic.com/doc/images/elisa-ros-schema-small.png">]</span>
''<font size="2">Click to enlarge</font>''<br/>


First of all you need to install and configure ROS, refer to [http://wiki.ros.org/Distributions http://wiki.ros.org/Distributions] for more informations. Alternatively you can download directly a virtual machine pre-installed with everything you need, refer to section [http://www.gctronic.com/doc/index.php/Elisa-3#Virtual_machine virtual machine]; this is the preferred way.  
===Useful links/resources===
:*<font style="color:red"> This tutorial is based on ROS Hydro</font>.
For more information on GPIO usage, have a look at the following links:
:* If you downloaded the pre-installed VM you can go directly to section [http://www.gctronic.com/doc/index.php/Elisa-3#Running_the_ROS_node Running the ROS node].
* [https://www.kernel.org/doc/Documentation/gpio/gpio.txt "KernelSrc/Documentation/gpio.txt"]
* [http://sourceforge.net/p/gumstix/mailman/ gumstix mailing list]
* [http://wiki.gumstix.org/index.php?title=GPIO http://wiki.gumstix.org/index.php?title=GPIO]
* [http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO]
* [http://www.hy-research.com/omap3_pinmux.html http://www.hy-research.com/omap3_pinmux.html]
* [http://focus.ti.com/docs/prod/folders/print/omap3530.html http://focus.ti.com/docs/prod/folders/print/omap3530.html]
* [http://pixhawk.ethz.ch/omap/start http://pixhawk.ethz.ch/omap/start]
* [http://docs.blackfin.uclinux.org/doku.php?id=gpio http://docs.blackfin.uclinux.org/doku.php?id=gpio]


The ROS elisa-3 node based on roscpp can be found in the following repository [https://github.com/gctronic/elisa3_node_cpp https://github.com/gctronic/elisa3_node_cpp].<br/>
<!--
==U-Boot==
You can find the U-Boot source at "git://gitorious.org/u-boot-omap3/mainline.git" or "http://git.gitorious.org/u-boot-omap3/mainline.git".
-->


==Initial configuration==
=Webots interface=
The following steps need to be done only once after installing ROS:
Nikola Velickovic developed an interface with the Webots simulator during his MSc Thesis in 2012.
:1. If not already done, create a catkin workspace, refer to [http://wiki.ros.org/catkin/Tutorials/create_a_workspace http://wiki.ros.org/catkin/Tutorials/create_a_workspace]. Basically you need to issue the following commands: 
His report is available [http://projects.gctronic.com/Gumstix/MScThesis_NikolaVelickovic_2012.tar.gz here].
<pre>  mkdir -p ~/catkin_ws/src
His files are available [http://projects.gctronic.com/Gumstix/ThesisProjectFiles(30.12.2011).tar.gz here].
  cd ~/catkin_ws/src
  catkin_init_workspace
  cd ~/catkin_ws/
  catkin_make
  source devel/setup.bash </pre>
:2. You will need to add the line <code>source ~/catkin_ws/devel/setup.bash</code> to your <tt>.bashrc</tt> in order to automatically have access to the ROS commands when the system is started
:3. Clone the elisa-3 ROS node repo from [https://github.com/gctronic/elisa3_node_cpp https://github.com/gctronic/elisa3_node_cpp]; you'll have a directory named <tt>elisa3_node_cpp</tt> that is the repo local copy
:4. Copy the repo directory <tt>elisa3_node_cpp</tt> (this is the actual ros package) inside the catkin workspace source folder (<tt>~/catkin_ws/src</tt>)
:5. Install the ROS dependencies:
:* <code>sudo apt-get install ros-hydro-slam-gmapping</code>
:* <code>sudo apt-get install ros-hydro-imu-tools</code>
:6. Open a terminal and go to the catkin workspace directory (<tt>~/catkin_ws</tt>) and issue the command <code>catkin_make</code>, there shouldn't be errors
:7. The USB radio module by default requires root priviliges to be accessed; to let the current user have access to the radio we use <tt>udev rules</tt>:
:* plug in the radio and issue the command <tt>lsusb</tt>, you'll get the list of USB devices attached to the computer, included the radio:
::<tt>Bus 002 Device 003: ID 1915:0101 Nordic Semiconductor ASA</tt>
:* issue the command <tt>udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/002/003)</tt>, beware to change the bus according to the result of the previous command. You'll receive a long output showing all the informations regarding the USB device, the one we're interested is the <tt>product attribute</tt>:
::<tt>ATTR{product}=="nRF24LU1P-F32 BOOT LDR"</tt>
:* in the udev rules file you can find in <tt>/etc/udev/rules.d/name.rules</tt> add the following string changing the <tt>GROUP</tt> field with the current user group:
::<tt>SUBSYSTEMS=="usb", ATTRS{product}=="nRF24LU1P-F32 BOOT LDR", GROUP="viki"</tt>
:: To know which groups your user belongs to issue the command <tt>id</tt>
:* disconnect and reconnect the radio module
:8. Program the elisa-3 robot with the last [http://www.gctronic.com/doc/index.php/Elisa-3#Advanced_demo advanced firmware] (>= rev.221) and put the selector in position 15


==Running the ROS node==
=FAQ=
First of all get the last version of the elisa-3 ROS node from github:
'''1. Why the serial communication between Gumstix Overo COM and the robot doesn't work?''' <br/>
* clone the repo [https://github.com/gctronic/elisa3_node_cpp https://github.com/gctronic/elisa3_node_cpp] and copy the <tt>elisa3_node_cpp</tt> directory inside the catkin workspace source folder (e.g. ~/catkin_ws/src)
There could be three possible reasons for the communication problem:
* build the driver by opening a terminal and issueing the command <code>catkin_make</code> from within the catkin workspace directory (e.g. ~/catkin_ws).<br/>
* selector position incorrect: you need to be sure that the robot selector is in position 10 in order to start the right software on the robot side
* wrong device: the serial device is identified as /dev/ttyS0 in the linux machine, be sure to use it when you're using for example the sertest demo ("./sertest -p /dev/ttyS0 -b 230400")
* battery discharged: somebody could be deceived from the fact that the linux console is still usable, but if the orange led on the robot indicating the low battery level is turned on, then the robot will not be able anymore to respond, even if you are working on the linux console; either change or charge your battery and try again. <br/>


Now you can start the ROS node, for this purposes there is a launch script (based on [http://wiki.ros.org/roslaunch roslaunch]), as explained in the following section. Before starting the ROS node you need to start <tt>roscore</tt>, open another terminal tab and issue the command <tt>roscore</tt>.
'''2. I am able to communicate with the robot through the serial line, but seems that I receive only garbage, why?''' <br/>
Probably the baudrate isn't correct; with the robot selector in position 10 you need to configure the baudrate at 230400 (e.g "./sertest -p /dev/ttyS0 -b 230400"). <br/>


===Single robot===
'''3. Can I use bluetooth to connect to the robot? Can I use the [http://www.gctronic.com/doc/index.php/E-Puck#PC_interface monitor]?''' <br/>
Open a terminal and issue the following command: <code>roslaunch elisa3_node_cpp elisa3_single.launch elisa3_address:='1234'</code> where <tt>1234</tt> is the robot id (number on the bottom).
Yes, you can connect to the robot with bluetooth and play with the monitor interface placing the selector in position 3. You'll experience some errors on the values displayed on the monitor due to the additional two long IR sensors that aren't considered when the interface was developed; moreover you will not be able to receive images from the robot. <br/>


If all is going well [http://wiki.ros.org/rviz/UserGuide rviz] will be opened showing the informations gathered from the topics published by the elisa ROS node as shown in the following figure: <br/>
'''4. Why I cannot connect to the robot through SSH? <br/>
<span class="plainlinks">[http://www.gctronic.com/doc/images/elisa-ros-single-robot.png <img width=300 src="http://www.gctronic.com/doc/images/elisa-ros-single-robot-small.png">]</span>
* first of all be sure that the network is well configured (you can i.e. ping the robot sucessfully)
''<font size="2">Click to enlarge</font>''<br/>
* check the SSH daemon is running typing: ''ps -ef | grep sshd''; if it is not running then setup the SSH daemon to run automatically at boot; for this purpose you can type ''update-rc.d sshd defaults 99''. This command will install the links to ''sshd'' into rc*.d dirs. See the man page for more informations.
* if the SSH server is running, but you get an error like "ssh: connect to host 192.168.1.2 port 22: Connection refused" when trying to connect, you can check whether a user and group sshd are created. If not, add the following entries in the system:
<pre>
/etc/group:sshd:*:27:
/etc/passwd:sshd:*:27:27:sshd privsep:/var/empty:/sbin/nologin
</pre>


The launch script is configured also to run the [http://wiki.ros.org/gmapping gmapping (SLAM)] node that let the robot construct a map of the environment; the map is visualized in real-time directly in the rviz window. Here is a video:<br/>
'''5. How to auto-login and execute applications automatically at startup? <br/>
{{#ev:youtube|v=k_9nmEO2zqE}}
Refers to the instructions explained here [https://wiki.gumstix.com/index.php/AutoLogin https://wiki.gumstix.com/index.php/AutoLogin].


==Virtual machine==
'''6. Are micro SDHC supported? <br/>
To avoid the tedious work of installing and configuring all the system we provide a virtual machine which includes all the system requirements you need to start playing with ROS and elisa. You can download the image as ''open virtualization format'' from the following link [http://projects.gctronic.com/VM/ROS-Hydro-12.04.ova ROS-Hydro-12.04.ova] (based on the VM from http://nootrix.com/2014/04/virtualized-ros-hydro/); you can then use [https://www.virtualbox.org/ VirtualBox] to import the file and automatically create the virtual machine. Some details about the system:
Yes they are supported.
* user: gctronic, pw: gctronic
* Ubuntu 12.04.4 LTS (32 bits)
* ROS Hydro installed
* [http://www.cyberbotics.com/ Webots] 8.0.5 is installed (last version available for 32 bits linux)
* [http://git-cola.github.io/ git-cola] (git interface) is installed
* the <tt>catkin workspace</tt> is placed in the desktop


=Videos=
=Videos=
==Autonomous charge==
<!--{{#ev:youtube|LQC9lvn9w8Q}}
The following videos show 3 Elisa-3 robots moving around in the environment avoiding obstacles thanks to their proximity sensors and then going to the charging station autonomously; some black tape is placed in the charging positions to help the robots place themselves thanks to their ground sensors. The movement and charging is indipendent of the gravity. It works also vertically and up-side-down.
Comments:
{{#ev:youtube|o--FM8zIrRk}}{{#ev:youtube|Ib9WdbwMlyQ}}{{#ev:youtube|xsOdxwOjmuI}}{{#ev:youtube|tprO126R9iA}}{{#ev:youtube|HVYp1Eujof8}}{{#ev:youtube|mtJd8jTWT94}}
We have sent an e-puck on a mission to find our office plant.
==Remote control==
It's actually a standard e-puck with a wifi connection to the laptop and the Gumstix's overo extention  with Linux OS, all runned by a powerful 0.6 Ghz processor. -->
The following video shows 38 Elisa-3 robots moving around with onboard obstacle avoidance enabled; 15 of them are running autonmously, the remaining 23 are controlled from one computer with the radio module.<br/>
 
{{#ev:youtube|WDxfIFhpm1g}}
{{#ev:youtube|a0Ozy-oRQIs}} <br/>
Comments: This e-puck is on an exploration, his camera sends continuous image to the computer with a wifi connection.
 
=Useful links=
[http://www.gumstix.org/ http://www.gumstix.org/] <br/>
[http://wiki.gumstix.org/index.php?title=Main_Page http://wiki.gumstix.org/index.php?title=Main_Page] <br/>
[http://docwiki.gumstix.org/index.php/Gumstix_Buildroot_Support_Wiki http://docwiki.gumstix.org/index.php/Gumstix_Buildroot_Support_Wiki] <br/>
[http://docwiki.gumstix.org/index.php?title=U-Boot http://docwiki.gumstix.org/index.php?title=U-Boot] <br/>
[http://www.openembedded.org/wiki/Main_Page http://www.openembedded.org/wiki/Main_Page] <br/>
[http://www.e-puck.org/ http://www.e-puck.org/] <br/>
[http://www.jumpnowtek.com/ http://www.jumpnowtek.com/] <br/>

Revision as of 11:46, 9 April 2018

This is a mini how-to of the e-puck extension board for the Gumstix Overo COM.

Minimal getting started

  1. upload the standard firmware to the e-puck robot and put selector in position 10
  2. connect the USB cable: mini-USB to the extension module and the other side to the PC
  3. execute a terminal program (e.g. minicom) and configure the connection with 115200-8N1. The serial device path should be typically something like "/dev/ttyUSB0". Make sure that the flow control parameter of minicom called "Hardware" is set to "No".
  4. switch on the robot; now the terminal should display the Gumstix Overo booting information (booting time 25-30 seconds)
  5. login with user=root, password=root

Anyway you're encouraged to read all the documentation since you'll find more detailed explanations.

Introduction


This introductory section explains the minimal procedures needed to work with the Gumstix Overo computer-on-module (COM) mounted on the e-puck extension board and gives a general overview of the available demos and scripts shipped with the micro sd. You can also refer to extension-instructions that is a document containing the most important information in order to start working with the extension. The extension is mostly an interface between the e-puck robot and the Gumstix Overo COM.

Gumstix Overo COM: product information and programming information,

Full package

The full package content is:

  • e-puck extension with Gumstix Overo COM and micro sd card already inserted
  • USB adapter for the micro sd
  • A to mini-B USB cable
  • USB wifi dongle
  • external power adapter
  • USB host adapter

The standard COM mounted on the e-puck extension is the Gumstix Overo EarthSTORM COM. Some extensions were delivered with the Gumstix Overo SandSTORM COM, don't worry, the main difference between the two COMs is that the SandSTORM has no flash memory, but the flash isn't necessary since the system is booted from the micro sd.

Requirements

In order to connect to the extension through the mini USB the FTDI driver need to be installed. If a serial port is automatically created when connecting the robot to the computer you're done otherwise visit the following site and download the drivers for your architecture (32 or 64 bits) FTDI drivers.

General procedure

The e-puck extension board for the Gumstix Overo COM comes with a pre-configured system ready to run without any additional configuration. The whole system is installed on a micro sd and is composed of:

It's important to note that the flash isn't reprogrammed, so it will contain the factory system.

In order to access the system from a PC (console mode), the following steps must be performed:

  1. connect the USB cable: mini-USB to the extension module and the other side to the PC
  2. execute a terminal program (e.g. minicom) and configure the connection with 115200-8N1. The serial device path should be typically something like "/dev/ttyUSB0". Make sure that the flow control parameter of minicom called "Hardware" is set to "No".
  3. switch on the robot; now the terminal should display the Gumstix Overo booting information (booting time 25-30 seconds)
  4. login with user=root, password=root

Wireless setup

Before proceding with the following configurations be sure that the WiFi dongle is well recognized, refer to section WiFi_dongle.

Wireless configuration using a script

The script setupWifi placed under /home/root/scripts is used to configure easily the wireless network (managed mode) and need to be adapted to your specific situation. The script is shown below:

#!/bin/bash
ifconfig wlan0 up
iwconfig wlan0 essid SSID key HEX_KEY
iwconfig wlan0 ap MAC_ADDRESS
iwconfig wlan0 rate 54M
ifconfig wlan0 LOCAL_IP netmask SUBNET_MASK
route add default gw GATEWAY_IP

To know the available wifi networks and related information such as mac address of the access point, you can issue the command iwlist scanning wlan0.

On some platforms, udev may rename the network interface wlan0. In this event, the 'setupWifi' script will return several errors, some of which will say "No Such Device." To identify your network interfaces, use the commands ifconfig or iwconfig. These will provide a listing of your devices, and their current states. Identify the appropriate interface (typically wlan# where "#" is a number) and replace wlan0 in the above script with this.

If you're using dhcp, you can instead adapt the script setupWifiDhcp found under /home/root/scripts:

#!/bin/bash
ifconfig wlan0 up
iwconfig wlan0 essid SSID key HEX_KEY
iwconfig wlan0 ap MAC_ADDRESS
iwconfig wlan0 rate 54M
dhclient wlan0

The parameters that must be customized are shown in capitals; after that you can execute the script typing ./setupWifi (or ./setupWifiDhcp) and after a while a message should be displayed indicating that the wireless is ready. You can test the network configuration using ping.

It may be necessary to create a directory if you get the error "can't create /var/lib/dhcp/dhclient.leases: No such file or directory." Use the mkdir command

mkdir /var/lib/dhcp

Usually, when the Wifi dongle is connected to the AP, a message is written in the message buffer of the kernel. The following bash code snippet can be used to make sure that the connection is well established when the program returns:

#!/bin/bash
echo Wait until the Wifi is connected to the AP
while true
do
  #the text "link becomes ready" can vary according the Wifi dongle
  a=$(dmesg | grep wlan0 | grep "link becomes ready")
  if [ -n "$a" ]
  then
    echo Wifi enabled!
    exit
  fi
  sleep 1
done

In order for the setupWifi or setupWifiDhcp scripts to be run during boot, copy the appropriate script into the init.d directory with the other start/stop scripts.

cp -i ~/scripts/setupWifi /etc/init.d/setupWifi

Then determine which run level the system is using with the command:

runlevel

This should return "N #" where # is the run level number. Create a link to your script in the init.d directory within the directory /etc/rc#.d Name the link S##setupWifi. The number ## (customarily 2 digits, which you choose) determines where in the startup sequence your script will be run. It is good advice to choose a number just smaller than the largest in the rc#.d directory, this way the script is not called before lower-level ones. The creation of this link can be done with the following command (where # and ## must be changed to their appropriate values).

ln -i -s /etc/init.d/setupWifi /etc/rc#.d/S##setupWifi

Wireless configuration using a wpa_supplicant

Alternativerly, the Wifi connection can be set up by using both wpa_supplicant and the native wifi setup. This has the advantage to be more robust against failure. In order to do that, the Wifi interface can be added to /etc/network/interfaces, this way:

auto wlan0
iface wlan0 inet static
	address 192.168.1.2
	netmask 255.255.255.0
	wpa-conf /path/to/wifi.conf #this should be replaced by the absolute location of wifi.conf

And the related wifi.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
  ssid="myssid" #this should be replaced by your ssid
  scan_ssid=1
  key_mgmt=NONE
  wep_key0=1234567890 #this should be replaced by your WEP key
  wep_tx_keyidx=0
}

In this example, static IPs and WEP encryption have been used. DHCP and other encryption can be obviously used by following the documentation both of the linux native network setup and of wpa_supplicant.

Network performance

To test the network performance you could use the iperf tool installed on the system. In the server side you must issue the following command (either for TCP or UDP testing), after which the server machine is listening for incoming data:

iperf -s      [TCP]
iperf -s -u   [UDP]

In the client side you must type:

iperf -c SERVER-IP                   [TCP]
iperf -c SERBER-IP -u -b 50000000    [UDP]

Where SERVER-IP must be changed accordingly to the network configuration.

Package manager

If you have an internet connection up and running you can update and install easily new packages with opkg. Some of the useful operations you could do are:

  • update repositories: opkg update
  • update installed packages and kernel; pay attention that the camera driver is based on the provided kernel and upgrading it will prevent the use of the camera: opkg upgrade
  • list of software currently installed on the machine: opkg list_installed
  • install a new package (perl in the example): opkg install perl
  • remove a pacakge (perl in the example): opkg remove perl
  • list of all packages available to be installed: opkg list

opkg update failed

If you get errors on reaching the default repo sources you can try changing them by following these steps:

  1. make a copy of the current repo: mv /etc/opkg/base-feed.conf /dest-dir
  2. add the new repo: echo 'src/gz base http://feeds.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base' > /etc/opkg/base-feed.conf
  3. opkg update

The procedure shows how to change the base repo, the same need to be done for all others repos.

USB ports

The e-puck extension board for the Gumstix Overo COM comes with two USB interfaces called USB host and USB otg. If you try inserting devices that require more energy than the one permitted on the otg, the device will not be enabled automatically. In these cases you can use the three scripts usbup, usbdown and usbenable to respectively power up, power down and enable the USB device; they're placed under /home/root/scripts. These scripts are intended for primary use with the USB otg port, even if they're suitable for both ports (otg and host).

  • ./usbup otg (or ./usbup host): power on the usb device
  • ./usbdown otg (or ./usbdown host): power off the usb device
  • ./usbenable otg (or ./usbenable host): activate the usb device (now is in the usb device list)

Demos

A specific firmware must be charged on the e-puck to run the Gumstix Overo linked demos, refer to section E-puck firmware.

Serial test on the Gumstix Overo COM

This small program read and write from a serial port (non-canonical mode). For more information on the usage refers to sertest (sertest sources). It's placed under /home/root/demos/gumstix-common, and it's called sertest.

Advanced sercom

Once the new firmware is running on the e-puck, the selector must be set in position 10 to run the advanced sercom for the Gumstix Overo.
Now you can type (after being in /home/root/demos/gumstix-common) ./sertest -p /dev/ttyS0 -b 230400 (or simply ./ser+ENTER) to enter the e-puck menu in console mode; for a list of all available commands type h+ENTER. After stopping the sertest program (CTRL+C), the display may not respond correctly; to reset the display run the script r by simply typing ./r+ENTER. Now the display should behave normally.
For more information about the advanced sercom refer to the page Advanced sercom protocol.

Images grabbing (camera driver)

A small application called v4l2grab (v4l2grab.zip) based on http://github.com/twam/v4l2grab was used for grabbing JPEGs from V4L2 devices. In order to get an image from the e-puck camera you need to run the program typing (after being in /home/root/demos/gumstix-common/) ./v4l2grab -o image.jpg. The application communicates also with the robot through the serial line to know the camera orientation and rotates the image automatically in case the camera is rotated (refer to section e-puck camera for more information on camera orientation). For more information on the options available refer to the help by typing./v4l2grab -h.

Images transfer (camera driver)

This demo is divided in two parts: one running on the e-puck extension board for the Gumstix Overo COM that continuously request images to the e-puck camera and transfers them over UDP, and the other running on a PC that acts as a server and is listening for the images visualizing them as soon as they are available. A network link must be established between the two in order to run this demo; for more information on how to configure the network refer to the section Wireless setup.

First of all you need to start the server (Receiver QT project). The application is a Qt project, so the compilation may be handled easily with Qt Creator; alternatively qmake can be used. The usage is very simple: the server listening port and the protocol (only UDP available at the moment) must be selected first, then click on the button Connect; at this moment the application is waiting images.
On the e-puck extension board side, you need to run the program typing (after being in /home/root/demos) ./v4l2grab-send -o image.jpg -i SERVER_IP -p SERVER_PORT -f 0 -t 0. SERVER_IP is the address of the PC and SERVER_PORT should be the same as configured when the receiver was started. The f option indicates the format (in this case RGB) and t indicates the transfer mode (0=UDP, 1=TCP). For more information on the options available refer to ./v4l2grab-send -h.
The sources for the sender, that is an extension of the v4l2grab application, could be found in the following link v4l2grab-send.zip; in order to compile the application the Makefile must be modified specifying the path to the cross-compiler (for more information on cross-compilation for the OMAP3530 processor refers to http://focus.ti.com/docs/prod/folders/print/omap3503.html).

Music player

This isn't really a demo, it's only one of the possible way on how to listen something from the extension module. The system comes with a tool called mplayer that supports many multimedia formats. You can use it to play for example an mp3 file in this way:

mplayer file.mp3

You can then adjust the volume with either the alsamixer graphical tool (adjusting DAC2 control) or using the command line tool amixer; the following command can be used for instance to set the volume to 80%:

amixer set 'DAC2 Analog' 80%

File transfer

ssh

The e-puck extension board for the Gumstix Overo COM supports ssh connections through dropbear (small SSH 2 server and client) that is installed on the system.
To exchange file between the module and the PC, the scp tool (secure copy) will be used; the general command is the following:

scp user@ip:path-to-file file-name

As an example of transfer a file from the PC to the extension, let the PC user be stefano and its IP be 192.168.1.10, then the command will be:

scp stefano@192.168.1.10:/home/stefano/file-to-send prova

The file file-to-send will be renamed in prova and placed in the current directory.

If you are working in Windows you can use WinSCP to exchange data between the robot and the computer.

zmodem

The following instructions to exchange data between the extension and the computer refer to minicom as the terminal.
If you want to receive a file, that is transfer a file from the PC to the e-puck extension board for the Gumstix Overo COM, you need to follow these steps:

  1. open a terminal window with minicom; now you access the linux system in console mode
  2. type lrz
  3. press CTRL+A and then S
  4. select zmodem and navigate to find the file you want to tranfer
  5. select the file with the SPACEBAR and then press ENTER to start the transfer
  6. when transfer is complete press ENTER once more to come back to the command line

For more information type lrz -h.

If you want to send a file, that is transfer a file from the e-puck extension board to the PC, you need to follow these steps:

  1. open a terminal window with minicom; now you access the linux system in console mode
  2. type lsz file-name, where file-name is the file you want to transfer
  3. when transfer is complete press ENTER to return to the command line

The file will be placed in the directory where minicom is started. For more information type lsz -h.

Extension LEDs

The e-puck extension board for the Gumstix Overo COM comprises 8 new small leds that can be turned on/off easily from the file system in this way:

echo 1 > /sys/class/gpio/gpio7x/value   [turn on]
echo 0 > /sys/class/gpio/gpio7x/value   [turn off]

where x ranges from 0 to 7. For more information on gpio refer to the section GPIO - pins mode.

File system image

You can download the entire system running on the micro sd released with the e-puck extension board from the following links: file system and FAT (with camera driver 1.3).
In order to prepare the micro sd you can use a script (prepareMicroSD.sh), in which you need only to specify where to find the two previously downloaded files and run it (./prepareMicroSD.sh /path/to/dev) to have your micro sd ready to be used. Alternatively you can have a look the gumstix documentation on how to create a bootable microsd card.
If you experience problems in booting from mmc enter u-boot and issue the following command:

nand erase 240000 20000
reset

Moreover if you need you can find pre-built images for the Gumstix Overo in the following link: http://gumstix.org/download-prebuilt-images.html.

Sources

The complete kernel sources (comprising the camera driver) can be downloaded from the following link gctronic-ti-psp-omap-2.6.32-12.08.14.zip if you want to try to build it your own (anyway you don't need to do it because the released micro SD is ready to run with this system). The system is based on:

Camera driver

The driver of the camera is open-source, you can download the code in the section kernel source. The driver is located in /ti-psp-omap/drivers/media/video/po6030cam.c; related ISP code is located in /ti-psp-omap/drivers/media/video/isp.

Release notes

1.0
  • support for PO6030 camera (front e-puck camera or camera of omnicam module version 1)
  • support for RGB565 output format
  • only 640x480 resolution images
1.1
  • added support for PO3030 camera
  • added support for YUV422 output format
  • brightness, contrast, saturation, auto-white balance, red gain, blue gain controls available
1.2
  • exposure control available
  • support for 480x480 color and greyscale images
1.3
  • added support for PO8030 camera

System update

In order to update the system released in the micro sd with the new driver you need to download the kernel modules from linux-2.6.32.tar.gz and the kernel image from uImage. Then:

  1. insert the micro sd in the computer; two partitions will be recognized
  2. copy the kernel image (uImage) in the FAT partition
  3. extract the kernel modules in the second partition:
    1. cd path/to/partition
    2. sudo tar zxvf path/to/kernel-modules
  4. unmount the micro sd from the computer and insert it in the extension; at first boot type depmod -a and reboot

Daemon

It can be useful to start a daemon at the end of the boot process in order to run your own program at the start up of the e-puck (when the console mode won't be accessible). This can be done by placing your program executable into /etc/init.d and then:

cp /path/to/your/executable /usr/sbin/mainProgram
cd /etc/init.d
update-rc.d mainProgram defaults 99

The daemon can be removed by removing these files:

rm /etc/rc*/*mainProgram*

Remember to give execution permission to the program by typing chmod +x mainProgram.

Hardware

The following figure shows the main components offered by the e-puck extension for the Gumstix Overo COM and their interconnection with the e-puck robot and the Gumstix Overo COM.

In particular there are:

  • a Gumstix Overo COMs: compatible with all Gumstix Overo COM models. The communication between the Gumstix Overo COM (OMAP 35xx) and the e-puck (dsPIC) is handled with a serial line at 230400 baud
  • a mini-usb connector (console) used to enter the linux system through a terminal
  • one usb otg and one usb host: these two connectors are really useful to connect whatever peripheral you need, like a WiFi dongle or simply a pen drive to extend the memory
  • a speaker (speaker specification): with Linux running on the Gumstix Overo COM, it's really easy play any audio format you need or implement a speech synthesizer. If the user prefer to have the speaker on the extension linked to the e-puck processor, it can simply be done changing two small resistors
  • 8 LEDs: have you ever seen a board without leds?! Anyway they are completely controllable through GPIO lines (gpio70-gpio77), for detailed information refer to section GPIO - pins mode
  • an I2C connector (@5 V)
  • a rotary selector: one could choose what program is running on the e-puck based on the selector position
  • 2 long range infrared proximity sensors (long range specification)
  • the PixelPlus PO6030 camera remains mounted on the robot, but you could receive image from it by using the OMAP ISP (Camera Interface Subsystem); this way we can receive up to 18 frames per second (VGA color images)

The following figure illustrates where the components are physically placed on the e-puck extension board for the Gumstix Overo COM.

Electrical schema

The circuit diagram of the e-puck extension for Gumstix Overo COM is available to the community on the following link electrical schema.

Long range proximity sensors

The following chart illustrates the long range proximity sensors response towards a white surface. These results should be considered indicative.

A zoom in the bigger distances shows that the values returned from the sensors are still usable to react to obstacles.

WiFi dongle

Zyxel

The WiFi dongle shipped with the extension board for the Gumstix Overo COM is a ZyXEL NWD271N USB adapter, 802.11n compatible. It's based on an Atheros chipset, for more infromation about the linux driver visit the following site http://linuxwireless.org/en/users/Drivers/ar9170.
The measured throughput with the e-puck extension and provided wifi dongle is 20 Mb/s.
The consumption of the wifi dongle is 100 mA in standby and 300 mA when active.

Edimax

A new WiFi dongle is shipped starting from January 2012, it is the Edimax EW-7811Un, based on a Realtek chipset (RTL8192cu). The device isn't recognized automatically at boot, so you need to follow these steps in order to enable and use it:

  1. turn on the robot and login with user=root, password=root
  2. only needed if the wifi dongle is connected to the USB OTG: type ./scripts/gumstix-common/usbenable otg. Don't worry about the warning usb 1-1: new config #1 exceeds power limit by 400mA
  3. type insmod 8192cu.ko (the kernel module is located in /home/root); the wifi dongle should be recognized and a wlanX device created
  4. type ifconfig wlanX up (where X is a number) to turn on the device; now the wifi can be configured and used normally

The following figures show how the device is mounted on the extension: on the left the WiFi dongle is connected to the USB HOST connector (pay attention to the position on the connector), on the right the WiFi dongle is connected to the USB OTG (this is needed when using an omnivsion extension):

Consumption

The consumption of the robot and extension is 300 mA; with the Zyxel wifi dongle inserted (standby) the consumption goes up to 400 mA; when the wifi dongle becomes active, the consumption reaches 700 mA. If the wifi isn't used it can be turned off completely using the usb scripts http://www.gctronic.com/doc/index.php/Overo_Extension#USB_ports.

Two different tests were performed to provide an estimation of the duration of the battery:

  1. e-puck and gumstix active (gumstix sends commands via serial to robot; movement every 3s lasting 1s at 30% of maximum speed): 3h and 30 minutes
  2. e-puck, gumstix and wifi active (same as above, moreover wifi active all the time with continuous ping): 1h and 25 minutes

External power

In the package you'll find also an external power adapter that will be useful during development of your applications. As power supply you could use the one of the e-puck battery charger. The following figure shows the power supply cable, the external power cable and the extension.

You need to simply attach the power supply in one side, and the other side of the external power cable on top of the extension (near the USB plug). Once the cable is connected a green led should turn on indicating that the extension is running.

The external power cable could also be plugged in when the extension is mounted on the e-puck, but pay attention to not turn on the robot when the external cable supplies the energy, otherwise there could be serious damages of the devices and the battery.

3.3V and 5V source

The 3.3 V comes from the e-puck robot and the 5V comes from the gumstix extension. The gumstix extension can be used alone (without the robot attached to it) but some things are related to the 3.3 V thus without the robot connected they will not work; an example are the RGB leds of the omnivion module, that need the robot to be connected to the extension in order to be used.

Software

E-puck firmware

Refers to the section E-Puck Standard firmware for the firmware that need to be uploaded to the robot. Essentially in this firmware a new version of the advanced sercom is included (selector position 10) in which the bluetooth communication is replaced by the serial line communication, running at 230400 between robot and gumstix. Moreover the I2C is disabled temporary from the dsPIC side (the dsPIC cannot communicate through I2C) in order to avoid conflicts. As a last note, the body led and front led aren't anymore usable with the extension due to the two extra long range proximity sensors and for power saving purposes the motors are configured to the minimum energy consumption during movement.
The values of the two extra proximity sensors can be retrieved with the command N in the advanced sercom (selector position 10); the last two values returned by the command refer to these proximity sensors (the others values refer to the proximity sensors mounted on the e-puck as usual).

Project building

Refer to section Project building for information on how to build the project for the e-puck firmware.

Cross compilation

If you want to develop some applications that will run on the gumstix you need to firstly download the toolchain.

If you're using Ubuntu you can simply type sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi to install the required toolchain (have a look at http://www.gumstix.org/basic-cross-compilation.html and http://wiki.gumstix.org/index.php?title=Toolchain for more information).

Alternatively when you need to handle external dependencies is better using the toolchain integrated in OpenEmbedded (${OVEROTOP}/tmp/cross or ${OVEROTOP}/tmp/sysroots/i686-linux/usr/armv7a/bin/ with recent version) if you have it in your system. For more information refers to the gumstix wiki.

For other linux systems you can find a toolchain in the following link http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ (30 days trial); this toolchain is useful for small programs:

  1. download the Lite Edition, you'll have a file named something like arm-2009q3-67-arm-none-linux-gnueabi.bin
  2. open a terminal, go to the directory of the file, type chmod +x arm-2009q3-67-arm-none-linux-gnueabi.bin, after execute the file ./arm-2009q3-67-arm-none-linux-gnueabi.bin to start the installation
  3. follow the installation steps; you have to choose where to install the toolchain, this is the path you will specify in the makefile

Once a toolchain is installed in the system the process will be simply something like this:

  1. develop your application as you do normally in your developing machine
  2. cross-compile in your developing machine using the tools previously downloaded
  3. copy the executable in the extension's micro SD and run it

You can download the hello world example containing a makefile in which you have to specify the path to the toolchain you previously installed in order to build the program; you can use it for others programs.
Refer to section http://www.gctronic.com/doc/index.php/Overo_Extension#Demos for some application examples.

Of course you can also install the compiler directly on the embedded system and build the applications from it, but the process will take longer due to limited computational power compared to a developing machine.

External dependencies

Some applications may require external libraries not contained within the standard toolchain package. For instance if your application depends on libjpeg then you need to tell the cross-compiler where to look to find this library (compiled for the target machine) otherwise your application will not be compiled. If you have OpenEmbedded installed in your system you could simply bitbake the external dependencies (in our example bitbake jpeg) and then compile your application. Instead if you rely on the CodeSourcery toolchain you need to follow these steps:

  1. download the sources of the library
  2. cross-compile the library
  3. install the library (and include files) in the right places
  4. compile your application

Ground sensor

It's possible to use contemporaneously both the e-puck extension for gumstix overo and the ground sensor; in this case the camera and the ground sensor will share the same I2C bus and like the camera, also the ground sensor will not be anymore reachable from the e-puck side, but only from the overo side.
The I2C bus is configured to work at 400 KHz in the system running on the gumstix overo, thus we need to change the bus speed to 100 KHz in order to communicate with the ground sensor module; the simplest way is to set a kernel parameter in u-boot:

  1. enter u-boot by pressing any key at boot start
  2. type the command setenv i2cspeed 3,100; this init the I2C bus 3 to 100 KHz
  3. type the command setenv mmcargs setenv bootargs console=${console} i2c_bus=${i2cspeed} ${optargs} mpurate=${mpurate} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype} ; basically we pass an additional parameter to the kernel that is the i2c_bus=${i2cspeed}
  4. type the command saveenv to save the environment changes
  5. type boot to start booting

Pay attention that all the peripherals connected to the bus will now work at 100 KHz, thus also the e-puck camera and the LSM330 (accelerometer + gyroscope) present with e-puck HwRev 1.3.
If you want to set back the bus speed to 400 KHz you need to follow steps 2-4, by setting the i2cspeed u-boot environment variable with setenv i2cspeed 3,400.
Communicating with the ground sensor is as easy as open a device and reading from it; a source code example can be found in the following link http://projects.gctronic.com/Gumstix/groundsensor.c. You will find this application example in the /home/root/demos/gumstix-common directory; start it by executing ./i2c_groundsensors and the sensors values will be displayed in the terminal.
Make sure that you have installed the last system update otherwise you'll encounter some problems.
You can find more information about the I2C and gumstix in the following links:

OpenCV

The Open Computer Vision Library has more than 500 algorithms, documentation and sample code for real time computer vision; you can download it from http://sourceforge.net/projects/opencvlibrary/, and find information about it from the official wiki http://docs.opencv.org/index.html.
The released system comes with OpenCV version 2.0.0 pre-installed and a demo that shows an example of what can be performed with this library. The demo let the robot follow a black filled circle placed in front of it; if the circle is moved right or left the robot turns consequently. The following figure shows an example of the circle detected by the robot:

In order to start the demo follows these steps:

  1. turn on the robot with the gumstix extension and login as root with password root
  2. go to the directory /home/root/demos/gumstix-common and execute ./v4l2grab-opencv -o image.jpg
  3. the demo should return the number of circles detected and save a resulting image showing the circles detected if any

Alternatively you can use the following script, that launches the demo and send it through serial (using zmodem) iteratively:

#!/bin/bash
while true; do
./v4l2grab-opencv -o image.jpg -q 50
lsz img1.jpg
done

The source code can be downloaded from the following link v4l2grab-opencv.zip.


Accelerometer and gyroscope (e-puck HWRev 1.3)

When the e-puck extension for gumstix overo is mounted on the e-puck hardware revision 1.3 the same I2C bus is shared by all the devices (camera, accelerometer, gyroscope) and the overo; since there is only one master (the overo) these devices will not be anymore reachable from the e-puck side.
The I2C bus is configured to work at 400 KHz in the system running on the gumstix overo and this is fine to work with the accelerometer and gyroscope.
Communicating with the accelerometer and gyroscope is as easy as open a device and reading from it; a source code example can be found in the following link i2c_lsm330.c. You will find this application example in the /home/root/demos/gumstix-common directory; start it by executing ./i2c_lsm330, type 0 to get the accelerometer values or 1 to get the gyroscope values printed on the terminal.
The values of the accelerometer and gyroscope read from the gumstix through the I2C are 16 bits (1g = 16384); beware that regarding the accelerometer values there is a mismatch between the values read from the gumstix through I2C and the values read from the advanced sercom protocol through Bluetooth, the latter are converted in the firmware to maintain compatibility with older e-puck hardware revisions.
The orientation of the accelerometer for the values read from the gumstix through the I2C is also different from the one used in the e-puck firmware; the orientation is shown below, the x axis points forward, the y axis points left and the z axis points upward:

Python

An example in python is available from the following link i2c_lsm330.py. In order to run the script, some additional dependencies need to be installed in the system, follow these steps:

  1. configure the network in order to have internet access
  2. update the package manager repos:
    1. echo 'src/gz base http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/' > /etc/opkg/base-feed.conf
    2. echo 'src/gz python http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/python/' > /etc/opkg/python-feed.conf
  3. add arch armv7a-vfp-neon 45 to the file /etc/opkg/arch.conf
  4. opkg update
  5. opkg -force-overwrite install python-smbus
  6. optionally you can also remove some warnings related to the update by running the following script remove-warnings.sh

Once the system is configured you can start the script by executing python i2c_lsm330.py, type 0 to get the accelerometer values or 1 to get the gyroscope values printed on the terminal.

ROS

We tested ROS on the gumstix extension with the Yocto system. Follow these steps to get ROS running on the e-puck extension:

1. prepare a micro sd following the instructions from http://gumstix.org/create-a-bootable-microsd-card.html
2. download the file system and fat from the following links: yocto-ros-3.5.7-FAT.tar.gz, yocto-ros-3.5.7-rootfs.tar.gz
3. login with user=root and empty password
4. issue the following commands to enable the WiFi dongle:
echo host > /sys/bus/platform/devices/musb-hdrc/mode
echo -n 1 > /sys/bus/usb/devices/2-1/bConfigurationValue
5. follow the instructions from https://github.com/gumstix/yocto-manifest/wiki/ROS-on-Gumstix#the-fun-part to run a demo

Python

In order to install python 2.6 on the e-puck extension for Gumstix follow these steps:

  1. download the package python-gumstix.tar.gz
  2. extract the package: tar -zxvf python-gumstix.tar.gz
  3. remove the micro sd from the robot and connect it to your computer; two partitions will be opened, one called FAT and the other called overo containing the file system (the partitions name could be a little different)
  4. copy the content of the decompressed file to the same position in the overo partition:
    1. sudo cp -R /python-gumstix/usr/lib/* /overo/usr/lib
    2. sudo cp /python-gumstix/usr/bin/* /overo/usr/bin

Alternatively if you have access to internet you can use the package manager:

  1. opkg install python
  2. opkg install python-modules
  3. opkg install python-pyserial

In order to test your python installation you can download the following script printhelp.py; execute it by typing python printhelp.py. This is a minimal example of serial communication in python that let the gumstix communicate with the robot; basically it opens a serial connection with the robot and ask the available commands that you can use to get sensors data and change actuators state.
Another example is available here getprox.py; in this script the values of the proximities are requested to the robot and printed to the console. The data are requested in binary format, for more information about the communication protocol refer to the section advanced sercom.

Configuration

Graphic mode

The resolution of the monitor can be modified in the u-boot command line, that can be entered at booting. In the u-boot command line type:

setenv dvimode "1280x720MR-16@60"
saveenv
boot

Now the configuration is saved in the flash; if your monitor doesn't support the current resolution, repeat the procedure with a different configuration (change the resolution numbers).

Note that the DVI Controller (TFP410) mounted on Summit and Tobi supports resolutions from VGA (640x480) to UXGA (1600x1200).

Useful files to look at:

  • linux_source_home/drivers/video/modedb.c: explains what's the mean of the dvimode names
  • linux_source_home/Documentation/fb/viafb.modes: list of available modes usable with the fbset tool

GPIO - pins mode

There are three different ways to read GPIO lines:

1. Kernel space: GPIO lines handled through an API
2. User space:
2.1. standard filesystem commands like cat and echo (static configuration)
2.2 direct physical memory access using devmem2 or with a C application (dynamic configuration)

Afterward will be explained how to handle the GPIO lines on the Gumstix Overo COM in all different methods; information about this topic were found from various sites, but especially from the mailing list. Moreover for a general howto on GPIO refers to the linux documentation "KernelSrc/Documentation/gpio.txt".

Kernel space

User space

Static configuration

Each of the microprocessor IO pins can be configured to work in different ways for different purposes; in case we desire a certain pin to be configured as a gpio line, we must modify the function assigned to that pin (mux configuration) in the U-Boot board configuration file, that for the Gumstix Overo COM is located at "U-BootSrc/board/overo/overo.h".

To know which modes are available for the pins consult the chapter 7-System Control Module (more specifically 7.4.4-Pad Functional Multiplexing and Configuration) in the OMAP35x TRM.

Assume we want to have the possibility to switch on and off a led attached to the line gpio70; in order to accomplish this task, we need to follow these steps:

1. Modify the board configuration file "overo.h" specifying that the pin has to behave as a gpio line:
MUX_VAL(CP(DSS_DATA0),		(IDIS | PTU | DIS | M4)) /*DSS_DATA0 => GPIO70*/\
  • IDIS = input disable, namely output pin
  • PTU = pull type up, but could be also PTD (pull type down) because of the third parameter
  • DIS = disable pull type up/down
  • M4 = mode 4 (gpio)
This give us a GPIO pin that is output and not pulled up or down.
2. Build U-Boot and place the generated u-boot.bin image in the flash (Writing images to onboard nand) or in a micro sd card (Creating a bootable microSD card)
3. After login, we can see all the GPIO pins that have been exported by the kernel to userspace in the /sys/class/gpio/ directory. In order to access the gpio70 line, we should export it first, by typing:
echo "70" > /sys/class/gpio/export
Now the following line is active /sys/class/gpio/gpio70.
4. At this point we must configure the direction of the exported line and set a logical value (1 or 0) to that line, we can do that by typing:
echo "high" > /sys/class/gpio/gpio70/direction
This command set the pin in output and give it a value of 1.
5. Finally we can switch on or off the led, by setting the value of the gpio line:
echo "value" > /sys/class/gpio/gpio70/value
Where value=1 means switch on, and value=0 means switch off.


In order to automate the process of creating a gpio line accessible through "/sys/class/gpio/", we must modify the board configuration file in the kernel source; this file can be found in "KernelSrc/arch/arm/mach-omap2/board-overo.c" (and related definitions in "KernelSrc/arch/arm/plat-omap/include/mach/board-overo.h"). These files must contain instructions to initialize the gpio line that we want to export in user space and set their direction and initial value.
Consider the previous example in which we would like to control a led with the gpio70 pin; for this purpose the following instructions must be added in the board configuration file board.overo.c within the overo_init function:

if ((gpio_request(70, "OVERO_GPIO_DD00") == 0) && (gpio_direction_output(70, 1) == 0)) {
	gpio_export(70, 0);
	gpio_set_value(70, 1); //not really needed, the initial output value is set with gpio_direction_output
} else {
	printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_DD00\n");
}

After this modification we need to build the kernel and copy it to the flash or micro sd card, and after login we will have the /sys/class/gpio/gpio70 line automatically active.
For more information on the previous snippet code refers to "KernelSrc/Documentation/gpio.txt".


Dynamic configuration

If you aren't familiar with modifying and building U-Boot and kernel, you would probably choose to modify the pin configuration at runtime, without the need to touch any board configuration file. The only way to change the configuration of the pins is to access directly the physical memory of the microprocessor, in particular its configuration registers.
The utility devmem2 allows for easy reading and writing of the memory; after building and installing this utility on the Gumstix Overo COM, you are ready to change the ports functionality. Consider the previous example of the led on gpio70, to change the pin mode to gpio you must issue the following command:

devmem2 0x480020DC b 0x14

0x480020DC is the address of the register we want to write to and can be found observing the table 7-4 on chapter 7.4.4.3 of the OMAP35x TRM; b means we want to write a byte to that register and finally 0x14 is the value we want to write. The pin mode depends on the last three bits, in this case the mode is set to 4, namely the pin is a gpio. From now on we can follow steps from 3 to 5 of the previous chapter to switch on and off the led.

An example on modifying the pins configuration through the C programming language can be found in the following link gpregs.c.

Useful links/resources

For more information on GPIO usage, have a look at the following links:


Webots interface

Nikola Velickovic developed an interface with the Webots simulator during his MSc Thesis in 2012. His report is available here. His files are available here.

FAQ

1. Why the serial communication between Gumstix Overo COM and the robot doesn't work?
There could be three possible reasons for the communication problem:

  • selector position incorrect: you need to be sure that the robot selector is in position 10 in order to start the right software on the robot side
  • wrong device: the serial device is identified as /dev/ttyS0 in the linux machine, be sure to use it when you're using for example the sertest demo ("./sertest -p /dev/ttyS0 -b 230400")
  • battery discharged: somebody could be deceived from the fact that the linux console is still usable, but if the orange led on the robot indicating the low battery level is turned on, then the robot will not be able anymore to respond, even if you are working on the linux console; either change or charge your battery and try again.

2. I am able to communicate with the robot through the serial line, but seems that I receive only garbage, why?
Probably the baudrate isn't correct; with the robot selector in position 10 you need to configure the baudrate at 230400 (e.g "./sertest -p /dev/ttyS0 -b 230400").

3. Can I use bluetooth to connect to the robot? Can I use the monitor?
Yes, you can connect to the robot with bluetooth and play with the monitor interface placing the selector in position 3. You'll experience some errors on the values displayed on the monitor due to the additional two long IR sensors that aren't considered when the interface was developed; moreover you will not be able to receive images from the robot.

4. Why I cannot connect to the robot through SSH?

  • first of all be sure that the network is well configured (you can i.e. ping the robot sucessfully)
  • check the SSH daemon is running typing: ps -ef | grep sshd; if it is not running then setup the SSH daemon to run automatically at boot; for this purpose you can type update-rc.d sshd defaults 99. This command will install the links to sshd into rc*.d dirs. See the man page for more informations.
  • if the SSH server is running, but you get an error like "ssh: connect to host 192.168.1.2 port 22: Connection refused" when trying to connect, you can check whether a user and group sshd are created. If not, add the following entries in the system:
 /etc/group:sshd:*:27:
 /etc/passwd:sshd:*:27:27:sshd privsep:/var/empty:/sbin/nologin

5. How to auto-login and execute applications automatically at startup?
Refers to the instructions explained here https://wiki.gumstix.com/index.php/AutoLogin.

6. Are micro SDHC supported?
Yes they are supported.

Videos


Comments: This e-puck is on an exploration, his camera sends continuous image to the computer with a wifi connection.

Useful links

http://www.gumstix.org/
http://wiki.gumstix.org/index.php?title=Main_Page
http://docwiki.gumstix.org/index.php/Gumstix_Buildroot_Support_Wiki
http://docwiki.gumstix.org/index.php?title=U-Boot
http://www.openembedded.org/wiki/Main_Page
http://www.e-puck.org/
http://www.jumpnowtek.com/