I hope you’re doing well! I’m currently working on a project where the drone experiences a significant external force during operation. The main goal is to maintain the drone’s stability while this force is applied.
I’m using PX4 for flight control and I’m curious if anyone has experience dealing with similar scenarios? Does PX4 inherently compensate for such external forces to keep the drone stable?
If not, I’d appreciate any guidance on which parts of the PX4 codebase I should explore to implement the necessary modifications. Any advice or suggestions would be greatly valued!
Thank you in advance for your time and help. I’m looking forward to your insights!
The point of the control loops, other than compensating for sensor errors is compensate for other forces applied to an aircraft. Usually, it’s wind and drag.
Perhaps you can explain more about the forces you plan to apply on the drone.
Yes. The particular forces compensated for depend on the vehicle type and flight mode.
For example, the most heavily stabilized MC mode is Position mode: Position Mode (Multicopter) | PX4 Guide (main)
When sticks are centered this holds the vehicle upright, fixed in altitude and position and compensating for external forces like wind.
Other flight modes just hold altitude, or just hold attitude.
@dotanAtTrim@hamishwillee The external force I’m dealing with is actually a high-pressure water hose. I plan to use the drone to navigate and clean an area using this hose. My main concern is whether PX4 can handle such a force without the drone being thrown off course.
Do you think PX4’s control loops could compensate for the pressure from the hose, or would I need to make specific modifications to ensure stability?
I think whether this will work depends on the drone being big enough more than the tuning.
The drone has to be big enough to carry the weight of the hose and water. When you have the hose spraying the drone leans in order to direct some of the force opposing that motion, losing some upward force.
i would recommend using some feedforward control on the response to the hose! it will take the integrator a bit to windup and react, you can offset this by just telling it when the hose is turning on and how much to offset the force by.
you want to think of it like telling your controller what to do ahead of time. if you knew exactly what you wanted the output of your controller to be, theoretically say you had a model and could calculate it, you can just add that to the command generated from the error signal. in the ideal case, the controller just follows your command and the error signal part is used to help out.
so for your system with spray hose, you have the nozzle turning on and off and some pressure coming out. this pressure from the nozzle applies a force on the craft. in order for the craft to correct for the force of the nozzle, the integrator is going to have to build up enough error in order to account for the nozzle pressure and then tell the propellers to spin faster/slower to offset it. this will take some time, introducing a “lag” depending on how long it takes. if you can’t handle this lag and need a faster response, you can tell the propellers to spin faster or slower directly as soon as you know youve turned on the hose. you have to calculate how much the propllers would need to change, but if you CAN do that accurately, then a feedforward will help speed up the response time of your drone, potentially letting it properly hover in place while spraying from the nozzle.
Thank you for your detailed explanation, profxavr!
However, I’m still a bit unclear on how exactly I should go about implementing this. Should I handle this through a configuration in QGroundControl, or would it require specific changes to the PX4 parameters? Or, would I need to modify the PX4 source code?
If it’s a source code modification, could you guide me on which modules or files in the PX4 codebase I should focus on? Additionally, are there any documentation resources or examples related to implementing feedforward control in PX4 that you’d recommend?
If it’s a source code modification, could you guide me on which modules or files in the PX4 codebase I should focus on? Additionally, are there any documentation resources or examples related to implementing feedforward control in PX4 that you’d recommend?
Familiarize yourself with the PX4 code base. This wouldn’t be a small project. You would need to know exactly what you were doing in all places. Even writing a guide for you on how to do it would be fairly time consuming, unfortunately
Start with talking to an AI or something to get a sense of what the project would entail.