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

Compressed Image Display #1288

Draft
wants to merge 17 commits into
base: rolling
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ These features have already been ported from `ros-visualization/rviz` to `ros2/r
The basic documentation can still be found on the RViz [wiki page](http://www.ros.org/wiki/rviz).
For some displays, the [documentation is updated](docs/FEATURES.md).

| 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 |
| 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 (and `image_transport` types) |
| 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
Expand Down
2 changes: 2 additions & 0 deletions rviz_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ set(rviz_common_headers_to_moc
include/rviz_common/properties/property_tree_with_help.hpp
include/rviz_common/properties/qos_profile_property.hpp
include/rviz_common/properties/ros_topic_property.hpp
include/rviz_common/properties/ros_topic_multi_property.hpp
include/rviz_common/properties/status_list.hpp
include/rviz_common/properties/status_property.hpp
include/rviz_common/properties/string_property.hpp
Expand Down Expand Up @@ -183,6 +184,7 @@ set(rviz_common_source_files
src/rviz_common/properties/property_tree_with_help.cpp
src/rviz_common/properties/property.cpp
src/rviz_common/properties/ros_topic_property.cpp
src/rviz_common/properties/ros_topic_multi_property.cpp
src/rviz_common/properties/quaternion_property.cpp
src/rviz_common/properties/qos_profile_property.cpp
src/rviz_common/properties/regex_filter_property.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2012, Willow Garage, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef RVIZ_COMMON__PROPERTIES__ROS_TOPIC_MULTI_PROPERTY_HPP_
#define RVIZ_COMMON__PROPERTIES__ROS_TOPIC_MULTI_PROPERTY_HPP_

#include <QString>

#include <string>
#include <vector>

#include "rviz_common/properties/ros_topic_property.hpp"
#include "rviz_common/ros_integration/ros_node_abstraction_iface.hpp"
#include "rviz_common/visibility_control.hpp"

namespace rviz_common
{
namespace properties
{

// Like RosTopicProperty but can accept multiple message types
class RVIZ_COMMON_PUBLIC RosTopicMultiProperty : public RosTopicProperty
{
Q_OBJECT

public:
explicit RosTopicMultiProperty(
const QString & name = QString(), const QString & default_value = QString(),
mjforan marked this conversation as resolved.
Show resolved Hide resolved
const std::vector<QString> & message_types = std::vector<QString>(),
const QString & description = QString(), Property * parent = nullptr,
const char * changed_slot = nullptr, QObject * receiver = nullptr)
: RosTopicProperty(name, default_value, "", description, parent, changed_slot, receiver),
message_types_(message_types)
{
}

void setMessageTypes(const std::vector<QString> & message_types)
{
message_types_ = message_types;
}

std::vector<QString> getMessageTypes() const {return message_types_;}

protected Q_SLOTS:
void fillTopicList() override;

private:
// Hide the parent class methods which only take a single type
using RosTopicProperty::getMessageType;
using RosTopicProperty::setMessageType;

// Instead of one message type, store a list of allowed types
std::vector<QString> message_types_;
};

} // end namespace properties
} // end namespace rviz_common

#endif // RVIZ_COMMON__PROPERTIES__ROS_TOPIC_MULTI_PROPERTY_HPP_
37 changes: 12 additions & 25 deletions rviz_common/include/rviz_common/properties/ros_topic_property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,52 +49,39 @@ class RVIZ_COMMON_PUBLIC RosTopicProperty : public EditableEnumProperty

public:
explicit RosTopicProperty(
const QString & name = QString(),
const QString & default_value = QString(),
const QString & message_type = QString(),
const QString & description = QString(),
Property * parent = nullptr,
const char * changed_slot = nullptr,
QObject * receiver = nullptr);
const QString & name = QString(), const QString & default_value = QString(),
const QString & message_type = QString(), const QString & description = QString(),
Property * parent = nullptr, const char * changed_slot = nullptr, QObject * receiver = nullptr);

void initialize(ros_integration::RosNodeAbstractionIface::WeakPtr rviz_ros_node);

void setMessageType(const QString & message_type);

QString getMessageType() const
{return message_type_;}
QString getMessageType() const {return message_type_;}

QString getTopic() const
{return getValue().toString();}
QString getTopic() const {return getValue().toString();}

std::string getTopicStd() const
{return getValue().toString().toStdString();}
std::string getTopicStd() const {return getValue().toString().toStdString();}

bool isEmpty() const
{return getTopicStd().empty();}
bool isEmpty() const {return getTopicStd().empty();}

protected Q_SLOTS:
virtual void fillTopicList();

private:
protected:
ros_integration::RosNodeAbstractionIface::WeakPtr rviz_ros_node_;
QString message_type_;
};

class RVIZ_COMMON_PUBLIC RosFilteredTopicProperty
: public rviz_common::properties::RosTopicProperty
class RVIZ_COMMON_PUBLIC RosFilteredTopicProperty : public rviz_common::properties::RosTopicProperty
{
Q_OBJECT

public:
RosFilteredTopicProperty(
const QString & name = QString(),
const QString & default_value = QString(),
const QString & message_type = QString(),
const QString & description = QString(),
const QRegExp & filter = QRegExp(),
Property * parent = 0,
const char * changed_slot = 0,
const QString & name = QString(), const QString & default_value = QString(),
const QString & message_type = QString(), const QString & description = QString(),
const QRegExp & filter = QRegExp(), Property * parent = 0, const char * changed_slot = 0,
QObject * receiver = 0);

void enableFilter(bool enabled);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright (c) 2012, Willow Garage, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include "rviz_common/properties/ros_topic_multi_property.hpp"

#include <QApplication> // NOLINT: cpplint can't handle Qt imports
#include <algorithm>
#include <map>
#include <string>

#include "rviz_common/ros_integration/ros_node_abstraction_iface.hpp"

namespace rviz_common
{
namespace properties
{

void RosTopicMultiProperty::fillTopicList()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
clearOptions();

std::map<std::string, std::vector<std::string>> published_topics =
rviz_ros_node_.lock()->get_topic_names_and_types();

for (const auto & topic : published_topics) {
// Only add topics whose type matches.
for (const auto & type : topic.second) {
if (
std::find(message_types_.begin(), message_types_.end(), QString::fromStdString(type)) !=
message_types_.end())
{
addOptionStd(topic.first);
}
}
}
sortOptions();
QApplication::restoreOverrideCursor();
}

} // end namespace properties
} // end namespace rviz_common
4 changes: 4 additions & 0 deletions rviz_default_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -883,13 +883,17 @@ if(BUILD_TESTING)
${SKIP_VISUAL_TESTS}
TIMEOUT 180)
if(TARGET image_display_visual_test)
find_package(OpenCV REQUIRED)
find_package(image_transport_plugins REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_include_directories(image_display_visual_test PRIVATE test)
target_link_libraries(image_display_visual_test
Qt5::Test
rviz_visual_testing_framework::rviz_visual_testing_framework
rclcpp::rclcpp
${sensor_msgs_TARGETS}
${std_msgs_TARGETS}
${OpenCV_LIBRARIES}
)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# include "sensor_msgs/msg/camera_info.hpp"
# include "tf2_ros/message_filter.h"

# include "rviz_default_plugins/displays/image/image_transport_display.hpp"
# include "rviz_default_plugins/displays/image/image_display.hpp"
# include "rviz_default_plugins/displays/image/ros_image_texture_iface.hpp"
# include "rviz_default_plugins/visibility_control.hpp"
# include "rviz_rendering/render_window.hpp"
Expand Down Expand Up @@ -102,7 +102,7 @@ struct ImageDimensions
*
*/
class RVIZ_DEFAULT_PLUGINS_PUBLIC CameraDisplay
: public rviz_default_plugins::displays::ImageTransportDisplay<sensor_msgs::msg::Image>,
: public ImageDisplay,
public Ogre::RenderTargetListener
{
Q_OBJECT
Expand Down
Loading