autowarefoundation / autoware.universe

https://autowarefoundation.github.io/autoware.universe/
Apache License 2.0
1.03k stars 656 forks source link

mpc_lateral_controller test fails on CI #3977

Closed TakaHoribe closed 1 year ago

TakaHoribe commented 1 year ago

Checklist

Description

The test in mpc_lateral_controller sometimes fails with the following error.

An example of the failure CI is here.

In the failure case, the MPC calculates the "Left Turn" command when following the "Right Turn" trajectory. It does not happen all time.

1: Test command: /usr/bin/python3.10 "-u" "/opt/ros/humble/share/ament_cmake_ros/cmake/run_test_isolated.py" "/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_results/mpc_lateral_controller/test_lateral_controller.gtest.xml" "--package-name" "mpc_lateral_controller" "--output-file" "/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/ament_cmake_gtest/test_lateral_controller.txt" "--command" "/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_lateral_controller" "--gtest_output=xml:/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_results/mpc_lateral_controller/test_lateral_controller.gtest.xml"
1: Test timeout computed to be: 60
1: Running with ROS_DOMAIN_ID 1
1: -- run_test.py: invoking following command in '/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller':
1:  - /__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_lateral_controller --gtest_output=xml:/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_results/mpc_lateral_controller/test_lateral_controller.gtest.xml
1: Running main() from /opt/ros/humble/src/gtest_vendor/src/gtest_main.cc
1: [==========] Running 13 tests from 3 test suites.
1: [----------] Global test environment set-up.
1: [----------] 9 tests from MPCTest
1: [ RUN      ] MPCTest.InitializeAndCalculate
1: [       OK ] MPCTest.InitializeAndCalculate (2 ms)
1: [ RUN      ] MPCTest.InitializeAndCalculateRightTurn
1: /__w/autoware.universe/autoware.universe/control/mpc_lateral_controller/test/test_mpc.cpp:232: Failure
1: Expected: (ctrl_cmd.steering_tire_angle) < (0.0f), actual: 0.0179061 vs 0
1: /__w/autoware.universe/autoware.universe/control/mpc_lateral_controller/test/test_mpc.cpp:233: Failure
1: Expected: (ctrl_cmd.steering_tire_rotation_rate) < (0.0f), actual: 2.11474 vs 0
1: [  FAILED  ] MPCTest.InitializeAndCalculateRightTurn (1 ms)
1: [ RUN      ] MPCTest.OsqpCalculate
1: [WARN] [1686631682.530086297] [mpc_test_logger]: osqp status_polish = -1 (unsuccessful)
1: [WARN] [1686631682.530119298] [mpc_logger]: qp solver error
1: [WARN] [1686631682.530125898] [mpc_logger]: optimization failed. Stop MPC.
1: [       OK ] MPCTest.OsqpCalculate (2 ms)
1: [ RUN      ] MPCTest.OsqpCalculateRightTurn
1: /__w/autoware.universe/autoware.universe/control/mpc_lateral_controller/test/test_mpc.cpp:283: Failure
1: Expected: (ctrl_cmd.steering_tire_angle) < (0.0f), actual: 0.00443345 vs 0
1: /__w/autoware.universe/autoware.universe/control/mpc_lateral_controller/test/test_mpc.cpp:284: Failure
1: Expected: (ctrl_cmd.steering_tire_rotation_rate) < (0.0f), actual: 0.523598 vs 0
1: [  FAILED  ] MPCTest.OsqpCalculateRightTurn (2 ms)
1: [ RUN      ] MPCTest.KinematicsNoDelayCalculate
1: [       OK ] MPCTest.KinematicsNoDelayCalculate (1 ms)
1: [ RUN      ] MPCTest.KinematicsNoDelayCalculateRightTurn
1: [       OK ] MPCTest.KinematicsNoDelayCalculateRightTurn (1 ms)
1: [ RUN      ] MPCTest.DynamicCalculate
1: [       OK ] MPCTest.DynamicCalculate (1 ms)
1: [ RUN      ] MPCTest.MultiSolveWithBuffer
1: [       OK ] MPCTest.MultiSolveWithBuffer (4 ms)
1: [ RUN      ] MPCTest.FailureCases
1: [WARN] [1686631682.539723934] [mpc_logger]: Too large position error: 8.485281m > 5.000000m
1: [WARN] [1686631682.539736335] [mpc_logger]: fail to get MPC Data. Stop MPC.
1: [       OK ] MPCTest.FailureCases (0 ms)
1: [----------] 9 tests from MPCTest (14 ms total)
1: 
1: [----------] 1 test from TestMPC
1: [ RUN      ] TestMPC.CalcStopDistance
1: [       OK ] TestMPC.CalcStopDistance (0 ms)
1: [----------] 1 test from TestMPC (0 ms total)
1: 
1: [----------] 3 tests from TestLowpassFilter
1: [ RUN      ] TestLowpassFilter.MoveAverageFilter
1: [       OK ] TestLowpassFilter.MoveAverageFilter (0 ms)
1: [ RUN      ] TestLowpassFilter.Butterworth2dFilter
1: [       OK ] TestLowpassFilter.Butterworth2dFilter (0 ms)
1: [ RUN      ] TestLowpassFilter.Butterworth2dFilterCoeffs
1: [       OK ] TestLowpassFilter.Butterworth2dFilterCoeffs (0 ms)
1: [----------] 3 tests from TestLowpassFilter (0 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 13 tests from 3 test suites ran. (14 ms total)
1: [  PASSED  ] 11 tests.
1: [  FAILED  ] 2 tests, listed below:
1: [  FAILED  ] MPCTest.InitializeAndCalculateRightTurn
1: [  FAILED  ] MPCTest.OsqpCalculateRightTurn
1: 
1:  2 FAILED TESTS
1: -- run_test.py: return code 1
1: -- run_test.py: inject classname prefix into gtest result file '/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_results/mpc_lateral_controller/test_lateral_controller.gtest.xml'
1: -- run_test.py: verify result file '/__w/autoware.universe/autoware.universe/build/mpc_lateral_controller/test_results/mpc_lateral_controller/test_lateral_controller.gtest.xml'
1/5 Test #1: test_lateral_controller ..........***Failed    0.12 sec
test 2

Expected behavior

All test in mpc_lateral_controller passes.

Actual behavior

Test fails.

Steps to reproduce

  1. Run CI
  2. Sometimes the CI fails

(Failure does not occur in my local environment)

Versions

autoware.universe hash in main is 4cdfb13ce3af3cff9e7d3589f7d66d3c7ee9786b

Possible causes

No response

Additional context

No response

TakaHoribe commented 1 year ago

Since this PR is merged, the CI failure has not occurred. https://github.com/autowarefoundation/autoware.universe/actions/workflows/build-and-test.yaml

I'll close this issue.