RSS: Cleanup
- Only calculate for new frames - Return calculation result
This commit is contained in:
parent
e70480c664
commit
d20e6ef7ca
|
@ -296,6 +296,7 @@ bool RssCheck::CheckObjects(carla::client::Timestamp const ×tamp,
|
||||||
::ad::rss::situation::SituationSnapshot &output_situation_snapshot,
|
::ad::rss::situation::SituationSnapshot &output_situation_snapshot,
|
||||||
::ad::rss::world::WorldModel &output_world_model,
|
::ad::rss::world::WorldModel &output_world_model,
|
||||||
EgoDynamicsOnRoute &output_rss_ego_dynamics_on_route) {
|
EgoDynamicsOnRoute &output_rss_ego_dynamics_on_route) {
|
||||||
|
bool result = false;
|
||||||
try {
|
try {
|
||||||
double const time_since_epoch_check_start_ms =
|
double const time_since_epoch_check_start_ms =
|
||||||
std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
|
std::chrono::duration<double, std::milli>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||||
|
@ -367,7 +368,7 @@ bool RssCheck::CheckObjects(carla::client::Timestamp const ×tamp,
|
||||||
<< " after create world model " << std::endl;
|
<< " after create world model " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PerformCheck(_carla_rss_state);
|
result = PerformCheck(_carla_rss_state);
|
||||||
|
|
||||||
#if DEBUG_TIMING
|
#if DEBUG_TIMING
|
||||||
t_end = std::chrono::high_resolution_clock::now();
|
t_end = std::chrono::high_resolution_clock::now();
|
||||||
|
@ -403,12 +404,10 @@ bool RssCheck::CheckObjects(carla::client::Timestamp const ×tamp,
|
||||||
std::cout << "-> EC " << std::chrono::duration<double, std::milli>(t_end - t_start).count() << " end check objects"
|
std::cout << "-> EC " << std::chrono::duration<double, std::milli>(t_end - t_start).count() << " end check objects"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
_logger->error("Exception -> Check failed");
|
_logger->error("Exception -> Check failed");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
::ad::map::match::Object RssCheck::GetMatchObject(carla::SharedPtr<carla::client::Actor> const &actor,
|
::ad::map::match::Object RssCheck::GetMatchObject(carla::SharedPtr<carla::client::Actor> const &actor,
|
||||||
|
@ -924,21 +923,18 @@ void RssCheck::CreateWorldModel(carla::client::Timestamp const ×tamp, carla
|
||||||
carla_rss_state.world_model = scene_creation.getWorldModel();
|
carla_rss_state.world_model = scene_creation.getWorldModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RssCheck::PerformCheck(CarlaRssState &carla_rss_state) const {
|
bool RssCheck::PerformCheck(CarlaRssState &carla_rss_state) const {
|
||||||
bool result = carla_rss_state.rss_check.calculateProperResponse(
|
bool result = carla_rss_state.rss_check.calculateProperResponse(
|
||||||
carla_rss_state.world_model, carla_rss_state.situation_snapshot, carla_rss_state.rss_state_snapshot,
|
carla_rss_state.world_model, carla_rss_state.situation_snapshot, carla_rss_state.rss_state_snapshot,
|
||||||
carla_rss_state.proper_response);
|
carla_rss_state.proper_response);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
_logger->warn("calculateProperResponse failed!");
|
_logger->warn("calculateProperResponse failed!");
|
||||||
carla_rss_state.proper_response.lateralResponseRight = ::ad::rss::state::LateralResponse::None;
|
|
||||||
carla_rss_state.proper_response.lateralResponseLeft = ::ad::rss::state::LateralResponse::None;
|
|
||||||
carla_rss_state.proper_response.longitudinalResponse = ::ad::rss::state::LongitudinalResponse::None;
|
|
||||||
}
|
}
|
||||||
|
else if (!carla_rss_state.proper_response.isSafe) {
|
||||||
if (!carla_rss_state.proper_response.isSafe) {
|
|
||||||
_logger->info("Unsafe route: {}", carla_rss_state.proper_response);
|
_logger->info("Unsafe route: {}", carla_rss_state.proper_response);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RssCheck::AnalyseCheckResults(CarlaRssState &carla_rss_state) const {
|
void RssCheck::AnalyseCheckResults(CarlaRssState &carla_rss_state) const {
|
||||||
|
|
|
@ -329,7 +329,7 @@ private:
|
||||||
carla::client::Vehicle const &carla_ego_vehicle, CarlaRssState &carla_rss_state) const;
|
carla::client::Vehicle const &carla_ego_vehicle, CarlaRssState &carla_rss_state) const;
|
||||||
|
|
||||||
/// @brief Perform the actual RSS check
|
/// @brief Perform the actual RSS check
|
||||||
void PerformCheck(CarlaRssState &carla_rss_state) const;
|
bool PerformCheck(CarlaRssState &carla_rss_state) const;
|
||||||
|
|
||||||
/// @brief Analyse the RSS check results
|
/// @brief Analyse the RSS check results
|
||||||
void AnalyseCheckResults(CarlaRssState &carla_rss_state) const;
|
void AnalyseCheckResults(CarlaRssState &carla_rss_state) const;
|
||||||
|
|
|
@ -268,6 +268,15 @@ SharedPtr<sensor::SensorData> RssSensor::TickRssSensor(const Timestamp ×tam
|
||||||
carla::rss::EgoDynamicsOnRoute ego_dynamics_on_route;
|
carla::rss::EgoDynamicsOnRoute ego_dynamics_on_route;
|
||||||
if (_processing_lock.try_lock()) {
|
if (_processing_lock.try_lock()) {
|
||||||
spdlog::debug("RssSensor tick: T={}", timestamp.frame);
|
spdlog::debug("RssSensor tick: T={}", timestamp.frame);
|
||||||
|
|
||||||
|
if ((timestamp.frame < _last_processed_frame) && ((_last_processed_frame - timestamp.frame) < 0xffffffffu))
|
||||||
|
{
|
||||||
|
_processing_lock.unlock();
|
||||||
|
spdlog::warn("RssSensor tick dropped: T={}", timestamp.frame);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
_last_processed_frame = timestamp.frame;
|
||||||
|
|
||||||
carla::client::World world = GetWorld();
|
carla::client::World world = GetWorld();
|
||||||
SharedPtr<carla::client::ActorList> actors = world.GetActors();
|
SharedPtr<carla::client::ActorList> actors = world.GetActors();
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,9 @@ private:
|
||||||
|
|
||||||
/// reqired to store DropRoute() requests until next sensor tick
|
/// reqired to store DropRoute() requests until next sensor tick
|
||||||
bool _drop_route;
|
bool _drop_route;
|
||||||
|
|
||||||
|
/// last processed frame
|
||||||
|
std::size_t _last_processed_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
|
Loading…
Reference in New Issue