Skip to content

Commit 54b1043

Browse files
committed
Add particle cloud display rviz plugin
Signed-off-by: Sarthak Mittal <[email protected]>
1 parent 6fb43d4 commit 54b1043

File tree

8 files changed

+864
-48
lines changed

8 files changed

+864
-48
lines changed

nav2_bringup/bringup/rviz/nav2_default_view.rviz

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Panels:
88
- /TF1/Frames1
99
- /TF1/Tree1
1010
Splitter Ratio: 0.5833333134651184
11-
Tree Height: 606
11+
Tree Height: 592
1212
- Class: rviz_common/Selection
1313
Name: Selection
1414
- Class: rviz_common/Tool Properties
@@ -94,8 +94,6 @@ Visualization Manager:
9494
Value: true
9595
imu_link:
9696
Value: true
97-
map:
98-
Value: true
9997
odom:
10098
Value: true
10199
wheel_left_link:
@@ -108,29 +106,7 @@ Visualization Manager:
108106
Show Axes: true
109107
Show Names: false
110108
Tree:
111-
map:
112-
odom:
113-
base_footprint:
114-
base_link:
115-
base_scan:
116-
{}
117-
camera_link:
118-
camera_depth_frame:
119-
camera_depth_optical_frame:
120-
{}
121-
camera_rgb_frame:
122-
camera_rgb_optical_frame:
123-
{}
124-
caster_back_left_link:
125-
{}
126-
caster_back_right_link:
127-
{}
128-
imu_link:
129-
{}
130-
wheel_left_link:
131-
{}
132-
wheel_right_link:
133-
{}
109+
{}
134110
Update Interval: 0
135111
Value: true
136112
- Alpha: 1
@@ -211,31 +187,32 @@ Visualization Manager:
211187
History Policy: Keep Last
212188
Reliability Policy: Reliable
213189
Value: /map
190+
Update Topic:
191+
Depth: 5
192+
Durability Policy: Volatile
193+
History Policy: Keep Last
194+
Reliability Policy: Reliable
195+
Value: /map_updates
214196
Use Timestamp: false
215197
Value: true
216198
- Alpha: 1
217-
Arrow Length: 0.019999999552965164
218-
Axes Length: 0.30000001192092896
219-
Axes Radius: 0.009999999776482582
220-
Class: rviz_default_plugins/PoseArray
199+
Class: nav2_rviz_plugins/ParticleCloudDisplay
221200
Color: 0; 180; 0
222201
Enabled: true
223-
Head Length: 0.07000000029802322
224-
Head Radius: 0.029999999329447746
202+
Max Arrow Length: 0.10000000149011612
203+
Min Arrow Length: 0.019999999552965164
225204
Name: Amcl Particle Swarm
226-
Shaft Length: 0.23000000417232513
227-
Shaft Radius: 0.009999999776482582
228205
Shape: Arrow (Flat)
229206
Topic:
230207
Depth: 5
231208
Durability Policy: Volatile
232209
History Policy: Keep Last
233210
Reliability Policy: Best Effort
234-
Value: /particlecloud
211+
Value: /particle_cloud
235212
Value: true
236213
- Class: rviz_common/Group
237214
Displays:
238-
- Alpha: 0.3
215+
- Alpha: 0.30000001192092896
239216
Class: rviz_default_plugins/Map
240217
Color Scheme: costmap
241218
Draw Behind: false
@@ -247,6 +224,12 @@ Visualization Manager:
247224
History Policy: Keep Last
248225
Reliability Policy: Reliable
249226
Value: /global_costmap/costmap
227+
Update Topic:
228+
Depth: 5
229+
Durability Policy: Volatile
230+
History Policy: Keep Last
231+
Reliability Policy: Reliable
232+
Value: /global_costmap/costmap_updates
250233
Use Timestamp: false
251234
Value: true
252235
- Alpha: 1
@@ -337,6 +320,12 @@ Visualization Manager:
337320
History Policy: Keep Last
338321
Reliability Policy: Reliable
339322
Value: /local_costmap/costmap
323+
Update Topic:
324+
Depth: 5
325+
Durability Policy: Volatile
326+
History Policy: Keep Last
327+
Reliability Policy: Reliable
328+
Value: /local_costmap/costmap_updates
340329
Use Timestamp: false
341330
Value: true
342331
- Alpha: 1
@@ -546,7 +535,7 @@ Window Geometry:
546535
Hide Right Dock: true
547536
Navigation 2:
548537
collapsed: false
549-
QMainWindow State: 000000ff00000000fd00000004000000000000016a0000034afc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000029b000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000018004e0061007600690067006100740069006f006e0020003201000002de000000a90000008100fffffffb0000001e005200650061006c00730065006e0073006500430061006d00650072006100000002c6000000c10000002800ffffff000000010000010f0000034afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d0000034a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004990000034a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
538+
QMainWindow State: 000000ff00000000fd00000004000000000000016a0000034afc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000028d000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000018004e0061007600690067006100740069006f006e0020003201000002d0000000b7000000b700fffffffb0000001e005200650061006c00730065006e0073006500430061006d00650072006100000002c6000000c10000002800ffffff000000010000010f0000034afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d0000034a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004990000034a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
550539
RealsenseCamera:
551540
collapsed: false
552541
Selection:
@@ -556,5 +545,5 @@ Window Geometry:
556545
Views:
557546
collapsed: true
558547
Width: 1545
559-
X: 696
560-
Y: 229
548+
X: 375
549+
Y: 118

nav2_bringup/bringup/rviz/nav2_namespaced_view.rviz

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,19 @@ Visualization Manager:
164164
Use Timestamp: false
165165
Value: true
166166
- Alpha: 1
167-
Arrow Length: 0.019999999552965164
168-
Axes Length: 0.30000001192092896
169-
Axes Radius: 0.009999999776482582
170-
Class: rviz_default_plugins/PoseArray
167+
Class: nav2_rviz_plugins/ParticleCloudDisplay
171168
Color: 0; 180; 0
172169
Enabled: true
173-
Head Length: 0.07000000029802322
174-
Head Radius: 0.029999999329447746
170+
Max Arrow Length: 0.10000000149011612
171+
Min Arrow Length: 0.019999999552965164
175172
Name: Amcl Particle Swarm
176-
Shaft Length: 0.23000000417232513
177-
Shaft Radius: 0.009999999776482582
178173
Shape: Arrow (Flat)
179174
Topic:
180175
Depth: 5
181176
Durability Policy: Volatile
182177
History Policy: Keep Last
183178
Reliability Policy: Best Effort
184-
Value: <robot_namespace>/particlecloud
179+
Value: <robot_namespace>/particle_cloud
185180
Value: true
186181
- Class: rviz_common/Group
187182
Displays:

nav2_rviz_plugins/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ set(nav2_rviz_plugins_headers_to_moc
3737
include/nav2_rviz_plugins/goal_common
3838
include/nav2_rviz_plugins/goal_tool.hpp
3939
include/nav2_rviz_plugins/nav2_panel.hpp
40+
include/nav2_rviz_plugins/flat_weighted_arrows_array.hpp
41+
include/nav2_rviz_plugins/particle_cloud_display.hpp
4042
)
4143

4244
include_directories(
@@ -48,6 +50,8 @@ set(library_name ${PROJECT_NAME})
4850
add_library(${library_name} SHARED
4951
src/goal_tool.cpp
5052
src/nav2_panel.cpp
53+
src/flat_weighted_arrows_array.cpp
54+
src/particle_cloud_display.cpp
5155
${nav2_rviz_plugins_headers_to_moc}
5256
)
5357

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2012, Willow Garage, Inc.
3+
* Copyright (c) 2018, Bosch Software Innovations GmbH.
4+
* Copyright (c) 2020, Sarthak Mittal
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* * Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
* * Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
* * Neither the name of the Willow Garage, Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from
17+
* this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
* POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
// Copyright (c) 2019 Intel Corporation
33+
// Copyright (c) 2020 Sarthak Mittal
34+
//
35+
// Licensed under the Apache License, Version 2.0 (the "License");
36+
// you may not use this file except in compliance with the License.
37+
// You may obtain a copy of the License at
38+
//
39+
// http://www.apache.org/licenses/LICENSE-2.0
40+
//
41+
// Unless required by applicable law or agreed to in writing, software
42+
// distributed under the License is distributed on an "AS IS" BASIS,
43+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44+
// See the License for the specific language governing permissions and
45+
// limitations under the License.
46+
47+
#ifndef NAV2_RVIZ_PLUGINS__FLAT_WEIGHTED_ARROWS_ARRAY_HPP_
48+
#define NAV2_RVIZ_PLUGINS__FLAT_WEIGHTED_ARROWS_ARRAY_HPP_
49+
50+
#include <vector>
51+
52+
#include <OgreManualObject.h>
53+
#include <OgreMaterialManager.h>
54+
#include <OgreSceneNode.h>
55+
#include <OgreVector3.h>
56+
#include <OgreQuaternion.h>
57+
58+
#include "nav2_rviz_plugins/particle_cloud_display.hpp"
59+
60+
namespace nav2_rviz_plugins
61+
{
62+
63+
struct OgrePoseWithWeight;
64+
65+
class FlatWeightedArrowsArray
66+
{
67+
public:
68+
explicit FlatWeightedArrowsArray(Ogre::SceneManager * scene_manager_);
69+
~FlatWeightedArrowsArray();
70+
71+
void createAndAttachManualObject(Ogre::SceneNode * scene_node);
72+
void updateManualObject(
73+
Ogre::ColourValue color,
74+
float alpha,
75+
float min_length,
76+
float max_length,
77+
const std::vector<nav2_rviz_plugins::OgrePoseWithWeight> & poses);
78+
void clear();
79+
80+
private:
81+
void setManualObjectMaterial();
82+
void setManualObjectVertices(
83+
const Ogre::ColourValue & color,
84+
float min_length,
85+
float max_length,
86+
const std::vector<nav2_rviz_plugins::OgrePoseWithWeight> & poses);
87+
88+
Ogre::SceneManager * scene_manager_;
89+
Ogre::ManualObject * manual_object_;
90+
Ogre::MaterialPtr material_;
91+
};
92+
93+
} // namespace nav2_rviz_plugins
94+
95+
#endif // NAV2_RVIZ_PLUGINS__FLAT_WEIGHTED_ARROWS_ARRAY_HPP_

0 commit comments

Comments
 (0)