Tim-HW / ROS2-Path-Planning-Turtlebot3-Potential-Field

ROS2 Package for turtlebot3 to execute local path planning using the potential field methods. This package is an excuse to learn C++ and ROS2. Feel free to use it as you wish :D
MIT License
14 stars 0 forks source link

Encountering problems while running APF node. #3

Open Edzzio opened 6 months ago

Edzzio commented 6 months ago

Good evening,

I'm currently still relatively new to ROS2, only really understanding its concepts for a couple of months now. I'm trying to implement an algorithm that makes it possible for our mobile robot (Turtlebot 3 Burger) to navigate in an unknown environment. So as a first approach I chose an artificial potential field algorithm, which is considered to be the easiest to implement.

While trying to implement your C++ package I ran into errors while executing, a notable one being a segmentation fault whenever I run the node with the LiDAR node (to get the /scan topic). So I converted the C++ package into a Python one, in order to get rid of memory allocation problems.

Now, without any segmentation faults, I could run it. I wanted the robot to accept negative goal coordinates. I had some issues initially in regards with the calculations of "Angle" and "Delta". While running the unmodified node, "Delta" was never negative, so if for example we chose the coordinates : x_goal = 0 and y_goal = -1 ; it never turned left, despite it being the optimal path.

To rectify this, I changed the calculations of "Delta", and removed the absolute value of "Angle - Theta". In addition to this, I removed the condition on "x_final" being negative in the "controller()" function.

With these modifications, the code ran smoothly without the presence of obstacles (in other words, Q_repulsion = 0). But whenever we put any sort of value into Q_repulsion, problems start to appear. Here is a small video showcasing what issue I ran into while running the node :

https://github.com/Tim-HW/ROS2-Path-Planning-Turtlebot3-Potential-Field/assets/139855580/58fb7e5b-7a59-4543-98a7-0649470540e9

In this video (my apologies for a bad quality), the robot wants to go from one yellow cross to the other. But as you may notice, it stays stuck in very weird configurations, each one rarely being the same as the one before it.

I do admit that with my previously mentionned above, I might have caused more problems in the end. So my questions are as follows : do you see any problems with our modifications? Can you point out some sources of errors that you may have encountered during your testing of the node?

I thank you in advance.

Kind regards, VETTER.

Here is our Python node : potentialF_text_format.txt

Tim-HW commented 5 months ago

Good afternoon !

Thanks for mentioning it ! I was quite busy lately I completely forgot to enhance it. I'll try to fix this later. Thank you for your inputs :D