Angle and distance with kilobots

Requests regarding how to set up experiments in ARGoS.
AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

Angle and distance with kilobots

Postby AntonioC » Fri Oct 01, 2021 5:22 pm

How can I detect the distance traveled by a kilobot and the angle of rotation?

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

Re: Angle and distance with kilobots

Postby pincy » Fri Oct 01, 2021 5:25 pm

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?
I made ARGoS.

AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

Re: Angle and distance with kilobots

Postby AntonioC » Fri Oct 01, 2021 5:37 pm

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?

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

Re: Angle and distance with kilobots

Postby pincy » Fri Oct 01, 2021 5:38 pm

Do you need this as part of your controller?
I made ARGoS.

AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

Re: Angle and distance with kilobots

Postby AntonioC » Fri Oct 01, 2021 5:50 pm

Yes i need.

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

Re: Angle and distance with kilobots

Postby pincy » Fri Oct 01, 2021 6:08 pm

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.
I made ARGoS.

AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

Re: Angle and distance with kilobots

Postby AntonioC » Fri Oct 01, 2021 7:51 pm

Maybe I have found a solution. But I need to know what speed of rotation and speed of movement the kilobots have.

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

Re: Angle and distance with kilobots

Postby pincy » Mon Oct 04, 2021 2:31 am

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.
I made ARGoS.


Return to “How to... ?”