if in xml example

Requests regarding how to set up experiments in ARGoS.
vlsi
Posts: 3
Joined: Thu Mar 21, 2013 3:41 pm

if in xml example

Postby vlsi » Wed Aug 28, 2013 1:12 pm

Hello again,

I would like to make a scenario with 4 entities, that follow the same behavior (controller), but send them incrementally search an environment. I know that I could set different initial positions from the xml file, but I would like to do it differently: All entities exist at the same initial position, and then launch the 1st entity, and then follow a pattern (controller), launch the 2nd entity and start from another position and follow the same pattern, 3rd from another position etc. I was wondering if I can do that in the xml file, and resemble somehow what I would do in reality with robots. Can I set a time variable or point with if control loop in the xml? ie. if (time< time_start), or if (you have reached point (0,0) ) do some actions? and where in the xml code should that be?

Thank you in advance!

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

Re: if in xml example

Postby pincy » Wed Aug 28, 2013 1:46 pm

Hi,

to help you, I need a little clarification.
All entities exist at the same initial position, and then launch the 1st entity, and then follow a pattern (controller), launch the 2nd entity and start from another position and follow the same pattern, 3rd from another position etc.
I don't understand what you mean when you say that all the entities exist "at the same initial position" but they "start from another position".
Can I set a time variable or point with if control loop in the xml? ie. if (time< time_start), or if (you have reached point (0,0) ) do some actions? and where in the xml code should that be?
If all you want is a per-robot timer, in the controller you can just add a little counter that gets incremented in the Step() method. Each robots keeps increasing the counter until a certain value is reached. Since each robot has a different max value, you can check the id of the robot using CRobot::GetRobotId() and assign a different max value to each robot.

If, instead, you want to say "let the next robot start when the previous has reached position X", you need the loop functions. In general, if you want to interact with the simulation in a god-like fashion (moving/adding/removing robots, get data, etc.) you need to use the loop functions, as shown in the foraging example.

Let me know if I understood your problem. If so, I can provide you with code examples.

Cheers,
Carlo
I made ARGoS.

aredhel
Posts: 1
Joined: Fri Jun 14, 2013 11:30 am

Re: if in xml example

Postby aredhel » Tue Sep 17, 2013 11:06 am

Hello Carlo, please excuse me for this delayed answer. Some deadlines came up and I needed to leave this scenario for a while. Well what I meant but didn't pose the question well, is to start from the same position, but then migrate to another predefined position (different from each other, set by xml file). Actually I did that. :D

I have 4 entities now that run the same algorithm but perform it from different positions. Now it's working but I was not sure how it should look like before.

I will have a look at this GetRobotId. It will be very useful since I want now to make them "feel" which neighbors they have. I will be back, sooner this time :)

Thanks a lot for your help !

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

Re: if in xml example

Postby pincy » Tue Sep 17, 2013 11:06 pm

Great news! Cheers :-)
I made ARGoS.


Return to “How to... ?”