Changing the angle and rate PID values in ArduCopter code (Stabilize Mode)

163 views
Skip to first unread message

Ahsan Tipu

unread,
Oct 2, 2015, 9:43:40 AM10/2/15
to drones-discuss
I need to make a few programming changes to the stabilize mode angle and rate controllers in ArduCopter by hard-coding the P I D values.I wanted to access the part of the code in arducopter libraries where P I D values are loaded from the mission planner, so that I can rewrite my own values instead of loading them from the mission planner. I browsed through the entire code and in AC_AttitudeControl.cpp I found the following functions which I think will lead me to what I am looking for:-

1) _p_angle_roll.kP() and _p_angle_pitch.kP()               (FOR ANGLE CONTROLLER)
2) _pid_rate_roll.get_p() and _pid_rate_roll.get_p()         (FOR RATE CONTROLLER)

I am having difficulty in tracing these functions all the way back to where they 'get' values of P (for both angle and rate controller).

Any help in this matter will be highly appreciated.   

Robert Lefebvre

unread,
Oct 2, 2015, 2:30:08 PM10/2/15
to drones-discuss
The values are not loaded from Mission Planner.  They are stored in the Pixhawk memory (probably the FRAM?) and MP merely accesses them, and can modify them remotely.

I could help you with a firm suggestion, but first I'd need to know more about what exactly you are trying to accomplish.

Rob

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ahsan Tipu

unread,
Oct 3, 2015, 8:57:03 AM10/3/15
to drones-discuss
What I want the program to do is that instead of taking values of kp, ki, kd that I set in the mission planner, I want to program my own values of these parameters. So, I need to know exactly where in the code should I write them. 

Secondly, I need help with the battery monitor section. I am expecting some programming done to calculate the values voltage, current, battery capacity and battery remaining but I am having trouble finding the part of code where this done.  

Daniel Frenzel

unread,
Oct 5, 2015, 9:45:42 AM10/5/15
to drones-discuss
The PIDs are usually stored in the flash by application of AP_Param.
These values are red by the mother class(es). 
Reply all
Reply to author
Forward
0 new messages