Autoware.Auto
trajectory_display.hpp
Go to the documentation of this file.
1 // Copyright 2019 the Autoware Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 
17 #ifndef PLANNING__TRAJECTORY_DISPLAY_HPP_
18 #define PLANNING__TRAJECTORY_DISPLAY_HPP_
19 
20 #include <rviz_common/display.hpp>
21 #include <rviz_common/properties/color_property.hpp>
22 #include <rviz_common/properties/float_property.hpp>
23 #include <rviz_default_plugins/displays/marker/marker_common.hpp>
24 #include <rviz_default_plugins/displays/marker_array/marker_array_display.hpp>
25 #include <autoware_auto_msgs/msg/trajectory.hpp>
26 #include <visibility_control.hpp>
27 #include <common/types.hpp>
28 #include <memory>
29 
31 
32 namespace autoware
33 {
34 namespace rviz_plugins
35 {
36 
37 class AUTOWARE_RVIZ_PLUGINS_PUBLIC TrajectoryDisplay
38  : public rviz_common::RosTopicDisplay<autoware_auto_msgs::msg::Trajectory>
39 {
40  Q_OBJECT
41 
42 public:
44  void onInitialize() override;
45  void load(const rviz_common::Config & config) override;
46  void update(float32_t wall_dt, float32_t ros_dt) override;
47  void reset() override;
48 
49 private Q_SLOTS:
50  void updateProperty();
51 
52 private:
53  using MarkerCommon = rviz_default_plugins::displays::MarkerCommon;
54  using Marker = visualization_msgs::msg::Marker;
55  using Trajectory = autoware_auto_msgs::msg::Trajectory;
56  using TrajectoryPoint = autoware_auto_msgs::msg::TrajectoryPoint;
57 
58  // Convert boxes into markers, push them to the display queue
59  void processMessage(Trajectory::ConstSharedPtr msg) override;
60  // Convert trajectory message to a marker message
61  Marker::SharedPtr create_pose_marker(const TrajectoryPoint & point) const;
62  Marker::SharedPtr create_velocity_marker(const TrajectoryPoint & point) const;
63 
64  std::unique_ptr<MarkerCommon> m_marker_common;
65  Trajectory::ConstSharedPtr msg_cache{};
66  rviz_common::properties::ColorProperty * color_property_;
67  rviz_common::properties::FloatProperty * alpha_property_;
68  rviz_common::properties::FloatProperty * scale_property_;
69  rviz_common::properties::FloatProperty * text_alpha_property_;
70  rviz_common::properties::FloatProperty * text_scale_property_;
71 };
72 } // namespace rviz_plugins
73 } // namespace autoware
74 
75 #endif // PLANNING__TRAJECTORY_DISPLAY_HPP_
motion::motion_testing_nodes::TrajectoryPoint
autoware_auto_msgs::msg::TrajectoryPoint TrajectoryPoint
Definition: motion_testing_publisher.hpp:36
types.hpp
This file includes common type definition.
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::common::types::float32_t
float float32_t
Definition: types.hpp:36
autoware::rviz_plugins::TrajectoryDisplay
Definition: trajectory_display.hpp:37
motion::motion_common::Trajectory
autoware_auto_msgs::msg::Trajectory Trajectory
Definition: motion_common.hpp:37