ROS2 Basics Python Real Robot Project - Actions Part

Hello,
I have a clarification question regarding the Real Robot Project - Part 3 in the wall-following + odometry-recording action as
In my implementation, the action is supposed to stop once the robot completes one full lap and returns close to its starting position. This is done by monitoring the distance from the starting pose and stopping once it falls below a threshold (which is given in question as 5 cm).

However, during testing it in simulation, I noticed that, even with multiple changes to the code, issue is observability of the event by ROS server. Although the robot does physically cross the 5 cm region around the starting point, the algorithm often fails to capture that moment. I do not know if this happens cause of Odometry sampling, or something else.
I am not able to capture the condition distance_from_start <= 0.05 even though the robot has objectively completed a lap.
However, I increased the threshold to ~10–11 cm, while ensuring the action terminates only after a full lap and with this adjustment, the robot consistently completes exactly one lap and the action terminates correctly.

My question is:
Is using a slightly larger threshold (≈10–11 cm) acceptable for this Project,?
Or is the 5 cm value intended as a strict requirement rather than a guideline?

Thank you for your time.

Best,
Ninad Mehta

Hello @ninadmehta34, Using the 10-11cm is acceptable. But you must do your best to understand why it is failing.

Thank you for the clarification, @takavarasha.
I have been trying to understand the cause as well. With the current control and odometry update rates, the robot often crosses the 5 cm region between samples during autonomous motion, so that condition is not reliably detected.

A few mins back, I was able to detect the start consistently below ~7 cm at least in simulation only by significantly reducing speed but other than speed parameter, still trying to understand what I am missing.
Thank you for confirming this is acceptable.

1 Like

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