Tuesday, April 28, 2009

Execution of programs for both robots


Hi everyone!

As Arturo said, hope you are all influenza free ;).

I just figured out how to make both robots run programs. I had to modify the lab2piso.cfg file (I created a lab2piso.2.cfg file) and defined two different models, one for each robot with two specific ports like so:

driver
(
name "vfh"
provides ["6665:position2d:1"]
requires ["position2d:0" "laser:0" ]
)

# robot2
driver
(
name "stage"
provides ["6666:position2d:0" "6666:laser:0" "6666:sonar:0" ]
model "robot2"
)
driver
(
name "vfh"
provides ["6666:position2d:1"]
requires ["position2d:0" "laser:0" ]
)

Then, I looked into laserobstacleavoid's code and noted the library "args.h". Inside this library there is a function called print_usage which tells the parameters you can provide to the program. In this way, according to the ports I determined for each robot I execute the laserobstacleavoid program for one of them in this way: ./laserobstacleavoid -p 6666 and for the one whose port is 6665 I executed the example we created previously in this way: ./example.0.1.2.

In the case of example.0.1.2 it is automatically executed in te robot whose port is 6665, however if I add the "args.h" library I suppose I could execute it for both robots using -p.

Here is a screenshot of the two robots navigating in the lab2piso.world.
I hope the epidemic issue ends soon enough, meanwhile take lots of care.

See you!
Laura

No comments:

Post a Comment