I want to add a custom control loop (similar to cruise speed in the Cruise mode), but not necessarily with the same input variables as already used in that mode, or possibly for a different variablethan cruise speed. An example is to set a specific airspeed or ground speed, then flip into that custom mode, and have the throttle controlled by the autopilot, based on airspeed readings, as a negative feedback PID control loop, so if airspeed input value goes down, AP increases the throttle pwm output command, or if airspeed input value goue up, then throttle pwm value is decreased by AP, based on the throttle PID tuning and sensitivity that you set, for instance to keep a set airspeed, so very similar to roll, pitch or heading stabilization, but for a different variable, and with different input variables. I might need to add in a couple of more sensor values down the road. I have seen a similar custom version of Plane running this for throttle control loop, but with a range finder as the input variable.
Does this require custom programming and modification of the Plane source code, or can it be accomplished by manipulating some settings or possibly with lua scripting? I have looked around a little, and know that in Cruise mode, a set cruise speed can be set by inputting a given cruise throttle value, then fine-tuning that throttle value until the specific cruise speed that you want is achieved, but that is not what I am looking for. I am looking to possibly create a new mode (if it is needed for this) that will take any given speed value (read it from the airspeed sensor), then adjust the throttle value in real time to hold that airspeed. Kinda similar to alt_hold mode, where the current altitude is the controlled variable, and pitch is the adjusted pwm variable, but instead for airspeed, so like a spd_hold mode.
Can anyone help me figure out how to go about this, or explain if I need to write and compile a custom version of the code, or if this can be achieved by modifying settings of the available standard version of Plane or other Ardupilot code?
Thanks for any input or assistance
1 post - 1 participant