57 auto vehicle = boost::dynamic_pointer_cast<carla::client::Vehicle>(
GetParent());
58 if (vehicle ==
nullptr) {
64 float max_steer_angle_deg = 0.f;
65 for (
auto const &wheel : vehicle->GetPhysicsControl().GetWheels()) {
66 max_steer_angle_deg = std::max(max_steer_angle_deg, wheel.max_steer_angle);
68 auto max_steering_angle = max_steer_angle_deg *
static_cast<float>(M_PI) / 180.0f;
72 std::string
const open_drive_content = map->GetOpenDrive();
74 auto mapInitializationResult = ::ad::map::access::initFromOpenDriveContent(
75 open_drive_content, 0.2, ::ad::map::intersection::IntersectionType::TrafficLight,
76 ::ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN);
78 if (!mapInitializationResult) {
86 _rss_check = std::make_shared<::carla::rss::RssCheck>(max_steering_angle);
92 auto self = boost::static_pointer_cast<RssSensor>(shared_from_this());
97 [ cb = std::move(callback), weak_self =
WeakPtr<RssSensor>(self) ](
const auto &snapshot) {
98 auto self = weak_self.lock();
99 if (self !=
nullptr) {
100 self->TickRssSensor(snapshot.GetTimestamp(), cb);
330 double const time_since_epoch_check_start_ms =
331 std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
339 ::ad::rss::state::ProperResponse response;
340 ::ad::rss::state::RssStateSnapshot rss_state_snapshot;
341 ::ad::rss::situation::SituationSnapshot situation_snapshot;
342 ::ad::rss::world::WorldModel world_model;
344 auto const result =
_rss_check->CheckObjects(timestamp, actors,
GetParent(), response, rss_state_snapshot,
345 situation_snapshot, world_model, ego_dynamics_on_route);
347 double const time_since_epoch_check_end_ms =
348 std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
349 auto const delta_time_ms = time_since_epoch_check_end_ms - time_since_epoch_check_start_ms;
350 _rss_check->GetLogger()->debug(
"RssSensor[{}] response: S:{}->E:{} DeltaT:{}", timestamp.
frame,
351 time_since_epoch_check_start_ms, time_since_epoch_check_end_ms,
359 agv_time += run_time;
362 _rss_check->GetLogger()->info(
"RssSensor[{}] runtime {} avg {}", timestamp.
frame, delta_time_ms, agv_time);
366 response, rss_state_snapshot, situation_snapshot, world_model,
367 ego_dynamics_on_route));
368 }
catch (
const std::exception &e) {
369 _rss_check->GetLogger()->error(
"RssSensor[{}] tick exception", timestamp.
frame);
372 _rss_check->GetLogger()->error(
"RssSensor[{}] tick exception", timestamp.
frame);