How to detect is a planned path has changed through topics

Hi everyone,
I would like to know if is there a way to detect if a precomputed planned path has changed due to, for example, an obstacle, through topics information. I’ve by using the /plan topic but it receives new poses continuously, even if the plan hasn’t changed.
Thanks in advance!

Hi @lfernandez ,

From my experience so far, I can say a few things:

  1. The global plan may not change frequently.
  2. The local plan is designed to change frequently and be more “path-adaptable”.

What I understand from your question: You want to detect if the initially computed path has changed recently or had multiple changes.

If you are using ROS 1: use the /move_base/<your_global_path_planner>/global_plan topic.
If you are using ROS 2: use the /received_global_plan topic. /plan is subjected to change as the robot moves.

To give you one solution:
Once the goal position is communicated to the action server, you can read the very first path plan from the above mentioned topics.
To check if the path has changed, you can do it by two ways:
Simple way:
Just compare the initial path plan to current path plan.
Complex way:
Use an external program logic to compare the initial path plan with current path plan.
You can use mathematical shape comparison logic or any pattern matching logic and check for match percentage.

I hope this helps.

Regards,
Girish

Thanks @girishkumar.kannan
I’ve checked it and I think that /received_global_plan decreases the number of poses with each message from the same path. Is it possible?
Thanks again

Hi @lfernandez ,

I actually did not know that /received_global_plan decreases the number of poses with each message.
If I am right, I guess, /plan = /received_global_plan + /transformed_global_plan.

So what you can do is use the /plan instead, but make sure you get the first plan correctly and store it for later use, since you have mentioned that even /plan keeps changing.

I have not done such an implementation before, so I just shared an idea that I had.

Perhaps, someone from TheConstruct Team can give you a better idea/suggestion.

Regards,
Girish

1 Like

Thanks @girishkumar.kannan. I don’t know how to do it due to all the poses arrays returns by the topics seem to change even when the planned path doesn’t.
Thanks again!

Hello @lfernandez,

If you are using the move_base node, there is the “planner_frequency” parameter that defines how frequently the global plan is calculated in Hz (default: 0.0). If that value is 5 you will get a new plan 5 times a second, normally I set it to 1 or 0.5 because the global plan is a computationally expensive operation.

From the documentation here: http://wiki.ros.org/move_base#Parameters
If the frequency is set to 0.0, the global planner will only run when a new goal is received or the local planner reports that its path is blocked.

all the poses arrays returns by the topics seem to change even when the planned path doesn’t.

Notice that a Path is a set of points contained in a nav_msgs/Path message.
This list of individual points will very likely change each time the global path is calculated (at the frequency set as explained above) even if the plan doesn’t seem to change as visualized in Rviz.

To solve the problem of changing points in a seemingly not changing path (as visualized in Rviz) I would try first with tolerances for the waypoints or some kind of statistical method.

From with my limited knowledge I haven’t come across a ready made package that does that out of the box. So now you, @lfernandez, as ROS engineer have to come up with a solution to solve that problem. We can only provide ideas here but the solution has to be build by you.

Hope these hints help,

Cheers,

Roberto

1 Like

Thanks @rzegers
Yes, I was only asking for ideas. Thanks agains for your help!

1 Like

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