Two footbots with different controllers

Requests regarding how to set up experiments in ARGoS.
jaffar
Posts: 16
Joined: Fri Nov 28, 2014 9:50 am
Location: Abbottabad
Contact:

Two footbots with different controllers

Postby jaffar » Wed Mar 25, 2015 12:13 pm

Hi

I add two footbots in my XML file. Now I am trying to make them with saparate controllers. But when I add another controller with different id so error occured.

Is it possible to add different controllers for bots? If yes then how can I do it?

Thanks

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Two footbots with different controllers

Postby pincy » Wed Mar 25, 2015 12:21 pm

Yes, it's possible. See this example in which two controllers are defined and two robots are added. One robot uses the first controller, the second robot uses the second.

Code: Select all

<argos-configuration> ... <controllers> <my_controller_1 id="c1"> ... controller configuration </my_controller_1> <my_controller_2 id="c2"> ... controller configuration </my_controller_2> </controllers> <arena ...> <foot-bot id="f1"> <body position="..." orientation="..."> <controller config="c1"> </foot-bot> <foot-bot id="f2"> <body position="..." orientation="..."> <controller config="c2"> </foot-bot> </arena> ... </argos-configuration>
I made ARGoS.

jaffar
Posts: 16
Joined: Fri Nov 28, 2014 9:50 am
Location: Abbottabad
Contact:

Re: Two footbots with different controllers

Postby jaffar » Thu Mar 26, 2015 12:16 pm

Hi

I added two different controllers. But the following error occur.
Error creating new controller "fdc1" for robot "fb_1" [nested: "CARGoSException thrown: /home/pincy/Fabrica/argos2/simulator/dynamic_linking/dynamic_linking_manager.cpp:262
Unknown controller type "footbot_diffusion_controller1""]
How can I fix this error?

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Two footbots with different controllers

Postby pincy » Thu Mar 26, 2015 12:39 pm

Can you please include the .argos file your are trying to use?

The error you get simply tells you that ARGoS does not know of any controller registered with the name "footbot_diffusion_controller1".
I made ARGoS.

jaffar
Posts: 16
Joined: Fri Nov 28, 2014 9:50 am
Location: Abbottabad
Contact:

Re: Two footbots with different controllers

Postby jaffar » Thu Mar 26, 2015 1:12 pm

Hi,

But when I register footbot_diffusion_controller1, then during 'make' the following error occur.
:131:21: error: redefinition of ‘CFootBotDiffusion_proxy CFootBotDiffusion_p’
REGISTER_CONTROLLER(CFootBotDiffusion, "footbot_diffusion_controller1")
^
/home/jaffar/argos2-examples/controllers/footbot_diffusion/footbot_diffusion.cpp:130:21: error: ‘CFootBotDiffusion_proxy CFootBotDiffusion_p’ previously declared here
REGISTER_CONTROLLER(CFootBotDiffusion, "footbot_diffusion_controller")
^
make[2]: *** [controllers/footbot_diffusion/CMakeFiles/footbot_diffusion.dir/footbot_diffusion.cpp.o] Error 1
make[1]: *** [controllers/footbot_diffusion/CMakeFiles/footbot_diffusion.dir/all] Error 2
make: *** [all] Error 2
I register both controllers footbot_diffusion_controller and footbot_diffusion_controller1.
How should I fix that error.

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Two footbots with different controllers

Postby pincy » Thu Mar 26, 2015 3:03 pm

I really don't understand what you are trying to achieve.
Why do you register the controller twice? That's not the correct way to have multiple controllers in ARGoS.

You register the controller *once*, and then in the .argos file mention it twice.

Maybe you're confusing the registration label ("footbot_diffusion_controller") for the controller id. The registration label is used by ARGoS to identify a specific controller class; if you want to have the same class configured in two different ways, you just need to put two sections for the controller in the .argos file.

Also, it would be really helpful if you included the files. Without those, it is hard for me to understand the context of the errors you find.
I made ARGoS.

jaffar
Posts: 16
Joined: Fri Nov 28, 2014 9:50 am
Location: Abbottabad
Contact:

Re: Two footbots with different controllers

Postby jaffar » Tue Mar 31, 2015 9:18 am

Hi,

Thanks it working.


Return to “How to... ?”