Vector guidance mode

Hi everyone,

I am a student working on a project with PX4 gazebo classic and I have been told to work on the mission mode. I use the advanced_plane model.

The problem is that I observe the pane does not follow the path of the mission very well, especially when there is wind or changes of altitude.

Furthermore, I observe during the mission (via waypoints) that the plane sometimes considers that it did pass by a point, while, in reality, it is very far away this point. I pasted you a picture as an example here:

So, I am trying to implement a vector guidance mode, drawing my inspiration on the autopilot Paparazzi model because a professor of mine told me he had never seen such problems to follow a trajectory on Paparazzi.

I tried to code something on python to switch to off-board mode and follow a trajectory. I want to minimize the difference between the tangent vector of the trajectory and the actual velocity vector of the plane. However, I am not that good to code and I am new in the use of PX4 Gazebo. I face lots of problems to flight (fail-safe mode activated, takeoff not engaged, path not followed, …).

Please has someone already been working on it ? Can someone help me ?

Best regards !

Have a look at these parameters:

  • NAV_ACC_RAD (Default of 10m) See Missions | PX4 Guide (main) for more info
  • **NAV_FW_ALT_RAD
  • MPC_YAW_MODE
    **
    During very windy conditions these won’t fix your problem but in normal operation they could be too “loose” for what you are trying to do.

Thanks a lot for your response !

So, playing with these parameters should make the plane better follow the trajectory of the mission.

Do you think it is possible to implement a vector guidance mode to improve again the trajectory tracking ?

These waypoints are too close together for a fixed-wing guidance that’s waypoint (and not path segments) based. Acceptance is a function of NAV_ACC_RAD and the distance given by the FW guidance, which in turn heavily depends on NPFG_PERIOD. Have a look here.

But what you likely need is to replace the internal PX4 “mission” mode with a custom external one. See PX4 ROS 2 Control Interface | PX4 Guide (main).

I ran again the same simulation with less waypoints to have bigger spaces between them. Here they are spaced by 50m. I have the same issue.

I read that the acceptance radius is ruled by the parameter NPFG switch distance. I modified it but it does not change anything.

Changing the NPFG_PERIOD gives me a more precise trajectory tracking as you can see here when I changed it from 12s to 6s:

However, as you can see, there is still a gap between the waypoint and the real trajectory. And it appears on the low part of the circle (which is at a lower altitude than the upper part of the circle).

Do you have an idea to explain and fix this remaining gap and error ?

Is there an altitude change? Or are all waypoints 2-11 on the same altitude? Can you reproduce in simulation as well?

Yes there is an altitude change ? The circle is inclined by 10°. Points 2 and 7 are at 50m, 4 and 5 five are at about 65 m and points 9 and 11 are at about 35 m.