Page 1 of 1

Angle and distance with kilobots

Posted: Fri Oct 01, 2021 5:22 pm
by AntonioC
How can I detect the distance traveled by a kilobot and the angle of rotation?

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 5:25 pm
by pincy
The real kilobot has no sensor that provides that type of information, so your only option is some form of "cheating".

Do you need the information available in the kilobot controller or it's something you need for data analysis, so the loop functions would be more appropriate?

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 5:37 pm
by AntonioC
This is the situation:
Kilobots move randomly. Whenever a kilobot changes direction I need to measure the distance it travels. Every time it changes direction I need to measure the angle.
I could also not measure it directly and set random values to the direction to go and the angle of rotation. In this case how can I set rotation and distance to travel?

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 5:38 pm
by pincy
Do you need this as part of your controller?

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 5:50 pm
by AntonioC
Yes i need.

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 6:08 pm
by pincy
So, as I said in my original reply, this is something that can't be done with real Kilobots because they lack the sensors to do it, and specifically the encoders.

The only way to do it is essentially "cheating". Because I modeled the kilobots after the original kilolib.h, one way to proceed would be to modify that first, for example by creating a couple of functions to get the distance and rotation covered since the last time step. Then this would need to be implemented in the ARGoS controller as well.

It's not hard to do, as the code to achieve it is essentially already all there.

However, if you wanna work with a robot that can do this kind of behaviors, I would suggest you to work the foot-bot or the Khepera.

Re: Angle and distance with kilobots

Posted: Fri Oct 01, 2021 7:51 pm
by AntonioC
Maybe I have found a solution. But I need to know what speed of rotation and speed of movement the kilobots have.

Re: Angle and distance with kilobots

Posted: Mon Oct 04, 2021 2:31 am
by pincy
The kilobot movement is based on the differential drive model. The relevant code is in the following files:
  • This is how set_motors() is implemented: link
  • This is where the kilobot speed values are transformed into speed expressed in cm/s: link
  • This is how the wheel speeds are transformed into linear/angular speed of the center of mass: link
With this information, you should be able to reconstruct what you need.