Skip to content

Commit

Permalink
Migrate Axes Display (#429)
Browse files Browse the repository at this point in the history
* Move axes display

* Make display compile and fix linters

* Hide axis when transform in error

* Minor refactoring of axes

- Shapes are now unique pointers
- When accessing them, return a reference only (no need for anything
else

* Add visual test

* Update README

* Fix indentation in plugins_description

* Use getFrameStd instead of getStdString

To ensure we get a frame ID in the case the property is set to the fixed frame.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
Martin-Idel authored and jacobperron committed Oct 1, 2019
1 parent 5164760 commit a2be171
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 199 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ For some displays, the [documentation is updated](docs/FEATURES.md).

| Displays | Tools | View Controller | Panels |
| --------------------- | ------------- | --------------------- | --------------- |
| Camera | Move Camera | Orbit | Displays |
| Fluid Pressure | Focus Camera | XY Orbit | Help |
| Grid | Measure | First Person | Selections |
| Grid Cells | Select | Third Person Follower | Tool Properties |
| Illuminance | 2D Goal Pose | Top Down Orthographic | Views |
| Image | Publish Point |
| Laser Scan | Initial Pose |
| Map | Interact |
| Axes | Move Camera | Orbit | Displays |
| Camera | Focus Camera | XY Orbit | Help |
| Fluid Pressure | Measure | First Person | Selections |
| Grid | Select | Third Person Follower | Tool Properties |
| Grid Cells | 2D Nav Goal | Top Down Orthographic | Views |
| Illuminance | Publish Point |
| Image | Initial Pose |
| Interactive Marker | Interact |
| Laser Scan |
| Map |
| Marker |
| Marker Array |
| Odometry |
Expand All @@ -41,19 +43,16 @@ For some displays, the [documentation is updated](docs/FEATURES.md).
### Not yet ported
These features have not been ported to `ros2/rviz` yet.

| Displays | Tools | Panels |
| -------------------- | ------------ | ------ |
| Axes | | Time |
| DepthCloud |
| Displays | Panels |
| -------------------- | ------ |
| DepthCloud | Time |
| Effort |
| Interactive Marker |
| Oculus |
| Pose With Covariance |

Other features:
- Filtering of Topic lists by topic type
- Message filters
- Image transport 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.
Expand Down
126 changes: 0 additions & 126 deletions rviz/src/rviz/default_plugin/axes_display.cpp

This file was deleted.

16 changes: 16 additions & 0 deletions rviz_default_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ find_package(visualization_msgs REQUIRED)

# These need to be added in the add_library() call so AUTOMOC detects them.
set(rviz_default_plugins_headers_to_moc
include/rviz_default_plugins/displays/axes/axes_display.hpp
include/rviz_default_plugins/displays/camera/camera_display.hpp
include/rviz_default_plugins/displays/fluid_pressure/fluid_pressure_display.hpp
include/rviz_default_plugins/displays/grid/grid_display.hpp
Expand Down Expand Up @@ -136,6 +137,7 @@ set(rviz_default_plugins_headers_to_moc
)

set(rviz_default_plugins_source_files
src/rviz_default_plugins/displays/axes/axes_display.cpp
src/rviz_default_plugins/displays/camera/camera_display.cpp
src/rviz_default_plugins/displays/grid/grid_display.cpp
src/rviz_default_plugins/displays/grid_cells/grid_cells_display.cpp
Expand Down Expand Up @@ -632,6 +634,20 @@ if(BUILD_TESTING)
target_link_libraries(transformer_guard_test ${TEST_LINK_LIBRARIES})
endif()

ament_add_gtest(axes_display_visual_test
test/rviz_default_plugins/displays/axes/axes_display_visual_test.cpp
test/rviz_default_plugins/page_objects/axes_display_page_object.cpp
${SKIP_VISUAL_TESTS}
TIMEOUT 180)
if(TARGET axes_display_visual_test)
target_include_directories(axes_display_visual_test PUBLIC
${TEST_INCLUDE_DIRS}
${rviz_visual_testing_framework_INCLUDE_DIRS})
target_link_libraries(axes_display_visual_test
${TEST_LINK_LIBRARIES}
rviz_visual_testing_framework::rviz_visual_testing_framework)
endif()

ament_add_gtest(camera_display_visual_test
test/rviz_default_plugins/displays/camera/camera_display_visual_test.cpp
test/rviz_default_plugins/publishers/camera_info_publisher.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,63 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef RVIZ_AXES_DISPLAY_H
#define RVIZ_AXES_DISPLAY_H
#ifndef RVIZ_DEFAULT_PLUGINS__DISPLAYS__AXES__AXES_DISPLAY_HPP_
#define RVIZ_DEFAULT_PLUGINS__DISPLAYS__AXES__AXES_DISPLAY_HPP_

#include "rviz/display.h"
#include <memory>

namespace rviz
{
#include "rviz_common/display.hpp"

namespace rviz_rendering
{
class Axes;
}

namespace rviz_common
{
namespace properties
{
class FloatProperty;
class TfFrameProperty;
}
}

/** @brief Displays a set of XYZ axes at the origin of a chosen frame. */
class AxesDisplay: public Display
namespace rviz_default_plugins
{
Q_OBJECT
namespace displays
{

class AxesDisplay : public rviz_common::Display
{
Q_OBJECT

public:
AxesDisplay();
virtual ~AxesDisplay();

void onInitialize();
~AxesDisplay() override;

/**
* \brief Set the parameters for the axes
* @param length Length of each axis
* @param radius Radius of each axis
*/
void set( float length, float radius );
void onInitialize() override;

// Overrides from Display
virtual void update(float dt, float ros_dt);
void update(float dt, float ros_dt) override;

protected:
// overrides from Display
virtual void onEnable();
virtual void onDisable();
void onEnable() override;

void onDisable() override;

private Q_SLOTS:
/** @brief Update the length and radius of the axes object from property values. */
void updateShape();

private:
Axes* axes_; ///< Handles actually drawing the axes
std::shared_ptr<rviz_rendering::Axes> axes_;

FloatProperty* length_property_;
FloatProperty* radius_property_;
TfFrameProperty* frame_property_;
rviz_common::properties::FloatProperty * length_property_;
rviz_common::properties::FloatProperty * radius_property_;
rviz_common::properties::TfFrameProperty * frame_property_;
};

} // namespace rviz
} // namespace displays
} // namespace rviz_default_plugins

#endif
#endif // RVIZ_DEFAULT_PLUGINS__DISPLAYS__AXES__AXES_DISPLAY_HPP_
11 changes: 11 additions & 0 deletions rviz_default_plugins/plugins_description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

<!-- Displays plugins -->

<class
name="rviz_default_plugins/Axes"
type="rviz_default_plugins::displays::AxesDisplay"
base_class_type="rviz_common::Display"
>
<description>
Displays an axis at the Target Frame's origin.
&lt;a href="http://www.ros.org/wiki/rviz/DisplayTypes/Axes"&gt;More Information&lt;/a&gt;.
</description>
</class>

<class
name="rviz_default_plugins/Camera"
type="rviz_default_plugins::displays::CameraDisplay"
Expand Down
Loading

0 comments on commit a2be171

Please sign in to comment.