UAV Path Following Path Switching Problem

1 visualizzazione (ultimi 30 giorni)
Hi everyone ,
I'm trying to implement a path following algorithm for UAV (Carrot Chase) with matlab for a line-circle path.
I have already implemented the algorithm for straight line and the loiter separately and this codes are work fine. But, since they are geometrically different shapes, they have different algorithms. So we need to switch algorithms when switching between these two shapes if we want to follow this two shapes together . And i added a algorithm for that but i have a problem.
After following the first straight path and following the first loiter path, it should have moved on to the second straight path, but it follows the first loiter path forever.
How can we fix it ?
Thanks

Risposte (1)

Altaïr
Altaïr il 17 Mar 2025
In the carrot chase algorithm, I assume that (XM0, YM0), and (XT0, YT0) represent the current and target waypoints respectively. Since these variables are defined as inputs to the carrotchase_ode function, they get re-initialized at each iteration. To address this, declare them as persistent variables and use different names for the corresponding inputs in carrotchase_ode. This ensures they retain their values across iterations.
Persistent variables start as empty, and this property can be used to set their initial values. After making these changes, consider debugging the logic for switching between the algorithms for line and circle. For more information on persistent variables, kindly refer to the documentation: https://www.mathworks.com/help/releases/R2023a/matlab/ref/persistent.html
  1 Commento
Muhammed Emin Yavuzaslan
Muhammed Emin Yavuzaslan il 19 Mar 2025
@Ashok Sir, thank for the replying my question. I'm really appriciate that.
After the updating the code, i have a problem again
Code is starts with following the first straight path and following the first loiter path, after the first loiter path it's following second straight path correctly. Your suggestions are worked perfectly but after the second straight path, vehicle go back the first loiter path and follow this first loiter path forever.
I'm trying to debug the code since you reply , but i couldn't figure it out what is the problem. If you dont mind, can you check the code again ?
I've added the screenshot and updated code.
Thanks a lot.

Accedi per commentare.

Prodotti


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by