From 3fd6cde4f5cd295755bf2495a40f26bce38e18eb Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Tue, 24 Dec 2024 15:30:17 +0900 Subject: [PATCH] Cleanup `ControlModeCommand` service callback Signed-off-by: yamacir-kit --- external/concealer/src/autoware_universe.cpp | 27 +++++++++++-------- .../traffic_simulator/entity/ego_entity.hpp | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/external/concealer/src/autoware_universe.cpp b/external/concealer/src/autoware_universe.cpp index 7467290ce20..57490a28aae 100644 --- a/external/concealer/src/autoware_universe.cpp +++ b/external/concealer/src/autoware_universe.cpp @@ -46,17 +46,22 @@ AutowareUniverse::AutowareUniverse(bool simulate_localization) [this]( const ControlModeCommand::Request::SharedPtr request, ControlModeCommand::Response::SharedPtr response) { - if (request->mode == ControlModeCommand::Request::AUTONOMOUS) { - current_control_mode.store(ControlModeReport::AUTONOMOUS); - response->success = true; - } else if (request->mode == ControlModeCommand::Request::MANUAL) { - /* - NOTE: MANUAL request will come when a remote override is triggered. - But scenario_simulator_v2 don't support a remote override for now. - */ - response->success = false; - } else { - response->success = false; + switch (request->mode) { + case ControlModeCommand::Request::AUTONOMOUS: + current_control_mode.store(ControlModeReport::AUTONOMOUS); + response->success = true; + break; + case ControlModeCommand::Request::MANUAL: + /* + NOTE: MANUAL request will come when a remote override is + triggered. But scenario_simulator_v2 don't support a remote + override for now. + */ + response->success = false; + break; + default: + response->success = false; + break; } })), localization_update_timer( diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/ego_entity.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/ego_entity.hpp index cbb9f01861f..44f2e23601e 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/ego_entity.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/entity/ego_entity.hpp @@ -31,7 +31,7 @@ namespace traffic_simulator { namespace entity { -class EgoEntity : public VehicleEntity, public concealer::FieldOperatorApplication +class EgoEntity : public VehicleEntity, private concealer::FieldOperatorApplication { bool is_controlled_by_simulator_{false}; std::optional target_speed_;