Repository navigation
Conversation
Check _solve_riccati_equation against scipy.linalg.solve_discrete_are and _calculate_control_gain against the gain from the scipy solution, for the A and B the controller builds, within 1% (the iteration stops at a 0.01 step). Part of ShisatoYano#103
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #103. Closes #341.
What
New
test/test_lqr_controller.py, using the A and B thatLqrControllerbuilds itself (speed/time step: 5 m/s/0.1 s, 10 m/s/0.1 s, 2 m/s/0.05 s):_solve_riccati_equation(A, B)matchesscipy.linalg.solve_discrete_are(A, B, Q, R)with the controller'sWEIGHT_MAT_QandWEIGHT_MAT_R_calculate_control_gain(A, B)matchesK = (BᵀXB + R)⁻¹ BᵀXAfrom the scipy solutionTolerance: 1% of the largest entry. The loop stops once a step changes X by under
THRESHOLD = 0.01, which leaves X about 0.1 from the scipy solution (largest entries 160–350). The measured gap is under 0.08% for X and about 0.002 for K.How I checked it works
pytest test/test_lqr_controller.py: 9 passed.MAX_ITERATION = 1) makes the scipy-comparison tests fail, so they catch a wrong solution.. run_test_suites.sh: 212 passed.src/change.