What is the difference between local and global planners?

When reporting issues or asking for help, please make sure you give an accurate description of your problem, hardware and software versions and attach logs if you have them.

Always be respectful towards the community and never engage in any discriminatory, derogatory or harmful actions against a person or group or your post will be deleted and you will be banned.

@lioneleeedadad So in general, local planner only plans for locally optimal paths while global planners try to find the global optimum. Was this your question?

If you are curious on what kind of local and global planners exist, literature like planning algorithms by la valle might be useful for you.

1 Like

@Jaeyoung-Lim thats what I understood till now … “the local planner works only with the information it currently gets from the sensors and plans a path that is around a meter long. When the next set of information come in it plans a new piece of the path. The global planner, on the other hand, build a map of the environment. It gathers all the information ever received and then plans a path that reaches to the goal. This happens at a much lower frequency than in the local_planner. Also the global planner is much more costly on the computational side.
And yes, the collision avoidance works only with the local planner. The local planner internally build a histogram where the free and blocked cells are marked. This is then compressed into 1D to serve as a laser scan emulation. The global planner does not use such a histogram.” I don’t just know either this information is correct or wrong ? so would you please correct me if that is wrong?

It is not just simply as serving it as a laser scan emulation. Please refer to papers on 3DVFH+ or 3DVFH* to better understand the local planner.

@Jaeyoung-Lim it is also seen that only local planners provide collision avoidance however global planners do not ! also local planner works with the information it gets from the sensor and plans a path around a meter long . However global planner build a map of the environment from the beginning ! is that right ? this means that global planner should only work with static obstacles not dynamic obstacles

Could you please clarify your question? I cannot verify if your understanding is correct everytime I give you an answer, and I am not sure what you want to know. Please list the exact question that you would like to get an answer.

@Jaeyoung-Lim I need to take the sensors navigation as an input to a switching mode which I’m going then to use it to switch between two conditions … so I don’t think that global planner will help me in what I will be doing

so " @Jaeyoung-Lim it is also seen that only local planners provide collision avoidance however global planners do not ! also local planner works with the information it gets from the sensor and plans a path around a meter long . However global planner build a map of the environment from the beginning ! is that right ? this means that global planner should only work with static obstacles not dynamic obstacles " I need answer for that to help me in what I’m implementing

To cut the long story short would you please verify the correctness of the following words (((. “the local planner works only with the information it currently gets from the sensors and plans a path that is around a meter long. When the next set of information come in it plans a new piece of the path. The global planner, on the other hand, build a map of the environment. It gathers all the information ever received and then plans a path that reaches to the goal. This happens at a much lower frequency than in the local_planner. Also the global planner is much more costly on the computational side.
And yes, the collision avoidance works only with the local planner.”)))

Most of what you say is correct, except for the avoidance statement (last sentence). Both planners plan a path and follow it if you are in PX4 mission mode. As both paths avoid obstacles, you can fly mission with both planners and you will not collide with obstacles. As the global planner builds a global map and does not discard stale data it is not suitable for moving obstacles, as the whole path your obstacle traveled will be blocked.

Collision prevention is a different thing than obstacle avoidance. Collision Prevention can be activated in PX4 Position control mode where you fly the drone manually with the sticks. The Collision prevention prevents you from flying into stuff. This only works with the local planner, as only the local planner sends out the range scan data to the flightcontroller .

1 Like

@baumanta Thank you very much for your great reply ! that’s exactly what I’m searching for … will the px4 position control mode allow me to fly the drone using keyboard while avoiding collisions or how does it work and how can I make use of it ?

in SITL you can download the QGroundControl App to switch your drone into position mode. You nee some kind of RC connected as in Position mode the drone requires a signal input. You can use a joystick or a regular drone RC for that purpose

@baumanta I need to do that on gazebo and rviz not hardware , what exactly I need to do is to drive the drone by using keyboard keys and once this drone faces an obstacle it will immediately switch modes to autonomous mode in order to maneuver and avoid that obstacle then return back to manual mode “keyboard control”

this is not possible in the current implementation. But the collision prevention will be closest to what you want to have. The drone will not switch to autonomous mode, but it will “drift” along the obstacle, depending on your stick input, as if it was repelled by it. To test that in simulation (gazebo, riviz) you need to download the QGC app and get a joystick. as far as I know you cannot move the drone with the keyboard, but you need to plug in a joystick to your laptop.

1 Like

@baumanta So what if I want to change the plugin from joystick to a keyboard plugin ? will it be easy or possible ?

what ?!! @Jaeyoung-Lim

@lioneleeedadad I don’t think you can use your keyboard as you are missing dimensions, How do you want to command the drone orientation, position and thrust with 4 arrows. I don’t think that makes any sense. But if you do not have a joystick then you can use a virtual joystick in the QGC App to command your drone (pull the point around with your mouse).

I have implemented keyboard package for drones . I can exchange joystick plugins with it . What do you think about that @baumanta

@lioneleeedadad Then do it.