Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implementation of a pid dp controller #499

Open
wants to merge 79 commits into
base: develop
Choose a base branch
from

Conversation

Talhanc
Copy link

@Talhanc Talhanc commented Nov 8, 2024

DP controller with quaternion representation used.
The controller is tuned and works in the simulator

Added in docstring for the functions in .hpp file
ROS2 functions are defined separate from the normal functions ( cough Christopher asked for this cough )

Source: Trust me bro

Talhanc and others added 30 commits September 27, 2024 13:38
* chore(pylint): add .pylintrc configuration file

* refactor: fix pylint warning W1510

* refactor: fix pylint warning C0116

* refactor: fix pylint warning C0411

* refactor: fix pylint warning R1731

* refactor: fix pylint warning R1705

* refactor: fix pylint warning W1514

* refactor: fix pylint warning C0200

* refactor: fix pylint warning W0611

* refactor: fix pylint warning W0702

* refactor: fix pylint warning C0121

* refactor: fix pylint warning W0107

* refactor: fix pylint warning R1714

* refactor: fix pylint warning C0201

* refactor: fix pylint warning C0303 and W0613

* refactor: fix pylint warning W0621

* refactor: fix pylint warning R0402

* refactor: fix pylint warning W0212

* chore(pylint): update rule adjustments and formatting

* style: format code with black

* style: format imports with isort

* ci: add isort and pylint to Python pipeline

* Committing black-format changes

* chore: add pyproject.toml for project configuration

* ci: update order of pipeline jobs

* ci: update pylint job and pylint rules

* ci: update which python versions pylint test

* ci: update python pipeline to only run on pull_request

* refactor: fix pylint warning C0103

* chore: update linting and project configuration rules in .pylintrc and pyproject.toml

* Rename files to snake_case

* ci: add pipeline for grammar in comments

* refactor: fix spelling mistakes in comments

* ci: update job codespell_fix to continue on error

* refactor: fix spelling mistakes in comments

* ci: update pipeline codespell to only have one job

* refactor: fix variable naming issues and adjust imports as per review

* Committing codespell fixes

* refactor: spelling correction

* ci: update CI file and job names for consistency

* ci: update CI file for more clarity

* chore: add codespell configuration and ignore list

* chore: add type hints and return types

* ci: add mypy.ini for type checking configuration

* ci: add mypy type checking workflow

* refactor: format code with black

* refactor: format all yaml files using prettier

* ci: add pipeline for yaml formatting using prettier

* ci: update yaml formatting pipeline to run on pull request

* refactor: remove deprecated typing

* refactor: fix import sorting

* ci: remove faulty ci pipelines and combine python pipelines into single file

* fix(security): replace subprocess call with safer alternative to remove shell=true

* feat: add pre-commit hooks for black, isort, and codespell

* ci: update python pipeline to use latest versions

* refactor: apply code formatting fixes via pre-commit hooks

* ci: split python ci/cd pipelines into multiple files

* ci: add ci pipeline for checking style clang-format

* refactor: remove unused config file for clang-format

* refactor: remove duplicate file

* ci: add ci pipeline that tests that codebase can build

* refactor: update ci-build pipeline to only run on pull request

* refactor: update clang-format config

* refactor: apply clang-format

* feat: update pipeline to build and run tests

* refactor: disable linting checks when running colcon test

* refactor: update .pre-commit-config file (#480)

---------

Co-authored-by: Black Robot <black-robot@example.com>
Co-authored-by: Codespell Robot <codespell-robot@example.com>
Co-authored-by: Sondre Haugen <sondre95556888@gmail.com>
@Talhanc Talhanc assigned Andeshog and unassigned Andeshog Nov 9, 2024
@kluge7 kluge7 linked an issue Nov 10, 2024 that may be closed by this pull request
3 tasks
@Talhanc
Copy link
Author

Talhanc commented Jan 9, 2025

@kluge7 Bot-en feila man, kan du se på det? builder i min

@Andeshog Andeshog self-requested a review January 9, 2025 15:05
Comment on lines +3 to +5
control_topic: /thrust/wrench_input
dp_reference_topic: /dp/reference
odom_topic: /orca/odom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the twist and pose topics here as well

Comment on lines +10 to +17
// @brief Calculate the control input tau
// @param eta: 7D vector containing the vehicle pose [x, y, z, w, x, y, z]
// @param eta_d: 7D vector containing the desired vehicle pose [x, y, z, w,
// x, y, z]
// @param nu: 6D vector containing the vehicle velocity [u, v, w, p, q, r]
// @param eta_dot_d: 7D vector containing the desired vehicle velocity [u,
// v, w, p, q, r]
// @return 6D vector containing the control input tau [X, Y, Z, K, M, N]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the documentation

Comment on lines +27 to +41
types::Matrix3d calculate_R_quat(const types::Eta& eta);

// @brief Calculate the transformation matrix from a quaternion
// @param q: Quaternion represented as a 4D vector [w, x, y, z]
// @return 4x3 transformation matrix
// REF: Handbook of Marine Craft Hydrodynamics and Motion Control, Fossen 2021
// p.35 eq: 2.78
types::Matrix4x3d calculate_T_quat(const types::Eta& eta);

// @brief Calculate the Jacobian matrix
// @param eta: 7D vector containing the vehicle pose [x, y, z, w, x, y, z]
// @return 7x6 Jacobian matrix
// REF: Handbook of Marine Craft Hydrodynamics and Motion Control, Fossen 2021
// p.36 eq: 2.83
types::J_transformation calculate_J(const types::Eta& eta);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be part of the Eta struct instead? Which would result in

Eta eta;
rotation_matrix = eta.rotation_matrix;

Same would apply for T and J as well

Comment on lines +49 to +50
void PIDController::setTimeStep(double dt_) {
this->dt_ = dt_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input dt can just be written as dt here, not dt_

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also use snake_case when naming functions to keep consistent with the rest of the code

Comment on lines +4 to +7
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated, update the version number

Also remove comments in this file, doesnt add anything

ros__parameters:
control_topic: /thrust/wrench_input
dp_reference_topic: /dp/reference
nucleus_odom_topic: /orca/odom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nucleus is not used anymore, also add twist and pose

Comment on lines +8 to +11
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in pid euler, update version number and remove comments in this file

Comment on lines +3 to +5
reference_filter_topic: /aruco_board_pose_camera
dp_reference_topic: /dp/reference
nucleus_odom_topic: /orca/odom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update name for odom and add twist and pose topics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] DP controller
6 participants