I am making a customized landing controller for my plane. I want to customize the ArduPlane source code and initiate my own landing sequence.Does anyone knows that how does the altitude of the plane can be directly controlled from a function such that I give it the desired altitude and it tries to reach it.
In order to best help, we need more detail about your goal:
How will you supply the desired altitude to the autopilot?
In which flight mode(s) would you like this behavior to apply?
How aggressively do you want the plane to attempt to reach your desired altitude?
Do you want any safety features in place while the plane executes this behavior? If so, which ones?
Thanks for replying,
I didn’t modified the ardupilot control code but created my own wrapper in ros python and published my control values directly through RC channel and was able to test my LQR altitude control in SITL and the results are pretty good. It took me some time though.
But still, I have always wanted to tweak ardupilot code directly.
Answers to your questions :
The LQR (Linear Quadratic Regulator) controller will compute the desired altitude based upon current height and required glide slope angle.
I wish to see that behavior in Auto Mode.
I don’t get your meaning by Aggressively? but what I assume is that plane is at significant height and distance from landing point that it can definitely achieve desired glide slope with max deflection of elevators +/- 15 degrees at constant speed. I am performing a net landing here so constant speed depending upon aircraft is fine.
I wished to add a safety feature, if the planes height is not between thresh-hold from the certain distance from landing point it should cancel the landing sequence and try it again from last waypoint.
It will be great if you can throw some insight to how to directly modify ardupilot code for achieving an altitude given through LQR controller.
In my opinion, you should pursue one of two paths:
Implement a new flight mode (copy-and-modify) or
Use the Guided mode to send appropriate commands.
Implementing a new flight mode is harder, but gives you more capability. Guided was designed for a user to specify fly-to-here waypoints, so you might struggle to implement the fine altitude control you desire for an accurate glide-slope? But that’s less source-diving than implementing a whole new flight mode.
Giving guided mode commands just might work. I have to give continuous guided commmands with gps waypoints and height at some delta distance at a constant rate.
My doubt is given two gps waypoints how can I compute intermediate waypoints based upon total distance and vehicle speed.