changing config

Requests regarding how to set up experiments in ARGoS.
dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

changing config

Postby dmb » Wed Jul 03, 2019 4:39 pm

Hi there,

I would like to change the configuration that is used during runtime, would that be possible ?

If so, how is that best done ?

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

Re: changing config

Postby pincy » Wed Jul 03, 2019 4:42 pm

No, this is not possible by design. If you need to make changes to the simulation, the loop functions are the way to go.
I made ARGoS.

dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Wed Jul 03, 2019 4:57 pm

ok good to know. thanks for the quick reply.

dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Wed Jul 03, 2019 8:51 pm

I was thinking of two ways to change the configuration. For example, if I want to add robots or obstacles, then I was thinking to start with zero of each of them, and then add them manually in the loopfunctions Init or Reset.

Is there any sound way of doing this ? Should they be registered in a special way to be recognised by the simulator, or is it sufficient to just create robot instances ?

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

Re: changing config

Postby pincy » Wed Jul 03, 2019 9:05 pm

Check the ARGoS examples, all of these basic use cases are covered in detail. In particular, the "custom distributions" example is what you need: https://github.com/ilpincy/argos3-examp ... _functions
I made ARGoS.

dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Thu Jul 04, 2019 2:03 pm

This example seems to be using a fixed number of robots, just a bit more flexible in the way to distribute them.

Also the number of robots is determined at Init; is it possible to determine it some later time ?

I can see that if possible, then using AddEntity is useful to use manually outside Init, in case you want to generate the new robots. However, if the number of robots needs to be changed in between simulations, then would you also need a 'RemoveEntity' or something like that ? Does that exist ?

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

Re: changing config

Postby pincy » Thu Jul 04, 2019 4:49 pm

Yes, all of these things exist and are routinely done by the users. Please do take the time to familiarize yourself with the API of the loop functions. To change the number of robots you simply have to change the code so the number of robots can be passed in the .argos file, in the same way this example and the foraging example accept values as parameters.
I made ARGoS.

dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Thu Jul 04, 2019 5:15 pm

I still think we are not talking about the same thing.
To change the number of robots you simply have to change the code so the number of robots can be passed in the .argos file,
I am well aware of passing the number of robots to the configuration file. As in my initial post I am talking about loading different number of robots at different times during the same program. You also said it is not possible to change the configuration at runtime, so not sure why you would recommend reading the number of robots directly from configuration file. Simply reading the number of robots from one config would assume the number of robots is static, unless as my initial post, you would be able to change the robot configuration that is being loaded.

One of the things that I tried in the past was to remove the current configuration being loaded, by calling Destroy() on CSimulator itself, but then that still did not remove the existing robots. Currently one of the issues I am having is that if you generate 8 robots at first, and then later want only 5, then agents 6-8 are not straightforwardly removed.

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

Re: changing config

Postby pincy » Thu Jul 04, 2019 5:22 pm

Currently one of the issues I am having is that if you generate 8 robots at first, and then later want only 5, then agents 6-8 are not straightforwardly removed.
There is a function CLoopFunctions::RemoveEntity() that you can use to remove excess robots, depending on the logic of your experiment. Using CLoopFunctions::AddEntity(), you can add new robots back in simulation.

Are you trying to run experiments back-to-back, in a sequence? Or are you trying to add and remove robots during a single experiment? This is unclear in your question.
I made ARGoS.

dmb
Posts: 14
Joined: Wed Jun 26, 2019 11:25 pm

Re: changing config

Postby dmb » Thu Jul 04, 2019 6:00 pm

I think back-to-back in sequence would describe what I want to do.

Essentially I am trying a while loop along these lines:

while True:
1. do argos-unrelated stuff
2. change the settings (e.g., arena size, robots, obstacles)
3. run argos experiments for some times with the new settings, each time applying Reset based on these new settings

Adding or removing entities manually at step 2 could be part of the solution i.e. for robots and obstacles, but then arena size and other configuration parameters might be difficult. Manually destroying the CSimulator and then constructing it again with a new configuration would be the ideal solution for me.


Return to “How to... ?”