ardupilot_wiki icon indicating copy to clipboard operation
ardupilot_wiki copied to clipboard

Getting and Setting Parameters

Open wucke13 opened this issue 5 years ago • 6 comments

Getting and Setting Parameters - Describe the issue/suggestion and improve the title. Please keep a link to the original article if relevant.

I just started writing a parser for the apm.pdef.xml files. Upon doing so, I stumbled across multiple bugs in https://autotest.ardupilot.org/Parameters/ArduCopter/apm.pdef.xml. Most issues are small oddities regarding the data:

  • there is <param ... user="Advanceds"></param> in it (LND_ACC_P_NSE)
  • quite a few of the numbers have spaces around them (e.g. <value code=" 1">KalmanFilter</value>)

Is there a better source for getting information about the parameters?

wucke13 avatar Sep 11 '20 21:09 wucke13

Hello, I am not sure that apm.pdef.xml is still use somewhere .... I will put an issue to either delete it or update it. Prefer the apm.pdef.json version. If json is not possible, you can use the xml that Mission Planner is using --format xml_mp instead of xml. You can also generate parameter for all vehicle with https://github.com/ArduPilot/ardupilot/blob/master/Tools/scripts/generate_mp_paramfile.sh

khancyr avatar Sep 12 '20 19:09 khancyr

Oh no :unamused: I spent literally 8 hours on build a parser which somehow reads it. This information has to be presented way more prominently! If one searches for "ardupilot parameters" one of the first couple of links will be this and in that document the XML files are recommended for GCS usage.

Where can I get apm.pdef.json ? Mission planner is not really an option for me, I'm on linux.

TODO

  • Provide download of apm.pdef.json in a prominent manner
  • Mention the deprecation of apm.pdef.xm

EDIT:

I found out how to generate the json. However, some of the issues are present there as well:

  • Sometimes User is missing
  • It still has Advanceds in PLND_ACC_P_NSE
  • ADSB_ICAO_SPECL does not has the range information (not necessarily an issue but a turnoff when writing a parser in a strongly typed language, as it is yet another edge case)
  • ALT_HOLD_FBWCM does not use Standard & Advanced but User as value for User.

wucke13 avatar Sep 13 '20 14:09 wucke13

I've created https://github.com/ArduPilot/ardupilot/pull/15331 to validate and correct the @User field.

I've created https://github.com/ArduPilot/ardupilot/pull/15330 to canonicalise the @Values field before attempting to validate it and further parse it in the various emitters.

The xml is in no way deprecated. We continue to maintain it.

https://ardupilot.org/dev/docs/gcs-resources.html provides a link to the directory which contains the XML - but we don't currently generate the JSON on the server. Perhaps after we get some more feedback on people of the format being used in there?

peterbarker avatar Sep 13 '20 22:09 peterbarker

ok ... I thought that Tridge mention that it wasn't maintained when I made the MissionPlanner version. Anyways, it can be fixed, and we could also apply the same formatter that I used for the missionplanner version, that way, it will be parsable easily.

khancyr avatar Sep 14 '20 09:09 khancyr

The xml is in no way deprecated. We continue to maintain it.

There is many bad things in that XMLs, making it super tedious to write a correct parser for it. I'm glad that this issues are addressed this quick, however!

wucke13 avatar Sep 14 '20 12:09 wucke13

I have made a PR to fix most whitespace issue and formatting : https://github.com/ArduPilot/ardupilot/pull/15347

khancyr avatar Sep 15 '20 10:09 khancyr