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

Restore icons throughout RViz2 #235

Merged
merged 13 commits into from
Mar 31, 2018
Merged

Conversation

anhosi
Copy link
Contributor

@anhosi anhosi commented Mar 22, 2018

Fixes #56.

The package and path for a icon are derived from the class id of the plugin. This requires some renaming of classIds in the plugin_description.xml.

As a consequence there is a breaking change: an already existing ~/.rviz2/default.rviz will not load correctly. We fixed the crash so a user is faced with an empty rviz window and needs to add all panels and displays manually and save the config afterwards.

@anhosi
Copy link
Contributor Author

anhosi commented Mar 22, 2018

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@wjwwood wjwwood self-assigned this Mar 23, 2018
@wjwwood wjwwood added enhancement New feature or request in review Waiting for review (Kanban column) labels Mar 23, 2018
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

I think there is one good change to make first, but otherwise lgtm.

The breaking change for the names of the displays is frustrating, but necessary without changing how the system works. We could add some code to help the migration, which simply maps all calls to load rviz/* to the new equivalent, warnings users as they go. New saves could save in the new format, so at best old configs will work with a warning and newly saving that config will fix the problem. I won't require that for this pr, but it would be nice if it were. At the very least, we should open an issue clearly describing this breaking change what could be done to alleviate it.

RVIZ_COMMON_LOG_ERROR("Invalid or unsupported URL: " + url.toStdString());
}
return file_path;
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you're doing this manually with ament_index_cpp and not with resource_retriever?

For example, this code uses resource_retriever to do basically the same thing:

resource_retriever::MemoryResource getResource(const std::string & resource_path)
{
resource_retriever::Retriever retriever;
resource_retriever::MemoryResource res;
try {
res = retriever.get(resource_path);
} catch (resource_retriever::Exception & e) {
RVIZ_RENDERING_LOG_ERROR(e.what());
return resource_retriever::MemoryResource();
}
return res;
}

That's in service of loading mesh files so they can be interpreted by assimp or the STL parser.

Copy link
Contributor

@Martin-Idel-SI Martin-Idel-SI Mar 26, 2018

Choose a reason for hiding this comment

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

The reason was that I didn't see that QPixmap offered a possibility to load data in the form of a uchar array, which is what we're given by resource_retriever. In addition, I thought that it would then be necessary to distinguish between file formats. Turns out, neither is the case, so I switched to using the resource_retriever.

It would be nice though if the resource_retriever had a method to just give us the full path to the resource.

@Martin-Idel-SI
Copy link
Contributor

Regarding the breaking change in the config, I added a quick fix which converts all names that can occur when building the current ros2 master from source, warning the user (on the console) to save their config.
This is a quickfix and I added a comment to remove it after the next release, as it should then become superfluous.

If you had something more sophisticated in mind (e.g. when using configs from the old RViz), we'd have to work with a map and I'd rather open an issue and close it with a later PR as you suggest.

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm me now, thanks for fixing it up

I made an issue to remind me to remove that "correction" code at some point: #239

@wjwwood wjwwood merged commit 4aaa893 into ros2:ros2 Mar 31, 2018
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Mar 31, 2018
@greimela-si greimela-si deleted the feature/fix_icon_loading branch April 11, 2018 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rviz_common] fix loading of icon resources
4 participants