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

Add FixedFrame tf status in GlobalOptions #69

Merged
merged 6 commits into from
Aug 13, 2021
Merged

Conversation

atharva-18
Copy link
Contributor

Reference to issue #68

  • Added FixedFrame tf status.

  • Screenshots:

    a. TF warn
    Screenshot from 2020-11-29 14-16-06
    b. TF error
    Screenshot from 2020-11-29 14-16-58
    c. Valid frame
    Screenshot from 2020-11-29 14-17-36

Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
Copy link
Collaborator

@Sarath18 Sarath18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me. Please go through the following comments.

Comment on lines 62 to 84
Q_PROPERTY(
QString tfStatus
READ getTfStatus
NOTIFY tfStatusChanged
)

/**
* @brief TF status message
*/
Q_PROPERTY(
QString tfStatusMessage
READ getTfStatusMessage
NOTIFY tfStatusMessageChanged
)

/**
* @brief TF status color
*/
Q_PROPERTY(
QString tfStatusColor
READ getTfStatusColor
NOTIFY tfStatusColorChanged
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe instead of having 3 properties to read and notify the changes, we can have a custom Q_OBJECT class with these properties i.e status, message, and color along with methods to set these properties which are used in updateTfStatus.

This class can then be extended in the future to implement the tree view with the TF status of each frame.

@@ -104,6 +145,9 @@ bool GlobalOptions::eventFilter(QObject * _object, QEvent * _event)
this->onRefresh();
}

// Update tf status and message
this->updateTfStatus();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, the updateTfStatus() function is being called on every Qt event received by this plugin. This results in a high TF status refresh rate which I don't think is necessary. This might also cause problems with other plugins using FrameManager due to the presence of locks.

I am not 100% sure on how to go about this, but updating the TF status alongside the periodic refresh of TF frames might be the right option. The periodic update of TF is currently under development in #62.

Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
@atharva-18
Copy link
Contributor Author

@Sarath18 I have made the requested changes. The new TFStatus class holds the status, message, and color. I have moved the tfStatusChanged call inside the render event loop. However, the GlobalOptions.hpp file giving a code style divergence issue with Uncrustify. This is the error output:

5: Code style divergence in file 'include/ignition/rviz/plugins/GlobalOptions.hpp':
5: 
5: --- include/ignition/rviz/plugins/GlobalOptions.hpp
5: +++ include/ignition/rviz/plugins/GlobalOptions.hpp.uncrustify
5: @@ -43 +43 @@
5: - * 
5: + *
5: 
5: 1 files with code style divergence

Apologies for the delay.

@ahcorde
Copy link
Collaborator

ahcorde commented Jan 20, 2021

5: Code style divergence in file 'include/ignition/rviz/plugins/GlobalOptions.hpp':
5: 
5: --- include/ignition/rviz/plugins/GlobalOptions.hpp
5: +++ include/ignition/rviz/plugins/GlobalOptions.hpp.uncrustify
5: @@ -43 +43 @@
5: - * 
5: + *
5: 
5: 1 files with code style divergence

There is space in the line 43, you should remove it

Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
@@ -24,6 +24,7 @@
#include <ignition/math/Color.hh>
#include <QColor>
#include <string>
#include <vector>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <vector>
#include <memory>
#include <string>
#include <vector>

// Check for tf data
auto framePosition = std::find(_allFrames.begin(), _allFrames.end(), _fixedFrame);

if (!_allFrames.size()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!_allFrames.size()) {
if (_allFrames.empty()) {

Comment on lines 108 to 123
RowLayout {
width: parent.width
spacing: 10

Label {
id: "status"
text: GlobalOptions.tfStatus.status
color: GlobalOptions.tfStatus.color
}

Label {
id: "message"
text: GlobalOptions.tfStatus.message
color: GlobalOptions.tfStatus.color
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into the text wrapping issue?
The FixedFrame combo-box drop-down menu is not selectable when the plugin width < text width.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added elide property to the second Label element:

Default Expanded
Screenshot from 2021-01-26 20-52-06 Screenshot from 2021-01-26 20-52-22

Comment on lines 62 to 65
if (currentState != 2) {
currentState = 2;
return true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these checks really necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These checks are performed to check whether the status has been changed. We can remove them and call emit tfStatusChanged() on every render event.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that will be better. Let's remove them for now. The updates on the render event will be helpful because:

  1. The text Frame[<fixedframe>] does not exist text will be updated when the Frame is changed and the "currentState" is still the same. (In case of warning/error)
  2. The implementation of the TFStatus will be modified in the future when the TF Status support for multiple frames is added.

Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
Signed-off-by: atharva-18 <atharvapusalkar18@gmail.com>
@Sarath18 Sarath18 requested a review from ahcorde January 27, 2021 06:22
Base automatically changed from master to main March 8, 2021 21:56
@ahcorde ahcorde merged commit 632a18a into gazebosim:main Aug 13, 2021
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