Skip to content

Commit 20beb61

Browse files
authored
Feat od 3.4 (#25)
* New OD parameters handling * CLang formatting * Import Rviz OD plugin (not yet working) * RViz plugin for Object Detection working * Fix OD tracking behavior * Add files via upload * OD Plugin readme images * Update README.md
1 parent f816079 commit 20beb61

File tree

21 files changed

+1653
-358
lines changed

21 files changed

+1653
-358
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ Makefile*
3737
# QtCtreator CMake
3838
CMakeLists.txt.user*
3939

40+
# VS Code
41+
.vscode
42+
.vscode/*

rviz-plugin-zed-od/CMakeLists.txt

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
cmake_minimum_required(VERSION 3.0.2)
2+
project(rviz_plugin_zed_od)
3+
4+
find_package(catkin REQUIRED
5+
COMPONENTS
6+
rviz
7+
zed_interfaces
8+
)
9+
catkin_package(
10+
CATKIN_DEPENDS
11+
zed_interfaces
12+
)
13+
14+
include_directories(${catkin_INCLUDE_DIRS})
15+
link_directories(${catkin_LIBRARY_DIRS})
16+
17+
## This setting causes Qt's "MOC" generation to happen automatically.
18+
set(CMAKE_AUTOUIC ON)
19+
set(CMAKE_AUTOMOC ON)
20+
set(CMAKE_AUTORCC ON)
21+
22+
## This plugin includes Qt widgets, so we must include Qt.
23+
## We'll use the version that rviz used so they are compatible.
24+
if(rviz_QT_VERSION VERSION_LESS "5")
25+
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
26+
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
27+
## pull in all required include dirs, define QT_LIBRARIES, etc.
28+
include(${QT_USE_FILE})
29+
else()
30+
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
31+
find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
32+
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
33+
set(QT_LIBRARIES Qt5::Widgets)
34+
endif()
35+
36+
include_directories(src/plugin/include)
37+
38+
## Here we specify the list of source files.
39+
## The generated MOC files are included automatically as headers.
40+
set(SRC_FILES
41+
src/plugin/src/zed_od_display.cpp
42+
src/plugin/src/zed_od_info.cpp
43+
)
44+
45+
set(INC_FILES
46+
src/plugin/include/zed_od_display.hpp
47+
src/plugin/include/zed_od_info.hpp
48+
)
49+
50+
## An rviz plugin is just a shared library, so here we declare the
51+
## library to be called ``${PROJECT_NAME}`` (which is
52+
## "rviz_plugin_zed_od", and specify the list of source files we collected above
53+
## in ``${SRC_FILES}`` and ``${INC_FILES}``.
54+
add_library(${PROJECT_NAME}
55+
${SRC_FILES}
56+
${INC_FILES}
57+
)
58+
59+
target_include_directories(${PROJECT_NAME} PUBLIC
60+
${zed_interfaces_INCLUDE_DIRS}
61+
${OGRE_INCLUDE_DIRS}
62+
${Qt5Widgets_INCLUDE_DIRS}
63+
)
64+
65+
## Link the executable with whatever Qt libraries have been defined by
66+
## the ``find_package(Qt4 ...)`` line above, or by the
67+
## ``set(QT_LIBRARIES Qt5::Widgets)``, and with whatever libraries
68+
## catkin has included.
69+
##
70+
## Although this puts "rviz_plugin_zed_od" as the name of the library, cmake knows it is a
71+
## library and names the actual file something like
72+
## "librviz_plugin_zed_od.so", or whatever is appropriate for your
73+
## particular OS.
74+
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${catkin_LIBRARIES})
75+
76+
# prevent pluginlib from using boost
77+
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
78+
79+
## Install rules
80+
81+
install(TARGETS
82+
${PROJECT_NAME}
83+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
84+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
85+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
86+
)
87+
88+
install(FILES
89+
plugin_description.xml
90+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
91+
)
92+
93+
install(DIRECTORY media/
94+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/media
95+
)
96+
97+
install(DIRECTORY icons/
98+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/icons
99+
)
100+

rviz-plugin-zed-od/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Stereolabs ZED Camera - ROS Object Detection Rviz Plugin
2+
3+
This package lets you visualize in the [ROS RViz application](http://wiki.ros.org/rviz) all the
4+
information provided by the Object Detection module of the ZED SDK used together with a ZED2 camera.
5+
6+
**Note:** The main package [zed-ros-wrapper](https://github.com/stereolabs/zed-ros-wrapper)
7+
is required to correctly execute the ROS node to acquire data from a Stereolabs 3D camera.
8+
9+
## Getting started
10+
11+
- First, be sure to have installed the main ROS package to integrate the ZED cameras in the ROS framework: [zed-ros-wrapper](https://github.com/stereolabs/zed-ros-wrapper/#build-the-program)
12+
- [Install](#Installation) the package
13+
- Read the online documentation for [More information](https://www.stereolabs.com/docs/ros/)
14+
15+
### Prerequisites
16+
17+
- Ubuntu 18.04 or newer (Ubuntu 18 recommended)
18+
- [ZED SDK](https://www.stereolabs.com/developers/release/latest/) v3.4 or later
19+
- [ROS Melodic](http://wiki.ros.org/melodic/Installation/Ubuntu)
20+
21+
### Installation
22+
23+
The *zed_display_rviz* is a catking package.
24+
25+
Install the [zed-ros-wrapper](https://www.stereolabs.com/documentation/guides/using-zed-with-ros/introduction.html) package
26+
following the [installation guide](https://github.com/stereolabs/zed-ros-wrapper#build-the-program)
27+
28+
Install the [zed-ros-examples](https://github.com/stereolabs/zed-ros-examples) package following the [installation guide](https://github.com/stereolabs/zed-ros-examples#build-the-program)
29+
30+
### Execution
31+
32+
Available only if you own a ZED 2 camera:
33+
34+
$ roslaunch zed_display_rviz display_zed2.launch
35+
36+
![Object Detection parameters](images/rviz_obj_det.png)
37+
![Skeleton visualization](images/rviz_od_skeletons.png)
38+
![Multiclass visualization](images/rviz_od_multiclass.png)
39+
40+
[Detailed information](https://www.stereolabs.com/docs/ros/object-detection/)
661 Bytes
Loading
20.6 KB
Loading
1.31 MB
Loading
1.71 MB
Loading

rviz-plugin-zed-od/package.xml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>rviz_plugin_zed_od</name>
5+
<version>0.1.0</version>
6+
<description>Plugin to display Object Detection results on Rviz</description>
7+
<maintainer email="[email protected]">STEREOLABS</maintainer>
8+
9+
<license>MIT</license>
10+
11+
<url type="website">https://www.stereolabs.com/</url>
12+
<url type="repository">https://github.com/stereolabs/zed-ros-wrapper</url>
13+
<url type="bugtracker">https://github.com/stereolabs/zed-ros-wrapper/issues</url>
14+
15+
<buildtool_depend>catkin</buildtool_depend>
16+
17+
<build_depend>qtbase5-dev</build_depend>
18+
<build_depend>rviz</build_depend>
19+
20+
<exec_depend>libqt5-core</exec_depend>
21+
<exec_depend>libqt5-gui</exec_depend>
22+
<exec_depend>libqt5-widgets</exec_depend>
23+
<exec_depend>rviz</exec_depend>
24+
25+
<depend>zed_interfaces</depend>
26+
27+
<export>
28+
<rviz plugin="${prefix}/plugin_description.xml"/>
29+
</export>
30+
</package>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<library path="lib/librviz_plugin_zed_od">
2+
<class name="rviz_plugin_zed_od/ZedOdDisplay"
3+
type="rviz_plugin_zed_od::displays::ZedOdDisplay"
4+
base_class_type="rviz::Display">
5+
<description>
6+
Displays the results of the Object Detection module of the Stereolabs ZED SDK.
7+
</description>
8+
<message_type>zed_interfaces/ObjectsStamped</message_type>
9+
</class>
10+
</library>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2020 Stereolabs
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
#ifndef ZED_OD_PLUGIN_HPP
26+
#define ZED_OD_PLUGIN_HPP
27+
28+
#include <zed_interfaces/ObjectsStamped.h>
29+
30+
#include <rviz/message_filter_display.h>
31+
#include <rviz/properties/bool_property.h>
32+
#include <rviz/properties/float_property.h>
33+
34+
#include <OGRE/OgreVector3.h>
35+
#include <OGRE/OgreSceneNode.h>
36+
#include <OGRE/OgreSceneManager.h>
37+
38+
#include <map>
39+
40+
#include "zed_od_info.hpp"
41+
42+
namespace rviz_plugin_zed_od
43+
{
44+
namespace displays
45+
{
46+
47+
typedef std::shared_ptr<ZedOdInfo> objectPtr;
48+
49+
class ZedOdDisplay : public
50+
rviz::MessageFilterDisplay<zed_interfaces::ObjectsStamped> {
51+
Q_OBJECT
52+
53+
public:
54+
ZedOdDisplay();
55+
~ZedOdDisplay();
56+
57+
void onInitialize() override;
58+
void reset() override;
59+
60+
private:
61+
void processMessage(const zed_interfaces::ObjectsStamped::ConstPtr& msg);
62+
void createOrUpdateObject(zed_interfaces::Object& obj);
63+
void invalidateObjs();
64+
void removeNotValidObjs();
65+
66+
private slots:
67+
void updateShowSkeleton();
68+
void updateShowLabel();
69+
void updateAlpha();
70+
void updateShowBBox();
71+
void updateLinkSize();
72+
void updateJointRadius();
73+
void updateLabelScale();
74+
75+
protected:
76+
/** @brief Overridden from MessageFilterDisplay to get arrow/axes visibility correct. */
77+
void onEnable() override;
78+
void onDisable() override;
79+
80+
private:
81+
rviz::FloatProperty* mPropAlpha;
82+
rviz::BoolProperty* mPropShowSkeleton;
83+
rviz::BoolProperty* mPropShowLabel;
84+
rviz::BoolProperty* mPropShowBBox;
85+
rviz::FloatProperty* mPropLinkSize;
86+
rviz::FloatProperty* mPropJointRadius;
87+
rviz::FloatProperty* mPropLabelScale;
88+
89+
std::map<int16_t,objectPtr> mObjects;
90+
std::map<int16_t,bool> mObjUpdated;
91+
};
92+
93+
} // namespace displays
94+
} // namespace rviz_plugin_zed_od
95+
96+
#endif // #define ZED_OD_PLUGIN_HPP

0 commit comments

Comments
 (0)