|
20 | 20 | #define MULTI_OBJECT_TRACKER__MULTI_OBJECT_TRACKER_CORE_HPP_
|
21 | 21 |
|
22 | 22 | #include "multi_object_tracker/data_association/data_association.hpp"
|
| 23 | +#include "multi_object_tracker/debugger.hpp" |
| 24 | +#include "multi_object_tracker/processor/processor.hpp" |
23 | 25 | #include "multi_object_tracker/tracker/model/tracker_base.hpp"
|
24 | 26 |
|
25 | 27 | #include <rclcpp/rclcpp.hpp>
|
26 |
| -#include <tier4_autoware_utils/ros/debug_publisher.hpp> |
27 |
| -#include <tier4_autoware_utils/system/stop_watch.hpp> |
28 | 28 |
|
29 | 29 | #include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
|
30 | 30 | #include <autoware_auto_perception_msgs/msg/tracked_objects.hpp>
|
|
40 | 40 | #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
|
41 | 41 | #endif
|
42 | 42 |
|
43 |
| -#include <diagnostic_updater/diagnostic_updater.hpp> |
44 |
| -#include <diagnostic_updater/publisher.hpp> |
45 |
| - |
46 | 43 | #include <tf2_ros/buffer.h>
|
47 | 44 | #include <tf2_ros/transform_listener.h>
|
48 | 45 |
|
49 | 46 | #include <list>
|
50 | 47 | #include <map>
|
51 | 48 | #include <memory>
|
52 | 49 | #include <string>
|
| 50 | +#include <unordered_map> |
53 | 51 | #include <vector>
|
54 | 52 |
|
55 |
| -/** |
56 |
| - * @brief Debugger class for multi object tracker |
57 |
| - * @details This class is used to publish debug information of multi object tracker |
58 |
| - */ |
59 |
| -class TrackerDebugger |
60 |
| -{ |
61 |
| -public: |
62 |
| - explicit TrackerDebugger(rclcpp::Node & node); |
63 |
| - void publishProcessingTime(); |
64 |
| - void publishTentativeObjects( |
65 |
| - const autoware_auto_perception_msgs::msg::TrackedObjects & tentative_objects) const; |
66 |
| - void startStopWatch(); |
67 |
| - void startMeasurementTime(const rclcpp::Time & measurement_header_stamp); |
68 |
| - void setupDiagnostics(); |
69 |
| - void checkDelay(diagnostic_updater::DiagnosticStatusWrapper & stat); |
70 |
| - struct DEBUG_SETTINGS |
71 |
| - { |
72 |
| - bool publish_processing_time; |
73 |
| - bool publish_tentative_objects; |
74 |
| - double diagnostics_warn_delay; |
75 |
| - double diagnostics_error_delay; |
76 |
| - } debug_settings_; |
77 |
| - double elapsed_time_from_sensor_input_ = 0.0; |
78 |
| - diagnostic_updater::Updater diagnostic_updater_; |
79 |
| - |
80 |
| -private: |
81 |
| - void loadParameters(); |
82 |
| - rclcpp::Node & node_; |
83 |
| - rclcpp::Publisher<autoware_auto_perception_msgs::msg::TrackedObjects>::SharedPtr |
84 |
| - debug_tentative_objects_pub_; |
85 |
| - std::unique_ptr<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_; |
86 |
| - std::unique_ptr<tier4_autoware_utils::DebugPublisher> processing_time_publisher_; |
87 |
| - rclcpp::Time last_input_stamp_; |
88 |
| -}; |
89 |
| - |
90 | 53 | class MultiObjectTracker : public rclcpp::Node
|
91 | 54 | {
|
92 | 55 | public:
|
93 | 56 | explicit MultiObjectTracker(const rclcpp::NodeOptions & node_options);
|
94 | 57 |
|
95 | 58 | private:
|
| 59 | + // ROS interface |
96 | 60 | rclcpp::Publisher<autoware_auto_perception_msgs::msg::TrackedObjects>::SharedPtr
|
97 | 61 | tracked_objects_pub_;
|
98 | 62 | rclcpp::Subscription<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr
|
99 | 63 | detected_object_sub_;
|
100 |
| - rclcpp::TimerBase::SharedPtr publish_timer_; // publish timer |
101 |
| - |
102 |
| - // debugger class |
103 |
| - std::unique_ptr<TrackerDebugger> debugger_; |
104 |
| - |
105 | 64 | tf2_ros::Buffer tf_buffer_;
|
106 | 65 | tf2_ros::TransformListener tf_listener_;
|
107 | 66 |
|
108 |
| - std::map<std::uint8_t, std::string> tracker_map_; |
| 67 | + // debugger |
| 68 | + std::unique_ptr<TrackerDebugger> debugger_; |
| 69 | + // std::unique_ptr<tier4_autoware_utils::PublishedTimePublisher> published_time_publisher_; |
109 | 70 |
|
110 |
| - void onMeasurement( |
111 |
| - const autoware_auto_perception_msgs::msg::DetectedObjects::ConstSharedPtr input_objects_msg); |
112 |
| - void onTimer(); |
| 71 | + // publish timer |
| 72 | + rclcpp::TimerBase::SharedPtr publish_timer_; |
| 73 | + rclcpp::Time last_published_time_; |
| 74 | + double publisher_period_; |
113 | 75 |
|
| 76 | + // internal states |
114 | 77 | std::string world_frame_id_; // tracking frame
|
115 |
| - std::list<std::shared_ptr<Tracker>> list_tracker_; |
116 | 78 | std::unique_ptr<DataAssociation> data_association_;
|
| 79 | + std::unique_ptr<TrackerProcessor> processor_; |
117 | 80 |
|
118 |
| - void checkTrackerLifeCycle( |
119 |
| - std::list<std::shared_ptr<Tracker>> & list_tracker, const rclcpp::Time & time, |
120 |
| - const geometry_msgs::msg::Transform & self_transform); |
121 |
| - void sanitizeTracker( |
122 |
| - std::list<std::shared_ptr<Tracker>> & list_tracker, const rclcpp::Time & time); |
123 |
| - std::shared_ptr<Tracker> createNewTracker( |
124 |
| - const autoware_auto_perception_msgs::msg::DetectedObject & object, const rclcpp::Time & time, |
125 |
| - const geometry_msgs::msg::Transform & self_transform) const; |
| 81 | + // callback functions |
| 82 | + void onMeasurement( |
| 83 | + const autoware_auto_perception_msgs::msg::DetectedObjects::ConstSharedPtr input_objects_msg); |
| 84 | + void onTimer(); |
126 | 85 |
|
127 |
| - void publish(const rclcpp::Time & time); |
| 86 | + // publish processes |
| 87 | + void checkAndPublish(const rclcpp::Time & time); |
| 88 | + void publish(const rclcpp::Time & time) const; |
128 | 89 | inline bool shouldTrackerPublish(const std::shared_ptr<const Tracker> tracker) const;
|
129 | 90 | };
|
130 | 91 |
|
|
0 commit comments