Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGC not showing metadata of added param #11072

Closed
tuloski opened this issue Dec 19, 2018 · 36 comments
Closed

QGC not showing metadata of added param #11072

tuloski opened this issue Dec 19, 2018 · 36 comments
Labels
Admin: Pinned bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)

Comments

@tuloski
Copy link

tuloski commented Dec 19, 2018

Hi.
I was able to add a parameter to EKF2, and I wrote the correct metadata, however when I connect in QGC I see the new parameter but I don't see any description of the param, nor the other metadata info (min, max, bool etc). Also it shows up as reboot_required but I didn't put that in the metadata.
What's wrong? I didn't find any docs on this.

PS: I also tried "make parameters_metadata" before building my code without success.

@mhkabir
Copy link
Member

mhkabir commented Dec 19, 2018

You need to upload your new .px4 file through QGC "custom firmware" option for it load the Metadata.

@mhkabir mhkabir closed this as completed Dec 19, 2018
@tuloski
Copy link
Author

tuloski commented Dec 19, 2018

I did it.
And the .xml of the new build is correct.

@mhkabir mhkabir reopened this Dec 19, 2018
@mhkabir
Copy link
Member

mhkabir commented Dec 19, 2018

@dagar ideas?

@dagar
Copy link
Member

dagar commented Dec 19, 2018

This is a problem with QGC where the metadata update seems to get stuck (I haven't dug into the root cause). Try flashing through QGC then restarting. If that doesn't work dig into the QGC config directory and delete the cached metadata, then try again.

We should figure out how to fix this properly. @dogmaphobic @DonLakeFlyer

@tuloski
Copy link
Author

tuloski commented Dec 19, 2018

The best way would be to include some basic metadata in MAVlink protocol. It can be a big overhead but it would make it GCS and firmware agnostic.

@dagar
Copy link
Member

dagar commented Dec 19, 2018

Yes we'll probably need to go there (optionally), but there's also a middle ground of QGC fetching and properly caching the metadata from a server as well.

@stale
Copy link

stale bot commented Mar 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jun 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 8, 2019

Closing as stale.

@stale stale bot closed this as completed Jul 8, 2019
@julianoes
Copy link
Contributor

@dagar is this still an issue?

@julianoes julianoes reopened this Jul 9, 2019
@stale stale bot removed the Admin: Wont fix label Jul 9, 2019
@mhkabir
Copy link
Member

mhkabir commented Jul 9, 2019

Still an issue for me the last time I tried. Seems to be QGC side though.

@tuloski
Copy link
Author

tuloski commented Jul 9, 2019

Yeah, still an issue for me (last time I tried was a couple months ago).

@julianoes julianoes reopened this Jul 10, 2019
@julianoes julianoes added bug Tools Sub-tools used within PX4 ecosystem (scripts, etc) labels Jul 10, 2019
@sundxfansky
Copy link

same problem :(

@NuclearManD
Copy link

NuclearManD commented Sep 30, 2019

I am having this problem as well. I have QGC v3.5.4 running on Ubuntu 18.04.3. I tried these steps:

  1. Close QGroundControl
  2. delete ~/.config/QGroundControl.org/ParamCache and ~/.config/QGroundControl.org/ParameterFactMetaData.xml
  3. Clean build (make clean in Firmware/)
  4. build firmware (make px4_fmu_v5 in Firmware/)
  5. Disconnect PX4
  6. Open QGC and go to Firmware
  7. Plug in PX4, check advanced, select Firmware/build/px4_fmu-v5_default/px4_fmu-v5_default.px4
  8. Check my custom parameters

I can find the parameters, and they work, but they do not have any of the metadata I specified. I also checked Firmware/build/px4_fmu-v5_default/parameters.xml to confirm my added metadata is there, and it is. I shouldn't have to delete the cache either - this should just work. I would really like to see this solved.

@tuloski
Copy link
Author

tuloski commented Oct 1, 2019

@DonLakeFlyer ?

@DonLakeFlyer
Copy link
Contributor

Parameter metadata is versioned. QGC will use the interval version of metadata compiled into the code if the cached version number is equal to the internal version number.

There has been discussion a while back about changing such that equal version would use cache. But I wasn't quite sure of the implications of doing that. It might be ok.

@DonLakeFlyer
Copy link
Contributor

There has been discussion a while back about changing such that equal version would use cache. But I wasn't quite sure of the implications of doing that. It might be ok.

@dagar Do you see any reason why this shouldn't be changed? It seems ok to me.

@LowOrbitIonCannon
Copy link
Contributor

any Updates on this? When i flash m Firmware with QGC it doesn't show the Metadata, and also doesn't show new options. You have to manually put in the Number to change parameters to an unknown value.

@Spir4L
Copy link

Spir4L commented Mar 25, 2020

tions of doing that. It might be ok.

So how do I change the version in order to pick my new metadata?

@Spir4L
Copy link

Spir4L commented Mar 25, 2020

tions of doing that. It might be ok.

So how do I change the version in order to pick my new metadata?

The file that needs to be updated is src/lib/parameters/px4params/xmlout.py and the minor version has to be increased of 1 , in order to overrride the actual being used.

@NuclearManD
Copy link

NuclearManD commented Apr 17, 2020

Where are the parameters actually cached? I tried updating ~/.config/QGroundControl.org/ParameterFactMetaData.xml but QGroundControl did not show the new metadata (which I verified was present in the file)

image

I closed QGC before execution, and started QGC after executing this. It does seem that these two files have the exact same format, a diff from before showed that the only difference was my missing parameter.

@NuclearManD
Copy link

NuclearManD commented Apr 17, 2020

Ok, I'm figuring out how the flashing works in QGC, and how the parameter metadata is extracted, saved, and cached.

It seems that the parameter metadata is pulled out of the JSON in a .px4 file, then it is cached.

FirmwareImage.cc line 278 onward

QString parameterFilename = QGCApplication::cachedParameterMetaDataFile();
        QFile parameterFile(QGCApplication::cachedParameterMetaDataFile());

        if (parameterFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
            qint64 bytesWritten = parameterFile.write(decompressedBytes);
            if (bytesWritten != decompressedBytes.count()) {
                emit statusMessage(tr("Write failed for parameter meta data file, error: %1").arg(parameterFile.errorString()));
                parameterFile.close();
                QFile::remove(parameterFilename);
            } else {
                parameterFile.close();
            }
        } else {
            emit statusMessage(tr("Unable to open parameter meta data file %1 for writing, error: %2").arg(parameterFilename, parameterFile.errorString()));
        }

        // Cache this file with the system
        ParameterManager::cacheMetaDataFile(parameterFilename, firmwareType);

The file is always saved to ParameterFactMetaData.xml
QGCApplication.cc line 909 onward

QString QGCApplication::cachedParameterMetaDataFile(void)
{
    QSettings settings;
    QDir parameterDir = QFileInfo(settings.fileName()).dir();
    return parameterDir.filePath(QStringLiteral("ParameterFactMetaData.xml"));
}

It then goes to the cache, but it does not get saved, because the version is exactly the same.

ParameterManager.cc line 1445 onward

    bool cacheNewFile = false;
    if (cacheHit.isEmpty()) {
        // No cache hits, store the new file
        cacheNewFile = true;
    } else if (cacheMajorVersion == newMajorVersion) {
        // Direct hit on major version in cache:
        //      Cache new file if newer minor version
        //      Also delete older cache file
        if (newMinorVersion > cacheMinorVersion) {
            cacheNewFile = true;
            QFile::remove(cacheHit);
        }
    } else {
        // Indirect hit in cache, store new file
        cacheNewFile = true;
    }

But where is this cache? The XML files are located in the settings directory - the result of QSettings().fileName() - which is the same location of our ParameterFactMetaData.xml. But there's nothing here other than ParamCache directory (does not contain metadata), ParameterFactMetaData.xml and QGroundControl.ini.

My QGC must be loading parameter metadata from somewhere else then because ParameterFactMetadata.xml has metadata I do not see in QGC.

Wouldn't it be better to update the cache if the minor versions were identical? This way QGC would always have the last flashed metadata if the cache had something different... I'm pretty sure this would be a one byte addition to ParameterManager.cc.

Edit: I did a find to see if there were any QGC directories I was missing, didn't find anything. I checked the directories in ~/.cache/

image

@LorenzMeier
Copy link
Member

Could you send a pull request for that or do you feel it is too hard to add it yourself? I always encourage to get your hands dirty because you can help drive the process towards better UX also going forward. So the learning curve is worth it.

@DonLakeFlyer
Copy link
Contributor

Wouldn't it be better to update the cache if the minor versions were identical?

There are multiple issues in on this which I can't seem to find right now. In the, there was discussion on whether this was safe or not. It wasn't fully understood if there were unknown gotchas by doing this. I don't think so, but not 100% sure. The problem relates to having a cached versions of crappy/incorrect dev build metadata getting stuck there causing problems when you try to go back to using regular builds. I think i may require something a little more sophisticated to be safe like using a different cache space for dev builds. @LorenzMeier What do you think?

@LorenzMeier
Copy link
Member

I would propose to cache the "last flashed" variant and use that by default if its set. Copying it always from the .px4 file (wether that file was local or downloaded) and putting it in there. It will always be correct, because if you had a bad version then you most likely re-flashed something else to fix it.

@DonLakeFlyer
Copy link
Contributor

It will always be correct, because if you had a bad version then you most likely re-flashed something else to fix it.

Sort of. But not if you have multiple vehicles. Say you have a vehicle you test new stuff with and you also have a regular vehicle you do normal work with. You fart around with you test vehicle, put it to the side and then use you normal vehicle. The metadata can be out of whack. Not sure if that is just too obscure a case though. I guess firmware devs doing metadata changes will need to be careful and know what they are going to some extent.

@LorenzMeier
Copy link
Member

All of these have a unique ID that can be used to store the cache with.

@LorenzMeier
Copy link
Member

@DonLakeFlyer
Copy link
Contributor

But that's not really "unique". It's just a board type. That's closer to this: mavlink/qgroundcontrol#6906 but different from it. We can have that discussion as well.

But for right now a simpler solution would be nicer which is whether it's safe to overwrite the cache if the versions are the same. I think that is 90% an ok thing to do. Since we are at the start of a new daily cycle we should be able to gather any problems with it up until a new stable which should be a little while.

@DonLakeFlyer
Copy link
Contributor

The other issue I was thinking about is here: mavlink/qgroundcontrol#4485 to keep track of it.

@LorenzMeier
Copy link
Member

Sorry, QGC is lacking the implementation, but the bootloader provides PROTO_GET_CHIP, which will give you the UID: https://github.com/PX4/Bootloader/blob/master/bl.c#L881

@DonLakeFlyer
Copy link
Contributor

I'd also rather wait to implement vehicle specific metadata caching to use the new COMPONENT_INFORMATION vehicle download thing in discussion though. Which would supercede flash based metadata. Id' hope that will get worked out in this new stable cycle. I'll get back to that and provide more concrete details.

@DonLakeFlyer
Copy link
Contributor

Until then I think overriting cache on equal version is safe which is what's in the pull referenced above.

@tuloski
Copy link
Author

tuloski commented Apr 18, 2020

What about modifying PARAM_VALUE(#22) in Mavlink 2 to add metadata at mavlink protocol level?

@junwoo091400
Copy link
Contributor

Isn't this fixed by mavlink/qgroundcontrol#8670 @DonLakeFlyer?

@DonLakeFlyer
Copy link
Contributor

Yes as well as the new parameter metadata coming through COMPONENT_INFORMATION now as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin: Pinned bug Tools Sub-tools used within PX4 ecosystem (scripts, etc)
Projects
None yet
Development

No branches or pull requests