Footbot Speed Oracle
Posted: Wed Aug 10, 2016 7:12 pm
by DrLeopoldStrabismus
I want to measure and log the actual speed (both linear and angular) of each footbot throughout a simulation run. Note that I'm looking for the actual speed as known to the physics engine: if the footbot is already collided with a wall and attempts to drive "into" the wall, it looks like the differential_steering_sensor would report whatever attempted velocity was sent to the differential_steering_actuator.
Now I've fully jumped into the deep-end of trying to understand the chipmunk-physics engine.
What's the sane way for me to measure the actual speed of the footbot?
Re: Footbot Speed Oracle
Posted: Thu Aug 11, 2016 9:03 pm
by pincy
In fact, the necessary methods were missing. I added them in the current upstream development in ARGoS. I plan on having a new version by the end of the month (beta42).
Update ARGoS using the sources on GitHub, and write something like this:
Code: Select all
// Reference to a foot-bot - how to fill its value depends on your code
CFootBot& cFB = ...
// Get the robot body
CEmbodiedEntity& cFBEE = cFB.GetEmbodiedEntity();
// Get the physics model in the engine "dyn2d"
CDynamics2DFootBotModel& cFBPM = dynamic_cast<CDynamics2DFootBotModel &>(cFBEE.GetPhysicsModel("dyn2d"));
// Get the robot body (this is one of the methods I had to add)
cpBody* ptFBBody = cFBPM.GetActualBaseBody();
// The current linear velocity is a cpVect (see cpBody.h)
// ptFBBody->v
// The current angular velocity is a cpFloat (see cpBody.h)
// ptFBBody->w
Cheers,
Carlo
Re: Footbot Speed Oracle
Posted: Fri Aug 12, 2016 12:13 am
by DrLeopoldStrabismus
Thanks very much!