24 #include "modules/drivers/proto/sensor_image.pb.h" 25 #include "modules/map/proto/map_geometry.pb.h" 26 #include "modules/map/proto/map_signal.pb.h" 31 #include "modules/perception/onboard/proto/trafficlights_perception_component.pb.h" 33 #include "modules/perception/proto/perception_obstacle.pb.h" 34 #include "modules/perception/proto/traffic_light_detection.pb.h" 38 #include "modules/v2x/proto/v2x_traffic_light.pb.h" 41 namespace perception {
58 int InitAlgorithmPlugin();
59 int InitCameraListeners();
60 int InitCameraFrame();
62 int InitV2XListener();
64 void OnReceiveImage(
const std::shared_ptr<apollo::drivers::Image> image,
65 const std::string& camera_name);
68 const std::shared_ptr<apollo::v2x::IntersectionTrafficLightData> v2x_msg);
71 std::vector<apollo::hdmap::Signal>* signals);
73 bool VerifyLightsProjection(
const double& ts,
75 const std::string& camera_name,
78 bool UpdateCameraSelection(
double timestamp,
82 bool CheckCameraImageStatus(
double timestamp,
double interval,
83 const std::string& camera_name);
87 bool GetPoseFromTF(
const double timestamp,
const std::string& frame_id,
88 const std::string& child_frame_id,
92 bool TransformOutputMessage(
94 std::shared_ptr<apollo::perception::TrafficLightDetection>* out_msg);
96 bool TransformDebugMessage(
98 std::shared_ptr<apollo::perception::TrafficLightDetection>* out_msg);
99 void SendSimulationMsg();
100 void GenerateTrafficLights(
101 const std::vector<apollo::hdmap::Signal>& signals,
102 std::vector<base::TrafficLightPtr>* traffic_lights);
104 apollo::perception::TrafficLightBox* box);
108 const std::vector<base::TrafficLightPtr>& lights)
const;
114 std::shared_ptr<camera::BaseTLPreprocessor> preprocessor_;
118 std::string tl_preprocessor_name_;
120 std::string tf2_frame_id_;
121 std::string tf2_child_frame_id_;
122 double tf2_timeout_second_ = 0.01;
126 std::vector<std::string> camera_names_;
127 std::vector<std::string> input_camera_channel_names_;
129 std::map<std::string, std::shared_ptr<TransformWrapper>>
130 camera2world_trans_wrapper_map_;
132 std::map<std::string, int> image_border_sizes_;
134 std::vector<std::shared_ptr<cyber::Node>> camera_listener_nodes_;
136 double last_sub_tf_ts_ = 0.0;
138 std::map<std::string, double> last_sub_camera_image_ts_;
140 double query_tf_interval_seconds_ = 0.0;
141 double image_timestamp_offset_ = 0.0;
142 int max_process_image_fps_ = 10;
143 double proc_interval_seconds_ = 0.0;
144 double check_image_status_interval_thresh_ = 1.0;
146 double last_query_tf_ts_ = 0.0;
147 double last_proc_image_ts_ = 0.0;
149 double image_sys_ts_diff_threshold_ = 0.5;
152 double last_signals_ts_ = -1.0;
153 double valid_hdmap_interval_ = 1.5;
154 double forward_distance_to_query_signals = 150.0;
155 std::vector<apollo::hdmap::Signal> last_signals_;
158 int image_width_ = 1920;
159 int image_height_ = 1080;
160 int image_channel_num_ = 3;
161 int image_data_size_ = -1;
162 int frame_index_ = 0;
163 int default_image_border_size_ = 100;
166 bool enable_undistortion_ =
false;
170 std::map<std::string, std::shared_ptr<camera::DataProvider>>
174 std::shared_ptr<camera::CameraFrame> frame_;
179 std::unique_ptr<camera::TrafficLightCameraPerception> traffic_light_pipeline_;
180 ::google::protobuf::RepeatedPtrField<apollo::hdmap::Curve> stoplines_;
183 std::string simulation_channel_name_;
184 std::string traffic_light_output_channel_name_;
198 std::string v2x_trafficlights_input_channel_name_;
199 double v2x_sync_interval_seconds_ = 0.1;
200 int max_v2x_msg_buff_size_ = 50;
201 boost::circular_buffer<apollo::v2x::IntersectionTrafficLightData>
Definition: camera_frame.h:33
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: base_camera_perception.h:28
Eigen::Matrix4d Matrix4d
Definition: base_map_fwd.h:32
TrafficLightsPerceptionComponent()=default
Definition: base_tl_preprocessor.h:38
Definition: trafficlights_perception_component.h:44
Definition: data_provider.h:32
Definition: base_tl_preprocessor.h:32
The gflags used by v2x proxy module.
Definition: base_camera_perception.h:34
TrafficLightsPerceptionComponent & operator=(const TrafficLightsPerceptionComponent &)=delete
The Component can process up to four channels of messages. The message type is specified when the com...
Definition: component.h:58
TLColor
Definition: traffic_light.h:28
CYBER_REGISTER_COMPONENT(CameraObstacleDetectionComponent)
~TrafficLightsPerceptionComponent()=default