Adding new fact group to Vehicle

Hi there, thanks in advance for the help.

I am trying to add a new fact group to the Vehicle class. I have tried to follow the examples shown by the other fact groups in this class. So I created a new fact group class, and I made a new JSON file to describe its metadata.

I would like for my new facts to be shown in the ValuePageWidget. The Fact Group Name does make it to the drop-down config menu (at the same level with Vehicle, Battery, Clock, EstimatorStatus, etc) but the submenu has nothing inside. With some digging I found that all of the short descriptions are empty strings. If I take out the check for factGroup.getFact(modelData).shortDescription in ValuePageWidget.qml, it will display blank check boxes, which I can check to have the facts show up on the higher level menu. Then the values of the facts are displayed on the widget, but still no short descriptions.

Can anyone take a guess about what I might have done wrong? It feels like I have made a mistake with inheritance or setting up things in a constructor. It seems like the short descriptions are initially being set correctly, but on access later they are empty. Unfortunately my custom fact group looks just like the existing ones as far as I can tell.

If anybody has any good tips on debugging this app I would also love to learn more, I have been having a hard time.

I would guess there is a problem with your json file. If so, you will usually get a warning about in the debug output.

1 Like

I suspect the same thing too, but as far as I can tell my JSON file looks valid and just like the others. And I don’t get any warning in the debug output.

I don’t know if this will make any sense, but I’ll try, I am attaching images showing debug windows for three cases. These were all grabbed at a breakpoint in the shortDescription accesor in FactMetaData class.


This shows a fact in Vehicle (I think it’s altitude), and you can see that the FactMetaData object’s parent is the Vehicle class.


This shows an experiment I did to add a fact to the VehicleClockFactGroup, and in this case the FactMetaData’s parent is the VehicleClockFactGroup.


This is the one with my problem, it’s a new fact group I made from scratch. You can see that in this case the FactMetaData object has a Fact as a parent, rather than a FactGroup.

Sorry for being long-winded, and I am sure I am going to slap myself on the forehead when I figure this out.

hello @efjellanger i know this has been a year, but may I know where exactly do I add a new Fact value (ie a custom battery fuel status) to the QGC? I have discovered the common.xml in the mavlink folder. Do i define it there first? If so, where to next until it can show up in the ValuePageWidget? Thank you so much in advance.