Rosject Follow Wall Project, How i can let the robot detect that it moved one lap?

i want to detect when the robot has moved one lap i have the odometry, but i noticed that when the robot complete one lap, and reach the point it started the odometry are not the same each lap they are changing, i have been tried many times for many day still i can not do it correctly :frowning:

Hi @bazzouna98,
The value of the odometry when your robot has completed a turn is not exaclty the same but you could define a tolerence on the goal. For example consider that if the robot is around 0.5m of your initial distance, you can consider it a complete turn. You also need to define another condition to differentiate the case “Initial pose” and “Pose after 1 turn”, you have multiple options to find it out.

yes i did defined an initial variable to sotre the odometry at starting
i will try this way.
Thank you for replying

i have a question why it is not exactly the same?

Hi @bazzouna98,
I’m not totally sure about the way you test, but I would say:

  • In your simulation, it’s quite possible that the odom is not “exactly” the same because 1) the robot is not reaching the same place 2) With the number of digits precision on each values, it’s not easy to have a the exact same values on each (and need to check your simulation but maybe because of covariance too)
  • On real robot, the odometry is compute according to sensors (error of measurment and covariance) and has a growing uncertainty with linear and angular distance done.
    So you can’t do odom_t0 = odom_t1 after a turn but odom_t0 ≈ odom_t1 ± pose_tolerence
    I recommand you to compute an Euclidian distance with the initial point after a turn and define distance< distance_tolerence.
1 Like

Hi @EnzoGhisoni

yes i test it in real time,

i am thinking about counting the number of the walls that the robot detect (if it detects 4 walls then it did complete one turn) then considering the distance from the wall to detect precisely the end of the lap

another time thank you for replying and the usefull informations

You can also just measure the distance it travels in one lab.

Then once tha distance is reached, you stop the robot

1 Like

i think calculating the distance is the best solution :+1:

Another idea is to create a symbolic square of size X, with the start postion being in the centre. Then write a function to verify if the position of the robot is within that square. Making the side of the square bigger, you’ll have a higher tolerance on the start and stop postions of the robot :slight_smile:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.