Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
  • Loading branch information
yuki-takagi-66 committed Jun 24, 2024
1 parent 1b7078c commit 0ef8a26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class PLANNING_SIMULATOR_PUBLIC SimplePlanningSimulator : public rclcpp::Node
DELAY_STEER_VEL = 5,
DELAY_STEER_MAP_ACC_GEARED = 6,
LEARNED_STEER_VEL = 7,
DELAY_STEER_ACC_GEARED_WO_FALLGUARD
DELAY_STEER_ACC_GEARED_WO_FALL_GUARD
} vehicle_model_type_; //!< @brief vehicle model type to decide the model dynamics
std::shared_ptr<SimModelInterface> vehicle_model_ptr_; //!< @brief vehicle model pointer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void SimplePlanningSimulator::initialize_vehicle_model()
acc_time_delay, acc_time_constant, steer_time_delay, steer_time_constant, steer_dead_band,
steer_bias, debug_acc_scaling_factor, debug_steer_scaling_factor);
} else if (vehicle_model_type_str == "DELAY_STEER_ACC_GEARED_WO_FALL_GUARD") {
vehicle_model_type_ = VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALLGUARD;
vehicle_model_type_ = VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALL_GUARD;
vehicle_model_ptr_ = std::make_shared<SimModelDelaySteerAccGearedWoFallGuard>(
vel_lim, steer_lim, vel_rate_lim, steer_rate_lim, wheelbase, timer_sampling_time_ms_ / 1000.0,
acc_time_delay, acc_time_constant, steer_time_delay, steer_time_constant, steer_dead_band,
Expand Down Expand Up @@ -510,7 +510,7 @@ void SimplePlanningSimulator::set_input(const Control & cmd, const double acc_by
vehicle_model_type_ == VehicleModelType::DELAY_STEER_MAP_ACC_GEARED) {
input << combined_acc, steer;
} else if ( // NOLINT
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALLGUARD) {
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALL_GUARD) {
input << acc_by_cmd, gear, acc_by_slope, steer;

Check warning on line 514 in simulator/simple_planning_simulator/src/simple_planning_simulator/simple_planning_simulator_core.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

SimplePlanningSimulator::set_input increases in cyclomatic complexity from 12 to 13, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
}
vehicle_model_ptr_->setInput(input);
Expand Down Expand Up @@ -611,7 +611,7 @@ void SimplePlanningSimulator::set_initial_state(const Pose & pose, const Twist &
} else if ( // NOLINT
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC ||
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC_GEARED ||
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALLGUARD ||
vehicle_model_type_ == VehicleModelType::DELAY_STEER_ACC_GEARED_WO_FALL_GUARD ||

Check warning on line 614 in simulator/simple_planning_simulator/src/simple_planning_simulator/simple_planning_simulator_core.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

SimplePlanningSimulator::set_initial_state increases in cyclomatic complexity from 9 to 10, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 614 in simulator/simple_planning_simulator/src/simple_planning_simulator/simple_planning_simulator_core.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Conditional

SimplePlanningSimulator::set_initial_state increases from 1 complex conditionals with 2 branches to 1 complex conditionals with 3 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
vehicle_model_type_ == VehicleModelType::DELAY_STEER_MAP_ACC_GEARED) {
state << x, y, yaw, vx, steer, accx;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ TEST_P(TestSimplePlanningSimulator, TestIdealSteerVel)
// clang-format off
const std::string VEHICLE_MODEL_LIST[] = { // NOLINT
"IDEAL_STEER_VEL", "IDEAL_STEER_ACC", "IDEAL_STEER_ACC_GEARED",
"DELAY_STEER_VEL", "DELAY_STEER_ACC", "DELAY_STEER_ACC_GEARED",
"DELAY_STEER_VEL", "DELAY_STEER_ACC", "DELAY_STEER_ACC_GEARED", "DELAY_STEER_ACC_GEARED",
};
// clang-format on

Expand Down

0 comments on commit 0ef8a26

Please sign in to comment.