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