Henrik/velocity/merge#697
Conversation
for more information, see https://pre-commit.ci
Q3rkses
left a comment
There was a problem hiding this comment.
Dont upload LOS guidance for your PR review.
There was a problem hiding this comment.
remove anbits files so i can focus on your review
|
Rerequest review when only files you want me to review are in the PR |
Q3rkses
left a comment
There was a problem hiding this comment.
Good start, once implemented all changes ask for re-review
| dampening_matrix_low: [23.0,0.0,0.0,0.0,0.0,0.0, 0.0,46.0,0.0,0.0,0.0,0.0, 0.0,0.0,46.0,0.0,0.0,0.0, 0.0,0.0,0.0,46.0,0.0,0.0, 0.0,0.0,0.0,0.0,46.0,0.0, 0.0,0.0,0.0,0.0,0.0,46.0] | ||
| dampening_matrix_high: [1.0,0.0,0.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0,0.0,0.0, 0.0,0.0,1.0,0.0,0.0,0.0, 0.0,0.0,0.0,1.0,0.0,0.0, 0.0,0.0,0.0,0.0,1.0,0.0, 0.0,0.0,0.0,0.0,0.0,1.0] |
There was a problem hiding this comment.
why are these alone under ros params and not under some informative header or in drone.yaml in the auv_setup if they are specific to a drone
| dampening_matrix_low: [23.0,0.0,0.0,0.0,0.0,0.0, 0.0,46.0,0.0,0.0,0.0,0.0, 0.0,0.0,46.0,0.0,0.0,0.0, 0.0,0.0,0.0,46.0,0.0,0.0, 0.0,0.0,0.0,0.0,46.0,0.0, 0.0,0.0,0.0,0.0,0.0,46.0] | ||
| dampening_matrix_high: [1.0,0.0,0.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0,0.0,0.0, 0.0,0.0,1.0,0.0,0.0,0.0, 0.0,0.0,0.0,1.0,0.0,0.0, 0.0,0.0,0.0,0.0,1.0,0.0, 0.0,0.0,0.0,0.0,0.0,1.0] |
| class LQRController { | ||
| public: | ||
| LQRController(); | ||
| bool set_matrices(std::vector<double> Q_, | ||
| std::vector<double> R_, | ||
| std::vector<double> inertia_matrix, | ||
| double max_force, | ||
| std::vector<double> D_low); | ||
| void reset_controller(int nr = 0); | ||
| bool calculate_thrust(State states, Guidance_data guidance_values); | ||
| bool set_interval(double interval); | ||
| Eigen::Vector<double, 3> get_thrust(); |
There was a problem hiding this comment.
It is important to document what your classes and functions do in HPP files. They are the entry points to your code.
follow a structured guideline for examples look at the hpp files in thrust_allocator_auv
Something like this https://cppscripts.com/cpp-docstrings, i dont really care about the doxygen part personally but i like the on hover description and, it being easy to read IO params
| class LQRController { | |
| public: | |
| LQRController(); | |
| bool set_matrices(std::vector<double> Q_, | |
| std::vector<double> R_, | |
| std::vector<double> inertia_matrix, | |
| double max_force, | |
| std::vector<double> D_low); | |
| void reset_controller(int nr = 0); | |
| bool calculate_thrust(State states, Guidance_data guidance_values); | |
| bool set_interval(double interval); | |
| Eigen::Vector<double, 3> get_thrust(); | |
| /** | |
| * @brief the LQRController class declares and groups all parameters the LQR controller will utilize and | |
| * exposes the calculate_thrust_method which will be used in the main loop to calculate the input u. | |
| */ | |
| class LQRController { | |
| public: | |
| LQRController(); | |
| /** | |
| * @brief set_matrices() will take all matrices necessary for the LQR controller to function and set | |
| * them as member variables of the class. | |
| * @param Q_ the matrix containing weights for the different states in the LQR objective function | |
| * @param R_ the matrix containing weights for the inputs, used in the LQR objective function | |
| . | |
| . | |
| . | |
| */ | |
| bool set_matrices(std::vector<double> Q_, | |
| std::vector<double> R_, | |
| std::vector<double> inertia_matrix, | |
| double max_force, | |
| std::vector<double> D_low); | |
| . | |
| . | |
| . |
you get the idea.
| | `inertia_matrix` | `double[]` | 36 | Row-major 6x6 rigid body inertia matrix | | ||
| | `dampening_matrix_low` | `double[]` | 36 | Row-major 6x6 hydrodynamic damping matrix at low speed | |
There was a problem hiding this comment.
give dimention, size is eh
| The system matrix `A` is re-linearized around the current state every control timestep. Guidance references in NED are converted to body-frame errors using the rotation matrix method before being passed to the controller — not by angle subtraction. | ||
|
|
||
| The gain `K` is computed by solving the continuous-time algebraic Riccati equation via `ct::optcon::LQR`. The control law is: |
There was a problem hiding this comment.
perhaps give me the DLQR equation here
| msg/_*.py | ||
| build_isolated/ | ||
| devel_isolated/ | ||
| *.cache/ |
| # Emacs | ||
| .#* | ||
|
|
||
| .cache |
There was a problem hiding this comment.
huh why did you rename this file and what is a .ignore
…ric controller type
Implemented a 3-DOF velocity controller, with a PID and LQR controller that can be set at launch.