Controller is different after reset

Requests regarding how to set up experiments in ARGoS.
AshwinRaviraj
Posts: 13
Joined: Mon Apr 19, 2021 9:40 pm

Controller is different after reset

Postby AshwinRaviraj » Wed Apr 21, 2021 2:19 pm

Hi, After I'm Resetting my loop function in my post experiment function, the behaviour of the controller is not working? Is there anything wrong with what I'm doing in my post experiment?

Code: Select all

CSimulator &cSimulator = CSimulator::GetInstance(); cSimulator.SetExperimentFileName("FILE_NAME"); cSimulator.LoadExperiment(); cSimulator.Execute(); cSimulator.Reset();

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

Re: Controller is different after reset

Postby pincy » Wed Apr 21, 2021 2:27 pm

Where is this code written? Are you referring to CSimulator::PostExperiment()? What are you trying to accomplish?
I made ARGoS.

AshwinRaviraj
Posts: 13
Joined: Mon Apr 19, 2021 9:40 pm

Re: Controller is different after reset

Postby AshwinRaviraj » Wed Apr 21, 2021 2:33 pm

This is written in my loop_functions.h where I have a PostExperiment() function, and what I'm trying to do is restarting the experiment.
Without running the .agros file from terminal.

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

Re: Controller is different after reset

Postby pincy » Wed Apr 21, 2021 2:40 pm

Can you share your code? I do not understand why those four lines are inside PostExperiment. That's not supposed to be the place where those fours lines go. Have you checked this example?
I made ARGoS.

AshwinRaviraj
Posts: 13
Joined: Mon Apr 19, 2021 9:40 pm

Re: Controller is different after reset

Postby AshwinRaviraj » Wed Apr 21, 2021 2:44 pm

So, am I writing it the wrong place?
Should I follow the same structure as galib?

Code: Select all

virtual void PostExperiment(){ CSimulator &cSimulator = CSimulator::GetInstance(); cSimulator.SetExperimentFileName("huddling.argos"); cSimulator.LoadExperiment(); cSimulator.Execute(); cSimulator.Reset(); }
I do apologise for not being very precise. And thank you for helping me out!

I did look at the main.cpp file, but couldn't figure out how I should set it up with my experiment.

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

Re: Controller is different after reset

Postby pincy » Wed Apr 21, 2021 2:51 pm

I don't understand what you're trying to accomplish. If what you want is resetting after the end of each experiment, make a main.cpp of your own that simply has a while loop as follows:

Code: Select all

cSimulator.LoadExperiment(); // load XML file *once* while(not done) { // your logic defines what "done" means cSimulator.Execute(); // run experiment cSimulator.PostExperiment(); // do something with the collected data cSimulator.Reset(); // reset the experiment }
I made ARGoS.

AshwinRaviraj
Posts: 13
Joined: Mon Apr 19, 2021 9:40 pm

Re: Controller is different after reset

Postby AshwinRaviraj » Wed Apr 21, 2021 2:57 pm

Once again thanks for your help, I will give it a try!


Return to “How to... ?”