Commit bd81d4c 1 parent a1762eb commit bd81d4c Copy full SHA for bd81d4c
File tree 1 file changed +7
-5
lines changed
vehicle/accel_brake_map_calibrator/accel_brake_map_calibrator/src
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -703,17 +703,19 @@ void AccelBrakeMapCalibrator::takeConsistencyOfAccelMap()
703
703
{
704
704
const double bit = std::pow (1e-01 , precision_);
705
705
for (std::size_t ped_idx = 0 ; ped_idx < update_accel_map_value_.size () - 1 ; ped_idx++) {
706
- for (std::size_t vel_idx = 0 ; vel_idx < update_accel_map_value_.at (0 ).size () - 1 ; vel_idx++) {
706
+ for (std::size_t vel_idx = update_accel_map_value_.at (0 ).size () - 1 ;; vel_idx--) {
707
+ if (vel_idx == 0 ) break ;
708
+
707
709
const double current_acc = update_accel_map_value_.at (ped_idx).at (vel_idx);
708
710
const double next_ped_acc = update_accel_map_value_.at (ped_idx + 1 ).at (vel_idx);
709
- const double next_vel_acc = update_accel_map_value_.at (ped_idx).at (vel_idx + 1 );
711
+ const double prev_vel_acc = update_accel_map_value_.at (ped_idx).at (vel_idx - 1 );
710
712
711
- if (current_acc <= next_vel_acc ) {
713
+ if (current_acc + bit >= prev_vel_acc ) {
712
714
// the higher the velocity, the lower the acceleration
713
- update_accel_map_value_.at (ped_idx).at (vel_idx + 1 ) = current_acc - bit;
715
+ update_accel_map_value_.at (ped_idx).at (vel_idx - 1 ) = current_acc + bit;
714
716
}
715
717
716
- if (current_acc >= next_ped_acc) {
718
+ if (current_acc + bit >= next_ped_acc) {
717
719
// the higher the accel pedal, the higher the acceleration
718
720
update_accel_map_value_.at (ped_idx + 1 ).at (vel_idx) = current_acc + bit;
719
721
}
You can’t perform that action at this time.
0 commit comments