Giter Site home page Giter Site logo

rviz's Introduction

RViz

This branch is currently contained in the main ros2.repos file of ROS 2 and can be used for ROS 2. The latest release will be available with your ROS 2 download.

ROS 2 does not have a wiki yet. To learn about RViz and its functionality, please refer to the ROS RViz wiki page.

Features

Already ported

These features have already been ported from ros-visualization/rviz to ros2/rviz. The basic documentation can still be found on the RViz wiki page. For some displays, the documentation is updated.

Displays Tools View Controller Panels
Axes Move Camera Orbit Displays
Camera Focus Camera XY Orbit Help
DepthCloud Measure First Person Selections
Effort Select Third Person Follower Time
Fluid 2D Nav Goal Top Down Orthographic Tool Properties
Grid Publish Point Views
Grid Cells Initial Pose
Illuminance Interact
Image
Interactive Marker
Laser Scan
Map
Marker
Marker Array
Odometry
Point Cloud (1 and 2)
Point
Polygon
Pose
Pose Array
Pose With Covariance
Range
Relative Humidity
Robot Model
Temperature
TF
Wrench

Not yet ported

Other features:

  • Stereo

In case you wished to see those features in RViz for ROS 2, feel free to add a pull request. Make sure to read the developer guide below and the migration guide.

New features

Pluggable transformation library

In RViz for ROS 1 the frames transformation library used is tf2 (detailed information about it can be found here). In RViz for ROS 2 the frames transformation library is now pluggable, meaning that different transformation library plugins can be loaded and changed dynamically in the gui. Developers can create and use their own plugins to provide custom transformation behavior.

Two plugins are bundled with RViz:

  • a plugin for tf2 (TFFrameTransformer, in rviz_default_plugins), which provides the standard tf2 functionality and which is used as a default
  • a trivial plugin (IdentityFrameTransformer, in rviz_common), which always performs identity transforms. This plugin is used by default if the tf2 plugin is not available and no other valid plugin is specified.

As anticipated, in order for the user to choose the plugin to use, RViz provides a dedicated panel: the Transformation panel.

Note: Not all transformation plugins are necessarily compatible with all RViz displays (e.g. some of the default displays, like the TF display, can only work with tf2). In order to take this possibility into account, the TransformerGuard class is provided. Adding it to a display ensures that the display will be disabled and won't function in case the wrong transformer is used.

More detailed information on how to write a transformation plugin and on how to handle transformation specific displays can be found in the plugin development guide.

Developer Guide

Build

Building RViz together with ROS 2

The simplest way to build from source is to use the official installation guide, since RViz is part of the official ROS 2 repos file.

https://docs.ros.org/en/rolling/Installation.html

Building RViz in a separate workspace

When developing for RViz, it can be beneficial to build it in a separate workspace.

Note: When building the current ros2 branch from source, the latest ROS 2 release for all dependencies might not be sufficient: it could be necessary to build the ROS 2 master branch. Make sure to have a source build of ROS 2 available (see installation procedure above).

Create a new workspace:

$ mkdir -p ~/rviz2_ws/src
$ cd ~/rviz2_ws/src

Clone these repositories into the source folder:

$ git clone https://github.com/ros2/rviz.git

Then build all the packages with this command:

$ colcon build --merge-install

The --merge-install flag is optional but ensures a cleaner environment which is helpful for development.

More instructions and examples to come.

In addition to the ROS 2 Developer Guide we suggest the following.

Testing

Main rationale here is to create code that can be well tested by avoiding highly coupled components.

  • Avoid free functions (cannot be mocked).
  • Create abstract base classes (interface) for dependencies. (This allows for a mock to be completely independent of the actual implementing class.)
  • Use only the interface in the dependent code.
  • Specify dependencies as a constructor argument.
  • Prefer std::unique_ptr for storing the dependency instead of a raw pointer.

Migration

When migrating from ros-visualization/rviz to ros2/rviz, please see the more extensive migration guide.

Plugin Development

Plugins can extend RViz at different extension points:

  • Displays
  • Panels
  • Tools
  • Frames transformation library
  • View Controllers

More information on writing plugins can be found in the plugin development guide.

Icon Copyrights

This package contains Public Domain icons downloaded from http://tango.freedesktop.org/releases/.

Upstream Authors (2005-2009):

Other icons and graphics contained in this package are released into the Public Domain as well.

Authors (2012-2017):

  • David Gossow
  • Chad Rockey
  • Kei Okada
  • Julius Kammerl
  • Acorn Pooley
  • Rein Appeldoorn

Copyright notice for all icons and graphics in this package:

Public Domain Dedication

Copyright-Only Dedication (based on United States law) or Public Domain
Certification

The person or persons who have associated work with this document (the
"Dedicator" or "Certifier") hereby either (a) certifies that, to the best
of his knowledge, the work of authorship identified is in the public
domain of the country from which the work is published, or (b)
hereby dedicates whatever copyright the dedicators holds in the work
of authorship identified below (the "Work") to the public domain. A
certifier, moreover, dedicates any copyright interest he may have in
the associated work, and for these purposes, is described as a
"dedicator" below.

A certifier has taken reasonable steps to verify the copyright
status of this work. Certifier recognizes that his good faith efforts
may not shield him from liability if in fact the work certified is not
in the public domain.

Dedicator makes this dedication for the benefit of the public at
large and to the detriment of the Dedicator's heirs and successors.
Dedicator intends this dedication to be an overt act of relinquishment
in perpetuity of all present and future rights under copyright law,
whether vested or contingent, in the Work. Dedicator understands that
such relinquishment of all rights includes the relinquishment of all
rights to enforce (by lawsuit or otherwise) those copyrights in the
Work.

Dedicator recognizes that, once placed in the public domain, the Work
may be freely reproduced, distributed, transmitted, used, modified,
built upon, or otherwise exploited by anyone for any purpose, commercial
or non-commercial, and in any way, including by methods that have not
yet been invented or conceived.

Source: http://creativecommons.org/licenses/publicdomain/

rviz's People

Contributors

ahcorde avatar anhosi avatar bcharrow avatar botteroa-si avatar chadrockey avatar clalancette avatar cottsay avatar de-vri-es avatar dgossow avatar dirk-thomas avatar greimela-si avatar hdeeken avatar hersh avatar hershwg avatar hidmic avatar jacobperron avatar jbohren avatar jkammerl avatar jon-weisz avatar k-okada avatar martin-idel avatar martin-idel-si avatar mikaelarguedas avatar nuclearsandwich avatar rhaschke avatar sloretz avatar tfoote avatar v4hn avatar vrabaud avatar wjwwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rviz's Issues

[rviz_rendering] implement better default scene until we have display types

Right now the default scene is nothing really or not displaying correctly. It is implemented in this function which will probably go away in the future:

void
createScene(Ogre::SceneManager * ogre_scene_manager)
{
printf("in RenderWindowImpl::createScene()\n");
/*
Example scene
Derive this class for your own purpose and overwite this function to have a working Ogre widget with
your own content.
*/
ogre_scene_manager->setAmbientLight(Ogre::ColourValue(1.0f, 0.0f, 0.0f));
Ogre::Entity * sphereMesh = ogre_scene_manager->createEntity("mySphere", Ogre::SceneManager::PT_SPHERE);
Ogre::SceneNode * childSceneNode = ogre_scene_manager->getRootSceneNode()->createChildSceneNode();
childSceneNode->attachObject(sphereMesh);
Ogre::MaterialPtr sphereMaterial = Ogre::MaterialManager::getSingleton().create("SphereMaterial",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
sphereMaterial->getTechnique(0)->getPass(0)->setAmbient(0.1f, 0.1f, 0.1f);
sphereMaterial->getTechnique(0)->getPass(0)->setDiffuse(0.2f, 0.2f, 0.2f, 1.0f);
sphereMaterial->getTechnique(0)->getPass(0)->setSpecular(0.9f, 0.9f, 0.9f, 1.0f);
//sphereMaterial->setAmbient(0.2f, 0.2f, 0.5f);
//sphereMaterial->setSelfIllumination(0.2f, 0.2f, 0.1f);
sphereMesh->setMaterialName("SphereMaterial");
childSceneNode->setPosition(Ogre::Vector3(0.0f, 0.0f, 0.0f));
childSceneNode->setScale(Ogre::Vector3(0.01f, 0.01f, 0.01f)); // Radius, in theory.
Ogre::Light* light = ogre_scene_manager->createLight("MainLight");
light->setPosition(20.0f, 80.0f, 50.0f);
}

We need to get that working and/or update it to have some more compelling content which we can use for debugging until we have some display types ported from rviz.

[rviz_rendering] error on install with Debug related to qt deploy

I get this error when building on Windows for Debug mode:

     7>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: The command "setlocal\r [C:\dev\rv
       iz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.
       exe" -E remove_directory C:/dev/rviz2_ws/build/rviz_rendering/windeployqt\r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd\
       r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: set PATH=%PATH%;C:/Users/William/A
       naconda3/Library/bin\r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd\
       r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: C:\Users\William\Anaconda3\Library
       \bin\windeployqt.exe --dir C:/dev/rviz2_ws/build/rviz_rendering/windeployqt C:/dev/rviz2_ws/build/rviz_rendering/Debug/rendering_example.exe\r [C:\dev\rviz2_ws\build\rviz_r
       endering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd\
       r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmEnd\r [C:\dev\rviz2_ws\build\rv
       iz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: endlocal & call :cmErrorLevel %err
       orlevel% & goto :cmDone\r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmErrorLevel\r [C:\dev\rviz2_ws\b
       uild\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: exit /b %1\r [C:\dev\rviz2_ws\buil
       d\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmDone\r [C:\dev\rviz2_ws\build\r
       viz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd\
       r [C:\dev\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd" exited with code 1. [C:\de
       v\rviz2_ws\build\rviz_rendering\rendering_example.vcxproj]

If I comment out the qtwindeploy code I can get around the error, but I cannot run it without.

[rviz_common] fix loading of icon resources

See:

  • // TODO(wjwwood): replace this with ROS 2 and boost-free version
    // boost::filesystem::path getPath(QString url)
    // {
    // boost::filesystem::path path;
    // if (url.indexOf("package://", 0, Qt::CaseInsensitive) == 0) {
    // QString package_name = url.section('/', 2, 2);
    // QString file_name = url.section('/', 3);
    // path = ros::package::getPath(package_name.toStdString());
    // path = path / file_name.toStdString();
    // } else if (url.indexOf("file://", 0, Qt::CaseInsensitive) == 0) {
    // path = url.section('/', 2).toStdString();
    // } else {
    // ROS_ERROR("Invalid or unsupported URL: '%s'", url.toStdString().c_str() );
    // }
    // return path;
    // }
  • // TODO(wjwwood): reenable this, or in the meantime add a placeholder pixmap
    Q_UNUSED(url);
    Q_UNUSED(fill_cache);
    // RVIZ_COMMON_LOG_WARNING_STREAM("did not load pixmap at " << url.toStdString());
    // // if it's in the cache, no need to locate
    // if (QPixmapCache::find(url, &pixmap) ) {
    // return pixmap;
    // }
    // boost::filesystem::path path = getPath(url);
    // // If something goes wrong here, we go on and store the empty pixmap,
    // // so the error won't appear again anytime soon.
    // if (boost::filesystem::exists(path) ) {
    // ROS_DEBUG_NAMED("load_resource", "Loading '%s'", path.string().c_str() );
    // if (!pixmap.load(QString::fromStdString(path.string() ) ) ) {
    // ROS_ERROR("Could not load pixmap '%s'", path.string().c_str() );
    // }
    // }
    // if (fill_cache) {
    // QPixmapCache::insert(url, pixmap);
    // }
  • // TODO(wjwwood): reenable this
    Q_UNUSED(url);
    Q_UNUSED(fill_cache);
    // RVIZ_COMMON_LOG_WARNING_STREAM("did not load icon as cursor at " << url.toStdString());
    return QCursor(Qt::ArrowCursor);
    #if 0
    QPixmap icon = loadPixmap(url, fill_cache);
    if (icon.width() == 0 || icon.height() == 0) {
    ROS_ERROR("Could not load pixmap '%s' -- using default cursor instead.",
    url.toStdString().c_str() );
    return getDefaultCursor();
    }
    QString cache_key = url + ".cursor";
    return makeIconCursor(icon, cache_key, fill_cache);
    #endif
  • // TODO(wjwwood): reenable this
    Q_UNUSED(icon);
    Q_UNUSED(cache_key);
    Q_UNUSED(fill_cache);
    // RVIZ_COMMON_LOG_WARNING_STREAM("did not make icon into cursor at " << cache_key.toStdString());
    return QCursor(Qt::ArrowCursor);
    #if 0
    // if it's in the cache, no need to locate
    QPixmap cursor_img;
    if (QPixmapCache::find(cache_key, &cursor_img) ) {
    return QCursor(cursor_img, 0, 0);
    }
    QPixmap base_cursor = loadPixmap("package://rviz/icons/cursor.svg", fill_cache);
    const int cursor_size = 32;
    cursor_img = QPixmap(cursor_size, cursor_size);
    cursor_img.fill(QColor(0, 0, 0, 0) );
    // copy base cursor & icon into one image
    QPainter painter(&cursor_img);
    int draw_x = 12;
    int draw_y = 16;
    // if the icon is too large, move it to the left
    if (draw_x + icon.width() > cursor_size) {
    draw_x = cursor_size - icon.width();
    }
    if (draw_y + icon.height() > cursor_size) {
    draw_y = cursor_size - icon.height();
    }
    painter.drawPixmap(0, 0, base_cursor);
    painter.drawPixmap(draw_x, draw_y, icon);
    if (fill_cache) {
    QPixmapCache::insert(cache_key, cursor_img);
    }
    return QCursor(cursor_img, 1, 1);
    #endif

This will probably be solved with a combination of either ament_index_cpp (to have a relocatable solution to finding the files at runtime) and QDir/QFile/QFileInfo to replace boost::filesystem.

[rviz_rendering] The build currently fails under Windows

When building the current HEAD using ament build, I get the following error:

CUSTOMBUILD : CMake error : The following variables are used in this project, but they are set to NOTFOUND. [C:\ros2\ros2_ws\build\rviz_ogre_vendor\ogre-1.10.7.vcxproj]
         Please set them or make sure they are set and tested correctly in the CMake files:
         FREETYPE_FT2BUILD_INCLUDE_DIR (ADVANCED)

Shouldn't the build provide dependencies like freetype out-of-the-box?

port resource_retriever to ROS 2

rviz uses resource_retriever to fetch files, and specifically uses the package:// scheme to locate files relative to a package's install location. This is implemented in ROS 1 using rospack and the ROS_PACKAGE_PATH, in ROS 2 it will need to use the ament_index_cpp API.

I'll take this one on too, since it is outside of the rviz repository.

[rviz_common] cleanup usage of tf2 buffer versus transform listener

Previously rviz passed the tf::TransformListener around as an API entry point for tf, but in tf2 these functions have been moved to the tf2_ros::Buffer class, and there is still a transform listener, but it doesn't have any useful public API, so it probably doesn't need to be passed around.

Right now these are created here:

auto buffer = std::make_shared<tf2_ros::Buffer>();
// TODO(wjwwood): pass the rviz node so tf2 doesn't create it's own...
auto tf_listener = std::make_shared<tf2_ros::TransformListener>(*buffer);

But places like this need to be cleaned up:

  • if (!tf) {
    // TODO(wjwwood): reenable this when possible (ros2 has no singleton node),
    // for now just require it to be passed in
    // tf_.reset(new tf2_ros::TransformListener(ros::NodeHandle(), ros::Duration(10 * 60), true));
    throw std::runtime_error("given TransformListener is nullprt");
    } else {
    tf_ = tf;
    }
    buffer_ = buffer;

Also, we should manage the node better here:

Currently I believe tf will create it's own node ๐Ÿคข. We should also consider how to abstract this to minimize changes needed to support ROS 1 (though we can continue and should continue to tf2 in ROS 1).

[rviz_rendering] there is an extra window opened on Windows

When running the rendering_example demo on Windows you get an extra window that exists outside of the Qt window. I think this is the "dummy" window which is used to query the capabilities of the graphics card and ogre. Perhaps it just needs to be cleaned up properly on Windows. You can just close it and it does not affect the program (or it seems to not).

capture

[rviz_common] re-enable use of tf message filter

I believe this will result in needing to port some other things from ROS 1, like message_filters, but also to finish porting tf2 in ROS 2, see:

https://github.com/ros2/geometry2/blob/0415037bff122fb606480e3736b4eb983f375b82/tf2_ros/include/tf2_ros/message_filter.h#L48-L50

Here are some places in the code that need to be touched:

  • // TODO(wjwwood): reenable this when message_filters is ported.
    // #include <tf2_ros/message_filter.h>
  • // TODO(wjwwood): figure out how to replace FilgerFailureReason here
    #if 0
    /// Create a description of a transform problem.
    /**
    * \param frame_id The name of the frame with issues.
    * \param stamp The time for which the problem was detected.
    * \param caller_id Dummy parameter, not used.
    * \param reason The reason given by the tf::MessageFilter in its failure callback.
    * \return An error message describing the problem.
    *
    * Once a problem has been detected with a given frame or transform,
    * call this to get an error message describing the problem. */
    std::string
    discoverFailureReason(
    const std::string & frame_id,
    const rclcpp::Time & stamp,
    const std::string & caller_id,
    tf::FilterFailureReason reason);
    #endif

And probably other places.

[rviz_ogre_vendor] zlib dependency is not linked statically

When running the rendering_example on Windows without having a global ogre installation in the PATH, the application crashes with an error stating that zlib.dll can not be found.

The build produces two variations of the zlib library, namely zlib.lib and zlibstatic.lib. We currently import the former.
However, zlib.lib seems to be just a wrapper around the dynamically linked zlib.dll and therefore fails at runtime when the dll is not available in the PATH.

I suggest we use the static version of zlib, zlibstatic.lib, in the build process.

rviz_common on ros2 branch fails to build

Using ament build --cmake-args -DCMAKE_BUILD_TYPE=Debug the current ros2 branch doesn't build on Linux (Ubuntu 16.04). The error reads:

CMake Error in CMakeLists.txt:
Imported target "rviz_common::rviz_common" includes non-existent path

"/usr/lib/include"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

  • The path was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and references files it does not
    provide.

and more errors of this type. The release build fails similarly.

As a quick-fix, comment out the line ${ASSIMP_INCLUDE_DIRS} in CMakeLists.txt of rviz_common, but we should investigate the underlying issue.

[rviz_rendering] replace hard coded resource location with ament_index

In ROS 1 rviz used rospkg (the ROS_PACKAGE_PATH) to find the rviz package's location to find the stuff distributed in ogre_media at runtime. As one example, see:

Right now in the rviz_rendering package we have a hard coded value to find these files, which will not work long term. See:

This should instead be replaced with finding the package's installation location using the ament_index. The idea behind the ament_index is described in detail here:

https://github.com/ament/ament_cmake/blob/master/ament_cmake_core/doc/resource_index.md

There is a cmake API, which we would use to store things in the ament index if we needed to do so:

https://github.com/ament/ament_cmake/tree/master/ament_cmake_core/cmake/index

However, if we just need the installation location of the rviz_rendering package, that part is already "registered" in the ament index with this call in the CMake:

ament_package()

We can access the information with the ament_index_cpp package which is C++ API for querying the ament index at runtime:

https://github.com/ament/ament_index/tree/master/ament_index_cpp

Here is an example of finding a package's location at runtime using the C++ API:

https://github.com/ros2/demos/blob/8354081d55c627b60b8e1229bdcd84d6ec036068/composition/src/api_composition.cpp#L89

There is a more direct API call in the python version ament_index_python:

https://github.com/ros2/ros2cli/blob/5584754399cb388b479814328dbf8840483ff985/ros2pkg/ros2pkg/api/__init__.py#L17

We could add that to C++ if needed.

You can introspect what is in the ament index by just browsing the files in <install prefix>/share/ament_index/resource_index.

[rviz_rendering] Unnecessary information in ogre log messages

Ogre logs are redirected using rviz_rendering::ogre_rendering.cpp.

Currently, every log output generated by this class also includes the path to the ogre_rendering.cpp class.
Example:

[rviz_common:info] Creating resource group General, at /home/greimela/projects/ros2/rviz2_ws/src/aos-rviz2-public/rviz_rendering/src/rviz_rendering/ogre_logging.cpp:80
[rviz_common:info] Creating resource group OgreInternal, at /home/greimela/projects/ros2/rviz2_ws/src/aos-rviz2-public/rviz_rendering/src/rviz_rendering/ogre_logging.cpp:80
[rviz_common:info] Creating resource group OgreAutodetect, at /home/greimela/projects/ros2/rviz2_ws/src/aos-rviz2-public/rviz_rendering/src/rviz_rendering/ogre_logging.cpp:80
...

As far as I can tell Ogre does not provide information such as file name or line number in the Ogre::LogListener.
So we should just remove the path from the log message in this case.

RViz segfaults and doesn't end properly

Using the current ros2 master, you can start RViz and then end it regularly (press "Close without saving"). At that point, I see a segmentation fault message on my Ubuntu console.

On Windows (using the fixes of the current PR), after pressing "Close without saving", you get a "Program is not responding" window.

I investigated the causes:

  • First of all, there is a problem in selection_manager.cpp:128. The line
    vis_manager_->getSceneManager()->destroyCamera(camera_); throws the segmentation fault, since the method getSceneManager() returns a null pointer at that point. Probably, everything is already deleted.
  • If I comment out the line, the segfault does not occur anymore, but the problem hangs and doesn't respond (this is probably also the issue Windows is facing). The stack-trace according to gdb is
# 0  0x00007ffff36ed98d in pthread_join (threadid=140735676413696, thread_return=0x0) at pthread_join.c:90
# 1  0x00007ffff2e01b97 in std::thread::join() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007ffff397342e in tf2_ros::TransformListener::~TransformListener() ()
   from /home/martin/gitRepos/ros2_master/install/lib/libtf2_ros.so
# 3  0x0000000000512fdc in __gnu_cxx::new_allocator<tf2_ros::TransformListener>::destroy<tf2_ros::TransformListener> (this=0x20577e0, 
    __p=0x20577e0) at /usr/include/c++/5/ext/new_allocator.h:124
# 4  0x0000000000512f6f in std::allocator_traits<std::allocator<tf2_ros::TransformListener> >::destroy<tf2_ros::TransformListener> (
    __a=..., __p=0x20577e0) at /usr/include/c++/5/bits/alloc_traits.h:542
# 5  0x0000000000512cc7 in std::_Sp_counted_ptr_inplace<tf2_ros::TransformListener, std::allocator<tf2_ros::TransformListener>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x20577d0) at /usr/include/c++/5/bits/shared_ptr_base.h:531
# 6  0x000000000048b51a in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x20577d0)
    at /usr/include/c++/5/bits/shared_ptr_base.h:150
# 7  0x000000000048abc7 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x252e1f0, __in_chrg=<optimized out>)
    at /usr/include/c++/5/bits/shared_ptr_base.h:659
# 8  0x00000000004b9fb6 in std::__shared_ptr<tf2_ros::TransformListener, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x252e1e8, 
    __in_chrg=<optimized out>) at /usr/include/c++/5/bits/shared_ptr_base.h:925
# 9  0x00000000004b9fee in std::shared_ptr<tf2_ros::TransformListener>::~shared_ptr (this=0x252e1e8, __in_chrg=<optimized out>)
    at /usr/include/c++/5/bits/shared_ptr.h:93
# 10 0x00000000004b6b56 in rviz_common::FrameManager::~FrameManager (this=0x252e180, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/frame_manager.cpp:76
# 11 0x00000000004b6ba6 in rviz_common::FrameManager::~FrameManager (this=0x252e180, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/frame_manager.cpp:78
# 12 0x0000000000514294 in rviz_common::VisualizationManager::~VisualizationManager (this=0x2536b40, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/visualization_manager.cpp:274
# 13 0x0000000000514334 in rviz_common::VisualizationManager::~VisualizationManager (this=0x2536b40, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/visualization_manager.cpp:281
# 14 0x0000000000500831 in rviz_common::VisualizationFrame::~VisualizationFrame (this=0x17a7400, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/visualization_frame.cpp:173
# 15 0x00000000005009de in rviz_common::VisualizationFrame::~VisualizationFrame (this=0x17a7400, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/visualization_frame.cpp:182
# 16 0x0000000000482df2 in rviz_common::VisualizerApp::~VisualizerApp (this=0x7fffffffd9e0, __in_chrg=<optimized out>)
    at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz_common/src/rviz_common/visualizer_app.cpp:309
# 17 0x00000000004829e0 in main (argc=1, argv=0x7fffffffdb28) at /home/martin/gitRepos/rvizPort/aos-rviz2/src/rviz2/src/main.cpp:39

This might be related to the cleanup of tf2-usage we still have to do.

[rviz_rendering] Scaling issue on Ubuntu + Gnome

When maximising the window the render window adjusts fine.
But after unmaximising the render window does not adjust to fit the smaller window.

29915093-053eac80-8e3b-11e7-87d7-6e50af40361b
(The sphere should be in the center of the window)

Second Window on Mac

Currently, on Mac rendering happens in a second window instead of just one as it should.

The problem is the external window handle. When you try to use the version working on Windows 10 (and also advertised in the official wiki: http://wiki.ogre3d.org/tiki-index.php?page=Integrating+Ogre+into+QT5 ), RViz segfaults on OS X. Debugging the issue, we saw that it fails at:

assert([externalHandle isKindOfClass:[NSView class]]);

The problem seems to be that the window_id obtained from the rendering window is 0, which it is not on either Linux or Windows.

Having a look at Gazebo, which also uses Qt 5 and Ogre3D, older code contained a comment
// Mac and Windows *must* use externalWindow handle.
(see https://bitbucket.org/osrf/gazebo/pull-requests/2764/gui-plugins-on-macos/diff)

Current code still needs externalWindowHandle, however they calculate it specifically, but need X11 on OSX for it:
See https://github.com/arpg/Gazebo/blob/619218c0bb3dc8878b6c4dc2fddf3f7ec1d85497/gazebo/rendering/WindowManager.cc#L84
for the externalWindowHandle on Mac, which is calculated here:
https://github.com/thomas-moulard/gazebo-deb/blob/456da84cfb7b0bdac53241f6c4e86ffe1becfa7d/gazebo/gui/GLWidget.cc#L714-L735
So it's definitely different from the window handle in RViz.

We'll investigate the issue further and post whatever useful information we find.

[rviz_rendering] check if OGRE_PLUGIN_DIR is still required

Since we're using static linking, rather than dynamically loading ogre plugins, we may no longer need to set it from the build system:

This is where we statically load and avoid needing to load dynamically:

[rviz_common] fix help panel and splashscreen

See:

  • // TODO(wjwwood): reenable this feature
    #if 0
    /// Set the path to the html help file.
    /**
    * Default is a file within the rviz_common package.
    */
    void
    setHelpPath(const QString & help_path);
    #endif
  • // TODO(wjwwood): reenable this once we can get package resources
    // package_path_ = ros::package::getPath("rviz");
    // help_path_ = QString::fromStdString((fs::path(
    // package_path_) / "help/help.html").BOOST_FILE_STRING());
    // splash_path_ = QString::fromStdString((fs::path(
    // package_path_) / "images/splash.png").BOOST_FILE_STRING());
  • void VisualizationFrame::setHelpPath(const QString & help_path)
    {
    help_path_ = help_path;
    manager_->setHelpPath(help_path_);
    }
    #endif
  • // TODO(wjwwood): reenable this when plugin loading is fixed.
    #if 0
    QDockWidget * dock = addPanelByName("Help", "rviz/Help");
    show_help_action_ = dock->toggleViewAction();
    connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(onHelpDestroyed()));
    #endif

These may rely on the #49 solution and will require replacing boost::filesystem too.

Find a way to run on Windows without using windeployqt

Right now we are using the windeployqt program to copy Qt dll's and stuff into the destination directory, see:

  • # TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later.
  • # TODO(wjwwood): find a way to make this optional or to run without "deploying" the
    # necessary dlls and stuff to the bin folder.
    # see:
    # https://stackoverflow.com/questions/41193584/deploy-all-qt-dependencies-when-building#41199492

Those links are for the rendering_example from rviz_rendering, but it would also need to be used in the rviz2 package's rviz2_app program.

Ideally, we'd be able run our resulting binaries without this deployment step, but if we have to keep, then we should clean it up and describe it better.

[general] integration tests

Create product tests or integration tests for nightly jobs to check whether display types work correctly

  • compare display
  • potentially use ogre tests

Have smoke tests for the different systems

Broken scaling when starting RViz

When starting RViz, the render panel scaling is broken.
The content does only fill a small part of the render panel.

screenshot from 2017-10-18 15-14-08

After resizing the window the scaling gets corrected.
Seems like the content has to be scaled once after initializing.

[rviz_rendering] CMake build fails for CMAKE_BUILD_TYPE=Debug

When building the rendering_example under Ubuntu 16.04 with CMAKE_BUILD_TYPE=Debug the build fails with the following error message:
make[3]: *** No rule to make target '_ogre_overlay_static_library_debug_abs-NOTFOUND', needed by 'rendering_example'. Stop.

[rviz_rendering] render window is black

When running the rendering_example demo and switching to TAB 2 you only get a black screen instead of a rendered image.

rviz_rendering-black-screen

I think this is because auto update is disabled on the Ogre::RenderWindow.
Removing window->setAutoUpdated(false) from render_system.cpp:446 should fix this issue.

[rviz_rendering] implement and document replacement for media_export

In rviz in ROS 1, a package called media_export was used in combination with the ROS_PACKAGE_PATH via the rospack C++ API to allow other packages to include resources for Ogre to be used with their rviz plugins.

That code has been commented out in the ros2 port, but we need to find a suitable alternative for ROS 2. Again, this means using ament_index in a similar way as described in #3, but instead of using it to find one package you would use it to find packages which provide media for Ogre by looking at a different ament index resource, something like rviz_ogre_media_exports or similar. For details on ament index and how it could be used to do this, see resources linked to in #3.

[rviz_common] port basic plugins from "temp" location

For the demo I minimally ported the movement tool, one view controller (orbit), and a handful of display types to this "temp" folder in rviz_common:

https://github.com/ros2/rviz/tree/ca8f42e43ba9eaa6e15434b47906d7580da1c14a/rviz_common/src/rviz_common/temp/default_plugins

These were copied from rviz/src/rviz/default_plugin. So they should be deleted and the actual port should be made where we move the files in rviz/src/rviz/default_plugin to somewhere in the new rviz_default_plugins package and properly ported/updated. These files in the "temp" folder may serve as an example of how to solve some problems.

Once ported these plugins need to be in a shared library and need to be loaded via pluginlib, so this depends on #49.

The end goal of this would be to have a MVP application which improves on the current state by:

  • loading from pluginlib mechanism and
  • properly porting plugins to rviz_default_plugins

[general] unit tests

  • use gtest and gmock for it is already working with ament
  • port tests of rviz (ros1)
  • write new tests for rviz
  • add issues for not ported tests

[rviz_rendering] add ament linters

The rviz_rendering package is already setup as an ament package, but we should add the normal ament linters from the ros2 project so we can hae automatic linting and style checking for our cmake and c++ code.

[rviz_common] re-enable SyncApprox in the frame manager

See:

  • // TODO(wjwwood): figureout where getLatestCommonTime went, then reenable this
    #if 0
    // if we don't have tf info for the given timestamp, use the latest available
    rclcpp::Time latest_time;
    std::string error_string;
    int error_code;
    error_code = tf_->getLatestCommonTime(fixed_frame_, frame, latest_time, &error_string);
    if (error_code != 0) {
    ROS_ERROR("Error getting latest time from frame '%s' to frame '%s': %s (Error code: %d)",
    frame.c_str(), fixed_frame_.c_str(), error_string.c_str(), error_code);
    return false;
    }
    if (latest_time > sync_time_) {
    time = sync_time_;
    }
    #endif

I believe this function has moved into tf2_ros::Buffer somewhere, but @tfoote suggested that there might be a better way to do this now. @tfoote if you have a minute could repeat the suggestion here? I seem to have lost track of it...

[rviz_common] use port/alternative to pluginlib

Much of the plugin related loading of displays, tools, and view controllers is currently disabled. Once we have a solution for pluginlib, we should re-enable these by using that alternative.

Here are some examples:

And certainly other places with a similar comment out and todo pattern.

I'll take this one on, as well as finding a pluginlib solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.