The problem in your code is that you have these lines in your controller:
Code: Select all
CQuadcopterLoopFunctions* trailpheu = new CQuadcopterLoopFunctions;
CQuadcopterLoopFunctions::Trailphe& trailphe = trailpheu->GetTrailData();
You seem to have not understood how ARGoS works. When you do a real-word experiment, you have two things to set up: (a) the experimental arena, and (b) the robot controller.
ARGoS, as a simulator, allows you to do the same.
- Regarding the experimental arena in the real world, there are (1) static aspects, like the position of the walls, and (2) dynamic aspects, like you, as a person, moving robots around and taking measures as the experiment goes to evaluate the robot controller. In ARGoS, (1) maps to the .argos file, and (2) maps to the loop functions. In other words, the loop functions are a set of functions executed by ARGoS to allow you to play "God mode" on the simulation.
- Regarding the robot controller, this in ARGoS simply maps to the controller class.
For this reason, creating a loop function in the controller makes no sense. It is like you going "inside" the robot and then trying to change the world from there.
Have a look at how the foraging examples is made: the loop functions, playing the role of you, collect a list of pointers to robot controllers. Then, data is exchanged between the robot controllers and the loop functions just by calling relevant functions
of the controller in the loop functions. This is because you, as "God", can modify the world as you please; but robots can't, they need to use their sensors and actuators.
Hope this clears a bit how ARGoS works. As for what you want to achieve, you simply need to add a method in the robot controller that allows one to get the values that you want to store in the loop functions. Then, in the loop functions you add a loop executed when necessary (e.g., after each time step) that goes through the controllers and collects the data.
Cheers,
Carlo
I made ARGoS.