## Kilobot and collision detection

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

### Kilobot and collision detection

My kilobots move randomly in the simulator thanks to a random time for advancement and rotation. By means of the advancement and rotation time I can calculate the distance traveled together with the direction. I have a problem. Given a random advance time, if the kilobot encounters another kilobot or a wall it will not travel the full set distance but travel a shorter distance. How can I solve this problem?

Code: Select all

```void loop(){ flag = rand() % 1 if(flag == 0){ set_color(RGB(1, 0, 0)); spinup_motors(kilo_turn_left, 0); randomAngle = rand() % 100 //To be defined. delay(randomAngle); }else{ set_color(RGB(1, 0, 0)); spinup_motors(kilo_turn_left, 0); randomAngle = rand() % 100 //To be defined. delay(randomAngle); } set_color(RGB(0, 1, 0)); spinup_motors(); set_motors(kilo_straighy_left, kilo_straight_right); randomTime = rand() % 8000 + 1000 distanceM = randomTimeToM(randomTime); delay(randomTime); set_color(RGB(1,0,1)); set_motors(0,0); delay(800); }```

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

### Re: Kilobot and collision detection

The Kilobot has no means to detect collisions (it has no proximity sensor nor wheel encoders), so there really isn't anything you can do with it.

These limitations are pretty much the entire point of using a robot like the Kilobot. If you want a smarter robot, use the foot-bot – it has proximity sensors, encoders, and a distance scanner. If you want a commercial robot, the Khepera IV is also available as a plug-in.