## Angle and distance with kilobots

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

### Angle and distance with kilobots

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

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

### Re: Angle and distance with kilobots

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?

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

### Re: Angle and distance with kilobots

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
Posts: 550
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

### Re: Angle and distance with kilobots

Do you need this as part of your controller?

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

### Re: Angle and distance with kilobots

Yes i need.

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

### Re: Angle and distance with kilobots

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.

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

### Re: Angle and distance with kilobots

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

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

### Re: Angle and distance with kilobots

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.