Difference between revisions of "Footbot/Real robot information"

From IridiaWiki
Jump to navigationJump to search
Line 38: Line 38:
   
 
== Bluetooth ==
 
== Bluetooth ==
 
=== Where to put the mini key on the footbots? ===
 
 
The connector for a connection to the IMX is "UART1" next to the IMX. The key as to be outward facing (usually it's marked white on the side for pin 1, look for the 1 on the PCB).
 
   
 
=== udev setup ===
 
=== udev setup ===
Line 62: Line 58:
   
 
ACTION=="add", SUBSYSTEM=="tty", KERNEL=="rfcomm[0-9]*", WAIT_FOR_SYSFS="address", ATTR{address}=="10:00:E8:6C:F0:4D", SYMLINK+="handbot1", MODE="0666"
 
ACTION=="add", SUBSYSTEM=="tty", KERNEL=="rfcomm[0-9]*", WAIT_FOR_SYSFS="address", ATTR{address}=="10:00:E8:6C:F0:4D", SYMLINK+="handbot1", MODE="0666"
  +
  +
rfcomm connect /dev/rfcomm1
   
 
You should then see the device /dev/handbot1 linked to /dev/rfcomm1.
 
You should then see the device /dev/handbot1 linked to /dev/rfcomm1.
   
=== Aseba connect ===
+
=== Connect with aseba ===
   
 
Connect with aseba using the following connection string:
 
Connect with aseba using the following connection string:
Line 77: Line 75:
 
* rfcomm bind /dev/rfcomm1
 
* rfcomm bind /dev/rfcomm1
 
* rfcomm unbind /dev/rfcomm1
 
* rfcomm unbind /dev/rfcomm1
  +
  +
=== Connect to the IMX ===
  +
 
==== Where to put the mini key on the footbots? ====
  +
 
The connector for a connection to the IMX is "UART1" next to the IMX. The key as to be outward facing (usually it's marked white on the side for pin 1, look for the 1 on the PCB).
  +
  +
==== Connect to shell ====
  +
  +
Setup the device as described above so that the serial device /dev/footbotX exists. Then, use minicom or similar to connect to the device.
  +
  +
minicom -s
  +
  +
Change the serial port to the device of the robot. Then select exit and press enter 2-3 times. You should see a shell.
   
 
== Wifi ==
 
== Wifi ==

Revision as of 15:35, 12 April 2010

EPFL LSRO Wikipages

For updated info go to the EPFL wiki. http://wiki.epfl.ch/mobots-robots

Downloading ARGOS2

To download ARGoS2, you need git. First, create the file ~/.netrc with this content:

machine iridia-dev.ulb.ac.be
login YOUR_USERNAME
password YOUR_PASSWORD

and secure it:

$ chmod 600 ~/.netrc

Subsequently, configure git (once and for all) to accept Iridia dev's autosigned certificate:

$ git config --global http.sslVerify false

Finally, download the code:

$ git clone https://iridia-dev.ulb.ac.be/projects/argos2.git argos2

Connecting to a footbot

Wifi uses wpasupplicant to connect to a WPA-PSK access point. You can use USB or Bluetooth to connect to the robot otherwise. Set the selector on the robot top to an even value for USB, and uneven to Bluetooth.

USB

$ sudo /sbin/ifconfig usb0 192.168.0.200 netmask 255.255.255.0
$ ssh root@footbot_usb

footbot_usb is aliased to ip 192.168.0.202 in /etc/hosts. In asebastudio, to connect use

 tcp:host=192.168.0.202;port=33333

Bluetooth

udev setup

First, you have to setup the bluetooth connection via udev. We'll use 10:00:E8:6C:F0:4D and a handbot1 as an example here, replace accordingly. You have to be root for that.

 hcitool scan

Take note of the MAC address displayed.

 cd /etc/bluetooth/
 mkdir -p passkeys
 echo -n '0000' > passkeys/10:00:E8:6C:F0:4D

Edit the file /etc/rfcomm.conf and add the following line:

 rfcomm1 { bind yes; device 10:00:E8:6C:F0:4D; }

Edit the file /etc/udev/rules.d/90-local.rules and add the following line:

 ACTION=="add", SUBSYSTEM=="tty", KERNEL=="rfcomm[0-9]*", WAIT_FOR_SYSFS="address", ATTR{address}=="10:00:E8:6C:F0:4D", SYMLINK+="handbot1", MODE="0666"
 rfcomm connect /dev/rfcomm1

You should then see the device /dev/handbot1 linked to /dev/rfcomm1.

Connect with aseba

Connect with aseba using the following connection string:

 ser:device=/dev/handbot1

If it does not work (device not there, does not bind), try one of the following:

  • restart bluetooth
  • restart udev
  • rfcomm bind /dev/rfcomm1
  • rfcomm unbind /dev/rfcomm1

Connect to the IMX

Where to put the mini key on the footbots?

The connector for a connection to the IMX is "UART1" next to the IMX. The key as to be outward facing (usually it's marked white on the side for pin 1, look for the 1 on the PCB).

Connect to shell

Setup the device as described above so that the serial device /dev/footbotX exists. Then, use minicom or similar to connect to the device.

 minicom -s

Change the serial port to the device of the robot. Then select exit and press enter 2-3 times. You should see a shell.

Wifi

Works "normally" pretty reliable when used with static IPs. Follow the instructions on http://wiki.epfl.ch/mobots-robots/Wifi h.

Booting

Beware of the sudden movement of the robot as it's booting. NEVER put it on a table when testing.

Connect with aseba with this custom destination:

tcp:host=192.168.0.202;port=33333

Does not work?

If Aseba connection doesn't work, try again without killing asebamedulla; otherwise, close Asebastudio. Restart asebamedulla, the pics and reload the backend

/etc/init.d/asebamedulla.sh restart
/etc/init.d/dspics-power.sh restart
/etc/init.d/ARGoS.sh restart

If this does not work, reset the translator and the pic per button. Rerun asebamedulla and try connecting.

If this does not work, do the same as above with setting the selector to another even value (NOT an odd one!). Try connecting again.

Battery

* full battery = 4.2V
* empty battery < 3.6V 

The charger we have at Iridia damages the batteries. We were given 12 batteries; to limit the number of damaged batteries, 10 batteries, when empty, won't be recharged. Only two batteries will be recharged.

Sensors

Camera

Cameras don't work at the same time; you can use them one by one.

If you want to stream images out of the footbot camera, in /home/root/ARGoS/bin you will find a program named mobotsvision. It is a streaming server.

To use it, the syntax is:

$ cd /home/root/ARGoS/bin
$ ./mobotsvision <omnidirectional|ceiling> <gain> <exposure>

The first argument lets you select the camera to stream images from; the gain is the amount of signal amplification you want (0-127). A low value makes the images darker, a high value makes them brighter but also much noisier. The exposure is the total amount of light allowed to fall into the CCD sensor. Its range is 0-255. A low value makes images very dark, a high value makes them very bright. The exposure is linked to the time needed to take an image; a low value entails high frame rate, a high value entails low frame rate.

When running the server, if you get an error such as:

 [FATAL] Cannot open /dev/video0: Input/output error

then try unbinding the driver and then binding it back. You do it this way:

$ echo 0-0 > /sys/bus/soc-camera/drivers/camera/unbind
$ echo 0-0 > /sys/bus/soc-camera/drivers/camera/bind


When programming a low level tool for the robot, to select the camera to use, echo to file /sys/class/gpio/gpio28/value a value of 0 for the omnidirectional camera and 1 for the front one. The camera module is mt9t031.ko.

For problems, the EPFL guy to ask is Valentin Longchamps <valentin.longchamps@epfl.ch>.

Actuators

Turret Rotation

At boot, the robot sets the 0 position of the turret. To avoid damaging the robot or having funny values, always put the gripper back in the 0 position and then switch the robot on. It can be done also when the robot is on already: set the variable 'rev.pid.enable' to 0 and rotate the turret back to its position. Then select 'Tools->Reboot->Griper-led' and the new 0 position will be set.

Framework

Compiling ARGoS for the real robot

Download and install the toolchain from http://wiki.epfl.ch/mobots-robots/toolchain . It is recommended to install it system-wide because it hasn't been tested otherwise.

Configure your environment for cross-compilation:

$ source /usr/local/angstrom/arm/environment-setup

Then, compile the common package:

$ cd /path/to/argos2
$ cd common
$ mkdir -p build/footbot
$ cd build/footbot
$ cmake -DARGOS_COMPILE_REAL_FOOTBOT=1 ../..
$ make

If everything goes OK, compile the real robot package:

$ cd /path/to/argos2
$ cd real_robot
$ mkdir -p build/swarmanoid/footbot
$ cd build/swarmanoid/footbot
$ cmake ../../../swarmanoid/footbot
$ make

If everything goes OK, compile the user package:

$ cd /path/to/argos2
$ cd user/my_user
$ mkdir -p build/footbot
$ cd build/footbot
$ cmake -DARGOS_COMPILE_REAL_FOOTBOT=1 ../..
$ make

Installing the libraries in the real robot

If you log into the robot, you'll notice a directory ARGoS. It contains the aseba backend (aseba_backend.aesl), some useful tools in bin/ and a directory lib/ in which the ARGoS libraries are stored. Whenever you fix the common or real robot packages, you have to update these libraries. To do it, the handiest way is the following.

Create a directory to install ARGoS locally:

$ cd /path/to/argos2
$ mkdir install

Install the common package libraries:

$ cd common/build/footbot
$ DESTDIR=../../../install make install

Same thing for the real robot package:

$ cd /path/to/argos2
$ cd real_robot/build/swarmanoid/footbot
$ DESTDIR=../../../../install make install

Now go into the install directory:

$ cd /path/to/argos2
$ cd install

And get into the directory where the libraries have been copied:

$ cd usr/local/lib/argos2
$ ls

Copy all the libraries onto the robot:

$ scp * root@footbot_usb:~/ARGoS/lib/

Using your controller on the real robot

So you managed to compile the controller on your pc and maybe also to update the libraries. Now what?

When you have compiled your controller you will see that in "build/controller/name_of_your_controller/" you will find and executable file. This file has to be uploaded to the real robot.

Once this is done, connect with aseba to the robot (good luck) and then you execute aseba_backend.aesl (you can find this file on the robot, under ~/ARGoS).

Now you can run your controller:

[on the robot] ./your_controller -c FILECONFIG.xml -i ID_CONTROLLOR

where FILECONFIG.xml is the same xml you used in your simulated experiments and ID_CONTROLLER is the id of your controller (really?) meaning the id that is in the xml.


e.g. with "footbot_obstacle_avoidance":

./footbot_obstacle_avoidance -c obstacle_avoidance.xml -i sfc

Using the joypad to control a footbot

If you want to test the robots with the joypad you need a program that converts the input from your joypad to events into aseba. This program is called "asebarc" and you can ask it to Manuele, Carlo or Eliseo. Once you have compiled this, connect to the robot with aseba and run "marxbot-swarmanoid-rc.aesl" (as before, ask this file to somebody). On your pc, run "asebarc" with this command:

./asebarc "tcp:host=192.168.0.202;port=33333"

You should now be able to control the footbot with the joypad.

One last thing that you have to know is that the buttons on the back of the joypad (R2 and L2, i think) are used to switch the mode of the turret between passive and rigid. The button that turns the light blue set the turret passive, while the one that turns the light green turns the turret rigid.