Documente Academic
Documente Profesional
Documente Cultură
Abstract
This guide will show how to execute the programs written for my research project on ”A
Multi-Robot Architecture for Autonomous Cooperative Behaviours” on the iRobot robots in
the PAMI lab using the PLAYER and JADE software. It is written for use by the researchers
working with the robots. Basic knowledge of the robots and the software used (see my project
report) is required, Linux experience definitely helpful.
Contents
1 General notes on the working environment 2
2 Robot hardware 2
4 RobotMgr 3
4.1 RobotMgr on Min1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 RobotMgr on the Magellans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 PLAYER setup 4
5.1 Starting PLAYER server and clients . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2 Starting PLAYER to use STAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
6 JADE setup 5
6.1 Starting JADE manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.2 Starting JADE using the bash scripts . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.3 Sending test messages to agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.4 Communication between PLAYER and JADE . . . . . . . . . . . . . . . . . . . . . 8
1
7 The PlayerAgent code 9
7.1 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7.1.1 globalPeriod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7.1.2 moveTimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7.1.3 currentSpeed, currentAngle . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1.4 currentX, currentY, currentYaw . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1.5 AID[] playerAgents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1.6 HashMap agentData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2 Robot hardware
I could not get the batteries for min2 and min3 to work, neither the spare ones. The BIOS
battery of min1 is empty so settings are reseted ever time the robot get disconnected from the
power supply. For this reason a keyboard need to be connected to min1 at the boot time and F1
has to be pressed to ignore a BIOS checksum error found. This is only the case with min1, the
magellans work fine.
The automatic shutdown via the rFlex interface/button on the robot is not powering down the
robot completely after it has been shutdown because it waits for the line ”System halted.” to
appear on the screen - which changed to a slightly different line in the newer kernels. I’m
sometimes having troubles to get the serial connection to the PTZ unit to work - but this is
solved in most of the times by rebooting/ reconnecting the hardware, the wiring is definitely OK.
1
To run Linux apps in Windows see [5] for an example
2
While I was testing PLAYER I also tried the stereo camera on min1 - it seems to work as I could
display its stream via PLAYER/videoplayer on my laptop.
3.0.2 Firewall
The firewall can be modified with the Fedora tool system-configure-security. I enabled some
standard ports like HTTP (needed for JADE), ssh and ports for PLAYER and JADE.
4 RobotMgr
4.1 RobotMgr on Min1
I didn’t try RobotMgr on the ATRVs but I assume that some changes have to be made for
it to work like on the Magellans. Like I described in my report the rFlex device uses its own
abstract units for distance and angle measurement which differ on the ATRVs and the Magellans.
PLAYER uses a variable to convert between those abstract values and the real values in mm
and degree - and those variables differ a lot between those two robot classes. This has to be
considered when using RobotMgr on the ATRVs.
3
4.2 RobotMgr on the Magellans
Because all of the libraries are in a newer version on the Fedora robots the already compiled
binaries from former projects are not running in the Fedora setup anymore and have to be re-
compiled. The two major upgrades are the change from libccgnu to libccgnu2 and RobotMgr
to RobotMgr2. Ben Miners kindly provided me versions of the Findandshoot and the RobotMgr-
Cooperation programs by Mazen and Mackram which compile on the Fedora setup - I put them
into the maze mackram folder of the mobility user.
5 PLAYER setup
5.1 Starting PLAYER server and clients
The only thing which is important for PLAYER[4] is the configuration file which is loaded when
starting it. I prepared two files, rflex.magellan and rflex.atrv for the robots with a bit
different configuration because of the devices on them. Also note that the conversion variables
for angles and distances are quite different on those robots. Those two values are not super exact
but measured experimentally and without a too high quality (due to lack of time to calibrate
everything). The only command to know for PLAYER is thus:
player rflex.magellan or player rflex.atrv
both issued in the home directory of the mobility user.
Connect to the robot with something like this from your PC:
playerv -h mag3
or using the videoplayer:
videoplayer mag3 6665 1
to connect to the compressed stream on device ”camera:1”
4
Figure 1: Screenshot of a running STAGE GUI with a group of robots using their blobfinders to
detect the blue ghost
6 JADE setup
In this project JADE[1] is running on every robot, with one agent for each running PLAYER
server. Unless simulation is done with STAGE this means that one agent is running per JADE
container. To access the other agents on remote robots a common yellow pages server is used.
To achieve this one root container has to be started and the the other JADE installations have
to connect to this root container.
With my computer JADE was a bit picky with the DNS setup, it tries to get the local address
from the /etc/hosts on startup and will use this address as the reply-to- address for the messages
sent out by this platform. I finally got everything to work with this line in the /etc/hosts:
129.97.172.128 localhost pami-nt9.uwaterloo.ca
#127.0.0.1 localhost pami-nt9
#127.0.0.1 localhost pami-nt9.uwaterloo.ca
whereas the commented out lines are given as examples on how not to do it. This took quite
a while to find out and is not as trivial as it seems. Replace both the IP address and the DNS
name with your own data of course.
5
Figure 2: Screenshot of a running JADE GUI with connected containers and their agents
"player0:player.PlayerAgent.PlayerAgent(localhost 6665)"
if the environment is set up and you want to have the GUI (this will only work on local machines).
Now the JADE installation on the clients can connect by issuing this command:
java jade.Boot -container -host NAME OF HOST WITH MAIN CONTAINER \
"DISTINCT AGENT NAME :player.PlayerAgent.PlayerAgent(localhost 6665)"
A messages stating the new joint container will be displayed in the console of the running main
JADE container and the agent can be seen in the GUI like shown in figure 2.
6
6.2 Starting JADE using the bash scripts
I always used small bash script to fire up JADE. They usually only contain oneliners so I don’t
have to remember them...
To let JADE connect to my laptop (pami-nt9.uwaterloo.ca) I wrote this two-liner:
#!/bin/bash
java jade.Boot -container -host pami-nt9.uwaterloo.ca \
"DISTINCT AGENT NAME :player.PlayerAgent.PlayerAgent(localhost 6665)"
where DISTINCT AGENT NAME is replaced with the robot’s name to identify them easier and
\ denotes a line wrap for this document.
On my laptop I usually recompiled the Java stuff, copied it to the right place and started JADE
with multiple agents with a script like this:
#!/bin/bash
javac PlayerAgent.java
cp *.class /usr/share/jade/lib/player/PlayerAgent/
java jade.Boot -gui \
"player0:player.PlayerAgent.PlayerAgent(localhost 6665)" \
"player1:player.PlayerAgent.PlayerAgent(localhost 6666)" \
"player2:player.PlayerAgent.PlayerAgent(localhost 6667)" \
"player3:player.PlayerAgent.PlayerAgent(localhost 6668)" \
"player4:player.PlayerAgent.PlayerAgent(localhost 6669)"
in which the position of the library files should be set in the CLASSPATH and match the setup
in the Java files.
7
Figure 3: Screenshot of the dummy agent in JADE ready to send out a message to multiple
recipients
import javaclient.*;
import javaclient.structures.Blob;
Then the proxy object have to be instantiated for every PLAYER interface to use. That looks
like in the following code taken from my project. The first 3 variables are global for the Agent
and the setup() method is a standard JADE agent function called on startup of the agent. In it
I will start with processing the command line options which were given like specified in section
6.1.
8
Object[] args = getArguments();
String arg1 = args[0].toString(); // this returns the String with the hostname
of the robot
String arg2 = args[1].toString(); // this returns the String of the portnumber
of the player server
player = new PlayerClient(arg1,Integer.parseInt(arg2));
position = player.requestInterfacePosition(0, ’a’); //a, r or w
blobfinder = player.requestInterfaceBlobfinder(0, ’r’); //a, r or w
player.runThreaded (-1, -1);
}
To find out more about the JavaClient try the excellent automatic documentation on the Java-
Client webpage[3].
After the setup is done commands can be sent to the robot like this:
position.setSpeed(currentSpeed,currentAngle);
Sensor data can be accessed like this:
currentX=position.getX();
currentY=position.getY();
currentYaw_temp=position.getYaw();
7.1.1 globalPeriod
This is the time in ms in which the report behaviour interacts with the Player server using the
Java-Client proxy. Because this is the minimum time in which commands are sent all Ticker-
Behaviours should not be called more often than this value, in fact I used a period time of
5*globalPeriod for most other ticker behaviours.
7.1.2 moveTimer
This variable saves the time the current movement should continue and is independent from the
speed values themselves, but should be set everytime the speed is changed to prevent to robot
from driving with full force for 10 minutes! It is decremented by 1 everytime Report is called, so
every globalPeriod ms. To drive for 1 second I used code like this:
moveTimer=1000/globalPeriod;
9
7.1.3 currentSpeed, currentAngle
These two variable contain the speed values which will be sent to the Player server and thus the
hardware next time the Report behaviour is called. They should always be set together and with
the moveTimer variable to prevent unwanted movements. Because of this only one behaviour
should set these variable at a time but this is not enforced by the framework so far. These values
have a maximum limit defined in MAX SPEED and MAX SPEED ANGLE. This limit is enforced just
before the values are passed to the hardware.
8.1 PlayerAgentShadow
PlayerAgentShadow is a unfinished project by me to use one agent to communicate with two
player instances - one simulated and one real. The ideas is to use this agent to visualize the
existing robot when it interact with the simulated robots - in a formation for example. To get
this behaviour the agent is using the Report function to query the player instance on the real
robot and then sets the 2DPose of the robot using the simulation interface of STAGE.
The code is running and displaying the movements of the real robots right now, but the simulated
10
robot seem to turn and move greater distances than the real one - this is probably only a unit
conversion problem. To use the PlayerAgentShadow it must be started with 4 options: DNS
name of real robot, its port, DNS name of simulated robot, its port. This is in my case something
like
java jade.Boot -gui "player0:player.PlayerAgent.PlayerAgent(localhost 6665)" \
"min1Sim:player.PlayerAgentShadow.PlayerAgentShadow(min1 6665 localhost 6669)"
to get an agent called min1Sim which controls the 5th simulated robot and uses the data from
the PLAYER server running on min1. I modified the everything.cfg for STAGE to make this last
simulated robot black for easier identification, you can use this file if you wish.
11
8.4 Error handling
So far not too many error are caught - simply because I have not too much experience with Java
error handling. This should be improved.
References
[1] Java Agent DEvelopment framework http://jade.tilab.com/
[4] The Player/Stage Project: Tools for Multi-Robot and Distributed Sensor Systems. Proceed-
ings of the International Conference on Advanced Robotics (ICAR 2003),pages 317-323
12