2024.08.03 20:19

작성자: 박준규, 신지환

<aside> 📢 Path Generation!!! A first at Yonsei Drone! (물론 시간 없으면 걍 손으로 좌표점 찍어서 가야될 수도…)

Update 2024.08.04 05:41 Searching a bit online reveals this requires A LOT of REAL FLIGHT TESTING to tune. Unlike multicopter mode, there are lots of parameters to tune for path generation AND tracking in fixed wing mode (the tracking controller implemented in PX4 even optimizes the control action accounting for wind, and real flight tests are required to tune related parameters). These parameters affect flight and waypoint “reach” performance a lot.

A lot of the stuff for path generation is done, just need to do coordinate conversion. Path tracking controller is already in PX4.

</aside>

How we should make the aircraft fly through WPs (waypoints):

  1. WPs are given by the competition organizers
  2. A path is generated, which passes through all WPs for fixed wing mode. We do this only once, when we get the WP coordinates.
    1. This path would be discrete/continuous set of points in 3D space (position values) that is given to the path tracking controller as a reference (target) position
  3. The path tracking controller tries to make the aircraft follow this path by controlling the attitude and thrust setpoints.
    1. PID, Pure pursuit, DWA, etc.
    2. This controller outputs the attitude and thrust setpoints - the low level PID controller in the PX4 firmware will then take this attitude and thrust setpoints and control the motors.
    3. Note: Offboard Roll Pitch Yaw Thrust Setpoint (Manual…?)

Step 1 to 3 (until the path tracking controller) are all done in the mission (companion) PC.

The problem with doing step 3 by ourselves is that the dynamics/kinematics of the system has to be taken into account. PX4 already has two controllers for this implemented, and it’s 508 lines of code (just for the horizontal control one). So we shouldn’t try to do pure velocity setpoint control or attitude+thrust setpoint control. It will be a worse version of what’s already there.

Before we begin, we should understand how the default position setpoint controller works in PX4 for fixed-wing mode.

Note: Offboard Waypoint Following Related (this contains how to get position setpoint working)

How does PX4 do it?

  1. No implementation for path generation AFAIK. This is step 2 from the 3 steps above. So this should be done by an external program, which then gives the positions.

  2. Given a path (a.k.a. position setpoints), the path tracking is done with a combination of TECS (for altitude and airspeed control) and NPFG controllers (for horizontal heading/position control). This is step 3 from the 3 steps above.

    https://docs.px4.io/main/ko/config_fw/position_tuning_guide_fixedwing.html https://discuss.px4.io/t/px4-fixed-wing-mission-acceptance-radius/34693/4

Source code for fixed wing position control (more like position “track”?):