I'd like to add a parameter to arduplane that I can change during flight. How do I go about doing that?
I don't understand how the Parameters.h file works at all. I guess I don't have a full understanding of the C constructs used in it. Can someone explain to me how parameters are defined and initialized?
Ok, I figured it out by looking at the change logs for APM, but how much space is there for parameters? Last time I made a post complaining of a missing feature, I got the response that "parameter space is somewhat of a commodity." Is it going to run out of flash if I add a parameter? If so, how does it fail? Will it cause the ardupilot to crash or anything else dangerous like that?
Ok, so you figured out that you need to change Parameters.h right? Add the new parameter into the Parameters class in two places. At the top you add an item to the enum, then at the bottom you add the member variable including it's default value.
I think the real limitation is not so much on the eeprom space but rather the limit on the # of parameters. So we have a limit of 255 parameters. The mistake that I've seen most often is when adding to the enum, people add their parameter at the end of a group (i.e. at the end of the heli group which stretches from 80 ~ 97) and this ends up accidentally overrunning the next first item of the next group (i.e. Telemetry control starts at 110 so adding > 13 parameters will cause problems).
The other thing about adding parameters is that you need to increase the k_format_version if you cause the enums to change...for example if you added a parameter in the middle of a group.
Actually it just occurred to me how dumb an argument that was... if parameter space is somewhat of a commodity there wouldn't be a whole PID dedicated to flight coordination (yaw) that doesn't even work (see Issue 382)