Saturday, June 25, 2011

Arena Setup Complete

Finally the arena is functional. The complete feedback system is working:
  • cameras gett a birdview image of the arena;
  • each robot carry a marker which are tracked on the arena image;
  • the position and orientation measured with ARToolkit are fed into a Kalman Filter;
  • the filtered position and velocity of the robots are published to other programs;
  • a path following program compute velocity and steer corrections to keep a robot over a path with a controled velocity;
  • these commands are sent via a xbee to the robots;
  • each robot carry an arduino fio that command two motors (steer and throttle).

Thursday, February 10, 2011


Before advancing in Kalman developments, as incorporating the control input signals, I wanted to cleanup the code, make the tracking more robust and improve power efficiency of the robots (after I fully discharged a LiPo battery =/ ).
I am using a white background now over the floor, that results in a better tracking and also keep my robots clean, besides having quite good friction. The tracking code now uses two modes for identifying a robot, one for new robots and other that gives a more steady response after one robot has been identified.
Now I will go into the codes of the robots themselves to make them more power effient, entering in stand by mode if no messages are being sent.
Next steps are to model the response of the vehicle to speed input commands and use them into the Kalman filter, for optimal tracking.

Friday, February 4, 2011

ARToolKit and Kalman

ARToolKit is working just fine.
I am able to easily track multiple markers, along the whole image. There is some amount of flickering still, probably due to the small markers and low resolution. I plan to lay out a white arena, so the marker would not need to have a white border, and therefore the marker could be larger.
I am also implementing the Kalman filter using OpenCV (Motion Analysis and Object Tracking — opencv v2.1 documentation). So far I created three filters: one for x, one for y and one for x and y. The filter is not having so great results, so I will try now to use the control input in the filter (as I know what commands are being sent for each car), besides using car specific kinematic equations: A simple unicycle

Tuesday, January 25, 2011

Back to ARToolkit

After several weeks experimenting with the ARToolkitPlus (ARTK+), I gave up. I was having serious troubles in experimenting with it, and the tracking functionality had worse results than the standard ARToolkit (ARTK).
I already cleaned my code, and managed to successfuly track two markers at the same time, with a larger area than the ARTK+

Thursday, January 20, 2011

New robots 2

Just finished building 5 robots. One of them has some problems with the differential and therefore the traction does not work very well. I kept one car so I could use its parts as spare, to overcome problems as the one found in the differential. I also tested the capability of the xbee coordinator to send messages to several end nodes, and that is just fine. There is a small delay that can be noticed (the robots are not perfectly synchronized), but that may be related either to the messages queue or to the hardware differences.
Soon I will post a video of the full construction of a robot.

Thursday, January 13, 2011

New robots

I am creating the new robots, after the prototype had good results. I was afraid I could not use the l293e driver with the lower voltage (3.3V) arduino fio, as the specs of that IC states that the minimum logic supply is 4.5V. Nevertheless I was able make them work with a 3.3V logic and a motor supply from lipo batteries rated at 3.7V.
Now I am creating the motor driver shields for the arduino and after that I will modify the car chassis to integrate with the electronics.

Wednesday, January 5, 2011

ARToolKit Plus Integration

The integration is advancing. There is already a module inside the lar toolkit that uses the ARTK+ features based on an imaged transmitted by other module. I also managed to track several different patterns in the same image with the same code.
I still have some issues to address before ARTK+ be completely integrated:
- maximum track area: how many cameras, resolution, distortion, etc.
- extract usefull information from the transformation matrix given by the ARTK+ (units for example)

Sunday, December 19, 2010

multiple xbee tests

This is to test the system capability to distribute messages to several robots using only one coordinator. Each "robot" is only an arduino fio board, with a xbee modem, and at the computer side, there is a module (program) for each "robot". These modules send a message each 100 ms, and at the robot side the boards blink a led to signal the message was received.
Although the tests had good results, its hard to assess if no delay is present on the messages. If one robot is turned off, that affect the others. Only three destination modems were used in this test, and there is a difference between a modem that was previously used in other tests and the other two modems that were just recently put in use.
Further investigation must focus in why a modem shut down affect the others and what is the difference in the configuration of the two "new" modems and the "old" one.

Saturday, December 18, 2010

ARToolKit Plus

After several tests with the ARToolkit, I found it to be somewhat limited regarding the flexibility of changing the code. So I decided to try the ARToolKitPlus:, which is written in C++, it is very flexible in configuring my setup and it is still maintened.
Today I performed the calibration to the wide angle lens I am using, and managed to track markers up to a distance of 700 mm from the camera, in an area of approximately 1200 x 1200. It is a very loose setup, so further tests are required. However the results are very promising, as I believe this distance is being limited only by the camera resolution (640x480) which can be increased if I use other cameras.
This toolkit is already integrated in the LARToolkit!

Thursday, December 9, 2010

To do

  • Robots: test new arduinos with new car chassis, must find an h-bridge that is specified for 3.3V, although the l293 that is currently being used at the prototype might work (although it specifies a minimum low logic of 4.5V).
  • Arena: integrate the ARToolkit into the LAR Toolik, test maximum camera height, resolution, and minimum markers size.
  • Xbee: test messaging with one coordinator and several endnodes.
  • Tests: integrate RVO2 Library - Reciprocal Collision Avoidance for Real-Time Multi-Agent Simulation into LAR Toolkit!

Tuesday, December 7, 2010

Related research: Hybrid Reciprocal Velocity Obstacles

Quick reminders

- ARToolKit: just made some tests with this increadible toolkit. I am going to use this to track the robots position and orientation on the arena. Still have to validate this approach, testing camera height, field of view, robustness, integration with the lar toolkit.
- test several xbee messaging: just remembering that I turned off the acknowledge request that was part of a transmit message, this was causing the lag when messages were being sent to a xbee modem that was turned off.

Thursday, November 25, 2010

problem with multiple xbee modems II

The problem persisted even if I did not checked in my software the response.
However, once I turn on the "second" modem things work out just fine. The "second" modem was the one to whom once messages started being sent interfered with the normal working of the modem at the robot. Why??
I am not sure, but at least the problem is narrowed to the Xbee modems, maybe a configuration that can be set via XCTU...
More on that later...

problem with multiple xbee modems

I am currently going through some major problems. So far tests were just fine when using only one coordinator an one destination modem (both router and endnode). However when I tried to use a setup with 3 modems (coordinator + router + endnode) I am experiencing serious lags in communication, for example the gamepad commands take very long to arrive the destination.
In this tests, there is a program that sends messages at a rate of 2Hz, destinated to a modem that is not turned on. (this may be one of the problems, I remember now that once I powered that other modem, things were fine, or am I mistaken?).
Anyway, I am trying to figure out now where is the bottleneck in this setup. I may be in the way I am handling messages at the computer, it may be hardware limitations (xbee buffer, serial channel speed, wireless comm speed...).

robot base validation videos

these three videos show initial tests and final results in constructing a robot based on a rc car chassis. the first video shows the command of the steering angle using an arduino that is receiving commands from the keyboard of a laptop:

the second video shows the robot being remotely commanded by a gamepad via a xbee modem:

the third video is a test of the robot actually moving on the laboratory floor, commanded by a gamepad:

New arduino fio

This is a picture of the new arduino board to be used in this project. It is very small, has an integrated Xbee socket and a LiPo charger. The new power source (LiPo 1000mAh) is also in that picture.

Here is a comparison between the duemilanove and the fio boards:

Wednesday, November 24, 2010

Xbee api + robot

Today I manage to repeat the setup that could command the robot base using the gamepad, via xbee. However the xbee modem is working in API mode. The message payload has three bytes, the first one is used to provide the signal of direction and speed, the second is the direction value and the third is the speed.
The results are much better compared to the older implementation using xbee AT mode. This may be due to the data structure that is now being used.
Now I will post pictures and videos of the completed robot at this point, as it will be unmounted to test the new arduino fio board, with the new 3.7v power supply.
I still want to test the robot behaviour when the coordinator is also sending messages to other modems.

Wednesday, November 17, 2010

xbee api library

Finally (thanks to the invaluable help of Jorge Almeida) I managed to port the arduino xbee library to C++. According to the library website (xbee-arduino) the code could depended only on the serial library and on the millis function. The millis were substituted by the "gettimeofday" function, and the serial lib was substituted by our lab serial lib, written by Ricardo Pascoal.
I managed to compose and send an API packet from a computer program as well as receive and parse a package.
Next step is to cleanup the code, and use the new xbee lib in the program that will be responsible for sending/receiving messages to the modems.

Monday, November 15, 2010

Developments update

Currently I am working creating a xbee api library, so I can create a program that easily send and receives messages through a network of xbee modems, being able to address an individual modem, and being able to know who sent a specific message.
There are already some resources regarding such libraries, even one for arduino, which was tested and worked just fine: xbee-arduino library.
Now I have to adapt that code to be able to run in a Linux machine.

Friday, November 12, 2010

remote command

The current test is the ability to command the robot via a Xbee link, with the lar toolkit at one end, sending messages from the Xbox gamepad.
So far it was found that the xbee devices, (at least while working in AT mode) can have significant delay when the COORDINATOR tries to send messages. According to this forum: XBee series 2 - receiving delay, a possible reason is that the COORDINATOR tries to broadcast messages, while a ROUTER or END NODE, by default, unicast messages to the coordinator, so now the COORDINATOR modem is at the robot and the ROUTER modem is at the command center. It is important to emphasize that the modems will be configured as API in the future, to deal with multiple robots, and it is unknown how good the xbee message rate will be.

steer control - dc motor with potentiometer II

I managed to get the steer control working. There is still some fine tunning to be performed, as for now there is a tolerance of 40 units among the approximate range of 300 units sweeped by the motor in an analogic read. Factors that affect the tunning are: motor voltage, noise in readings, serial outputs...

The car is being powered with a 9V NIMH battery, as the four 1.2 AAA batteries were not providing enough power for the board 5V regulator, which affected the voltage supplied to the steer potentiometer, therefore affecting the analogic read.

Wednesday, November 3, 2010

steer control - dc motor with potentiometer

The motor shield that was built is now being used to command the steer motor. The base comes with a very small dc motor and a potentiometer. How the original electronic worked with that "servo" was not deeply investigated (what is the rated voltage of the motor?).
The test setup is the motor shield + arduino 2009 + potentiometer + dc motor
The potentiometer is being fed with 3v3 5v output from arduino, to have a stable reading. The input goes to an analogic port of arduino and is represented in a scale of 0 to 1023. There is some noise in this readings, around +/- 2 units in the 1024 scale.
note: maybe the maximum reference is still 5v ??
a 3.3v is provided to the outputs of the l293 on the motor shield, by an external power source (in the future this will come from and independent 3v3 regulator, powered by a 3v7 LiPo battery).
the program running at arduino implements a PID control with the aid of the Arduino - PIDLibrary.

Friday, October 29, 2010

Final(?) Hardware Specs and Costs

- base: Wholesale rc car Product-10pcs/lot Mclaren model car Remote control toy ~29€ (40 USD)
- mc:Arduino Fio Sparkfun [SF-DEV-09712] - 19,22 €
- batteries: Polymer Lithium Ion Batteries - 1100mAh Sparkfun [SF-PRT-00339] - 6,41 €
- xbee modem: XBee 1mW Wire Antenna Sparkfun [SF-WRL-08665] - 22,43 €
- build hbridge from lab components: ~10€ (l293e = 6.6€)
- steering servo (not sure if necessary): HobbyKing Online R/C Hobby Store : HXT900 9g / 1.6kg / .12sec Micro Servo ~2€

putting all together, individual robot cost: ~90€
real costs to lab per robot (excluding xbee modem and hbridge costs): ~57€

50% extra batteries:
3+ Polymer Lithium Ion Batteries - 1100mAh [SF-PRT-00339] - 6,41 €
Xbee device to use with the computer:
2x XBee Explorer Dongle [SF-WRL-09819] - 23,07 €
Device to program the arduino:
2x FTDI Basic Breakout - 3.3V [SF-DEV-09873] - 12,82 €
Devices to change the bootloader of arduino (required to wireless program arduino)
1x Pocket AVR Programmer [SF-PGM-09825] - 12,82 €
1x AVR - ICSP Adapter [SF-DEV-09046] - 5,77 €
2x 2x5 AVR ICSP Male Header [SF-PRT-00778] - 0,51 €
Acessories for connections
4x Break Away Female Headers [SF-PRT-00115] - 0,96 €
4x Break Away Headers - Right Angle [SF-PRT-00553] - 0,96 €
4x Break Away Headers - Straight [SF-PRT-00116] - 0,64 €
USB cables to power arduino, recharge batteries, use programmer, use xbee explorer, use avr
4x USB miniB Cable - 6 Foot [SF-CAB-00598] - 2,69 €

Wednesday, October 27, 2010

IW02 Test Report

This is the report of the tests conducted with the RC car chassis, to validate the viability of using such solution. The setup was first assembled in a breadboard linking an Arduino Duemilanove, a Xbee Series 2 and an H-Bridge (L293E). Another Xbee modem was connected to a laptop and sent messages to the remote one (in the car).

This first test was successful, with signals sent via wireless to command the traction motor of the car.
The next step was to build an Arduino compatible shield containing the Xbee and the H-Bridge, to finally test the capability of the car to start the motor with a load applied (the car weight). This test also had good results. The car was fully mobile, and several situations were tested.

Unfortunately the batteries soon wore off and the Arduino board could not obtain enough power. Another minor problem found was a lag of wireless messages, although it was not constant.
The next step is to install new batteries and measure the minimum voltage to start moving the car, and also assess if the servo that came with the RC chassis is good enough for our research purposes.

Monday, October 25, 2010

Current Costs of Robot Base

Estimated current costs (excluding shipping costs):

-base: ~17€ (26 USD)
-mc: ~17€
-batteries: ~6.5€
-xbee modem: ~25€

total so far: 65.5€

what is missing?
deppending if I manage to use the h-bridge that comes with the base:

- build hbridge from lab components: ~10€ (l293e = 6.6€)
- buy motor driver shield:
--- Adafruit Motor/Stepper/Servo Shield for Arduino kit [v1.0] - the best and cheaper ~ 20.5
--- SparkFun Electronics - Ardumoto - Motor Driver Shield ~ 22€
--- Arduino - ArduinoMotorShield ~ 20.5

the xbee support:
- SparkFun Electronics - XBee Wireless Shield
- SparkFun Electronics - XBee Explorer Regulated ~9€ (may require some hardware modifications, don't change ttl signals level)
- SparkFun Electronics - Breakout Board for XBee Module (must build connections and level changer if to use a 5V board) ~ 4.5€
- XBee adapter - Simple wireless communication ~10€ (regulate power and ttl levels, pinout needs adapter)
- Arduino - ArduinoXbeeShield ~17.5€

steering servo:
- HobbyKing Online R/C Hobby Store : HXT900 9g / 1.6kg / .12sec Micro Servo ~ 2€

so, putting all together:
- expensive solution: 105€
- cheap sollution: 82€

Hardware Links II

New hardware specifications for the robot (must create a name)

1/28 firelap2.0 miniz rc car chassis products, from
Wholesale rc car Product-10pcs/lot Mclaren model car Remote control toy (new website)

Arduino Wiki English
Arduino - ArduinoBoardPro (cheaper and cleaner, must decide for whether 3.3V or 5V, this choice may have an implication in the use of arduino compatible shields?)


Arduino - ArduinoXbeeShield (too expensive)
SparkFun Electronics - XBee Explorer Regulated (cheaper and more simple, but may have some design problems: SparkFun Electronics • View topic - XBee Explorer Regulated Bug)
alternatives: XBee adapter - Simple wireless communication or SparkFun Electronics - Breakout Board for XBee Module

RS Cargadores y baterías recargables de NiMH, electrónica de consumo
note: for 5 cars = 20 batteries plus 50% to recharge backups, around 30 batteries, plus 2 chargers, or a big one?

Servos (not completely sure if the are necessary):
HobbyKing Online R/C Hobby Store : Turnigy TG9e 9g / 1.5kg / 0.10sec Eco Micro Servo
HobbyKing Online R/C Hobby Store : HXT500 5g / .8kg / .10sec Micro Servo
HobbyKing Online R/C Hobby Store : HXT900 9g / 1.6kg / .12sec Micro Servo

Xbee Explorer Regulated

I am finding problems related to the xbee adaptor I intented to use.

Arduino + Xbee

Arduino - ArduinoBoardFioProgramming

Sparkfun european distributors

Tienda -, Everything for the electric flight
Watterott electronic

Robot Base

the new website to buy the chassis: Wholesale rc car Product-10pcs/lot Mclaren model car Remote control toy

Sunday, October 24, 2010

Week Review

Effort was mostly spent in validating the base proposal in order to proceed with the purchase process.
The short term goal is to evaluate the traction dc motor from the robot base, by wireless commands sent via xbee. I am afraid that the minimal speed that I could keep the robot moving would be too fast. The test setup:
iw02 base + 4 AAA batteries + arduino + h-bridge + xbee <---> xbee + laptop
I will send speed commands via arduino and evaluate the base movements.
Note: Can I measure the voltage at the motor terminals with arduino?
I will use the xbee modems at AT mode, so one modem will echo commands received from the other (Arduino - ArduinoXbeeShield, XBEE Basics - Community Tutorials).
The next step is to evaluate the steering servo performance, acoording to results, a new servo would have to be bought.

Wednesday, October 20, 2010

Hardware Links

1/28 firelap2.0 miniz rc car chassis products, from

HobbyKing Online R/C Hobby Store : Turnigy TG9e 9g / 1.5kg / 0.10sec Eco Micro Servo
HobbyKing Online R/C Hobby Store : HXT500 5g / .8kg / .10sec Micro Servo
HobbyKing Online R/C Hobby Store : HXT900 9g / 1.6kg / .12sec Micro Servo

Arduino Wiki English


Arduino - ArduinoXbeeShield
XBee® & XBee-PRO® ZB ZigBee® PRO RF Modules - Digi International

Blog start

Last meeting summary:

3 parallel working fronts:

* state of the art: cooperation and competition
* hardware: servo motors, car bases, xbee
* paper: software, simulator, techniques implementation


* buy bases and stepper motors
* xbee libraries
* collision avoidance libraries
* arena modules
* adapt new motors to cars
* test traction motors
* test xbee intercom with developed libs
* ...