diff --git a/simulator/simple_planning_simulator/include/simple_planning_simulator/utils/mechanical_controller.hpp b/simulator/simple_planning_simulator/include/simple_planning_simulator/utils/mechanical_controller.hpp index 6923305dce286..3456e61a76052 100644 --- a/simulator/simple_planning_simulator/include/simple_planning_simulator/utils/mechanical_controller.hpp +++ b/simulator/simple_planning_simulator/include/simple_planning_simulator/utils/mechanical_controller.hpp @@ -129,11 +129,11 @@ class SteeringDynamics private: SteeringDynamicsState state_; - double inertia_{0.0}; - double damping_{0.0}; - double stiffness_{0.0}; - double friction_{0.0}; - double dead_zone_threshold_{0.0}; + const double inertia_; + const double damping_; + const double stiffness_; + const double friction_; + const double dead_zone_threshold_; }; struct StepResult @@ -191,7 +191,7 @@ class MechanicalController DelayBuffer delay_buffer_; PIDController pid_; SteeringDynamics steering_dynamics_; - MechanicalParams params_; + const MechanicalParams params_; [[nodiscard]] StepResult run_one_step( const double input_angle, const double speed, const double prev_input_angle, const double dt, diff --git a/simulator/simple_planning_simulator/src/simple_planning_simulator/utils/mechanical_controller.cpp b/simulator/simple_planning_simulator/src/simple_planning_simulator/utils/mechanical_controller.cpp index 49188ae15215c..25b0935ef952b 100644 --- a/simulator/simple_planning_simulator/src/simple_planning_simulator/utils/mechanical_controller.cpp +++ b/simulator/simple_planning_simulator/src/simple_planning_simulator/utils/mechanical_controller.cpp @@ -223,6 +223,7 @@ double MechanicalController::update_runge_kutta( { const auto dynamics_state = steering_dynamics_.get_state(); + // NOTE: k1, k2, k3, k4 suffix denote the intermediate points of RK4 const auto k1 = run_one_step(input_angle, speed, prev_input_angle, dt, delay_buffer_, pid_, steering_dynamics_);