Page 1 of 1

Robot movement after collision

Posted: Thu Dec 05, 2013 5:58 pm
by Elendurwen
I have a couple of robots in my argos3 application that move around. Occasionally, they bump into each other, at which point they use the diffuctionVector from the argos foraging example (footbot_foraging.cpp file) to move away from each other. That's all fine. However, sometimes a robot after a head-on collision would not move, even if nothing is in its way. I originally thought that was just a bug in my code, but I am reading the values set to the wheels and the values from the differential steering sensor and they all seem fine.

If the maximum wheel speed is e.g. set to 20, then I can read that the values sent to

Code: Select all

wheels->SetLinearVelocity(left_, right_);
are 20, 20. Afterwards, values read by the

Code: Select all

const CCI_DifferentialSteeringSensor::SReading& steeringData = steeringSensor->GetReading(); interWheel = steeringData.WheelAxisLength * 0.01; distR = steeringData.CoveredDistanceRightWheel * 0.01; distL = steeringData.CoveredDistanceLeftWheel * 0.01;
are also correct, 0.02 and 0.02.
However, visually, the robot keeps rotating at one spot, as if one wheel was not getting any actual speed. It is only when another robot comes and hits it so that it moves a bit that the robot actually continues moving correctly.

Needles to say, this completely screws up odometry. Have you every noticed anything similar? Is there an easy fix?

Re: Robot movement after collision

Posted: Thu Dec 05, 2013 7:11 pm
by pincy
I have never seen such an issue, but it's hard to reply without the code. Could you please attach it?

Also note that 20cm/s is a pretty unrealistic speed for flocking. In my experience, values up to 5cm/s are the limit, especially when real robots are involved.

Re: Robot movement after collision

Posted: Thu Dec 05, 2013 7:19 pm
by Elendurwen
Thanks for your reply. I changed the max speed to 10, as per the foraging example and now I cannot reproduce the bug. I'll post my code here later if I can find it again.

Re: Robot movement after collision

Posted: Thu Dec 05, 2013 7:40 pm
by pincy
Good to know!

It is possible that with 20 cm/s the contact solver was having a hard time.

If you need to have such a high speed, and my guess is right, you have another way around.

In the .argos file, you can increase the number of iterations per step. The default value is 10, but you can try with a higher value, such as 50.

Code: Select all

<physics_engines> <dynamics2d id="dyn2d" iterations="50" /> </physics_engines>
High values slow down the simulation, but they also make it more realistic.

Cheers,
Carlo

Re: Robot movement after collision

Posted: Thu Dec 05, 2013 7:51 pm
by Elendurwen
Ok, thanks !