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

Fixed 'Sensors Setup' page not showing GUI #11990

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stepan14511
Copy link

Fixed Vehicle Setup -> Sensors page for PX4 not showing GUI, made to help user with calibration.

Description

Used to be:
image
Now it works correctly:
image

Test Steps

Go to Vehicle Setup -> Sensors. Start, for example, accelerometer calibration and you will see no changes in the right part of the screen. Now it works the same way, as it does in the stable verison (correctly).

Related Issue

There might be the same issue with others autopilots. I don't not have ability to check.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@DonLakeFlyer
Copy link
Contributor

I see what was changed but I don't understand why it was needed. The signals should have worked there way through the new mechanism:

@stepan14511 Could you help with debugging this to determine why the current code doesn't work?

@stepan14511
Copy link
Author

@DonLakeFlyer

  • The signals should have worked there way through the new mechanism

In the mechanism all the signals work absolutely fine. StatusTextHandler::textMessageReceived signals are coming to the Vehicle object. But SensorsComponentController is not connecting to StatusTextHandler::textMessageReceived, but to Vehicle::textMessageReceived, which is never emited in a Vehicle object.

The other solution could be to subscribe straightly to the StatusTextHandler::textMessageReceived, but StatusTextHandler *m_statusTextHandler is private in the Vehicle class. And it's getter function is removed for some reason:

// StatusTextHandler* statusTextHandler() { return m_statusTextHandler; }

  • And then the changes to the text parsing seem like a no-op to me.


The expression in the if statement is always false, since the text variable is following (for example):
[cal] progress <20>

Because of this the progress bar is not working.

@HTRamsey
Copy link
Collaborator

Good catch, I probably missed the PX4 issue when making StatusTextHandler because previously I only tested on ArduPilot but at least it helped catch the SensorsComponentController issue. Connecting to the Vehicle signal is the correct way as I had intended for it to be used.

@DonLakeFlyer
Copy link
Contributor

Ok, so isn't one of the fixes to add:

    (void) connect(m_statusTextHandler, &StatusTextHandler::textMessageReceived, this, &Vehicle::textMessageReceived);

This will get the signal up through Vehicle.

As far as the "<" versus "&lt" stuff. It looks like this changed on the PX4 firmware side of things at some point. Since in the past the "<" certainly worked. My concern is with back compat with older version of firmware. @HTRamsey Is there some Qt magic to get these strings to replace the "&" stuff which real chars? If so, then the cal stuff could jam the strings through that first and then use the non "&" chars for comparison. This would then in turn work on all firmware versions.

@stepan14511
Copy link
Author

@DonLakeFlyer
This idea sound better. But it requires a bit more changes. It can be seen here: stepan14511@affe648
If we will agree on this approach, I will merge it to my master to appear in this pull request.

Is there some Qt magic to get these strings to replace the "&" stuff which real chars?

I couldn't find anything apart from the straightforward replace function.

@DonLakeFlyer
Copy link
Contributor

If we will agree on this approach

I believe this is the way to go.

For converting the &gt things:
https://stackoverflow.com/questions/7696159/how-can-i-convert-entity-characterescape-character-to-html-in-qt

@stepan14511
Copy link
Author

@HTRamsey
Is there any particular reason why in the line below you are using toHtmlEscaped()?

emit textMessageReceived(compId, severity, messageText.toHtmlEscaped(), "");

Removing it solves the issue.

@HTRamsey
Copy link
Collaborator

HTRamsey commented Oct 14, 2024

Not that I recall, I believe that's what was there already before I moved it into StatusTextHandler

emit textMessageReceived(id(), compId, severity, messageText.toHtmlEscaped(), "");

@stepan14511
Copy link
Author

This is exactly the reason, why old if is not working:
image

Then what would be better: to convert it back in the autopilots or just remove it?

@DonLakeFlyer
Copy link
Contributor

DonLakeFlyer commented Oct 14, 2024

Hmm, interesting. I believe somewhere along the the way PX4 starting sending status text messages which were HTML. So the message display starting using a rich text field to display status text.

Could someone find the "blame" on the original toHtmlEscaped? I only vaguely remember those changes. Need to understand why that was put in there. Must be there for a reason. I think maybe @bkueng was involved?

@DonLakeFlyer
Copy link
Contributor

I just went backwards through blame. Looks like it was @bkueng. Hopefully he can help explain why this is necessary.

@DonLakeFlyer
Copy link
Contributor

So I looked through the code and I believe it's correct that the toHtmlEscaped (somewhere) because both the critical vehicle message popup and and vehicle message dropdown use a richtext control If you don't escape then some things could be assumed to be HTML when they are not. That said I think the place where this escaping should happen should not be at a global level. It should only be when the status text is about to be displayed in one of those control. For generic signaling out from Vehicle of status text. I think it should not be escaped at that point.

I'm pawing through code right now to figure out exactly where that should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants