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

Add support for getting PID parameters from loaded parameters #374

Merged
merged 15 commits into from
Sep 16, 2024

Conversation

saikishor
Copy link
Member

Hello!

The issue #369 will be fixed once this is merged. It seems that for our Humanoids we will be needing this PID feature to make it work using position.

This PR:

I hope this helps someone. If this PR changes look fine. I will open the following PR in the gz_ros2_control

   <gazebo>
      <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
        <ros>
          <argument>--ros-args</argument>
          <argument>--params-file</argument>
          <argument>$(find talos_description)/config/gazebo_controller_manager_cfg.yaml</argument>
        </ros>
        <hold_joints>false</hold_joints>
        <parameters>$(find talos_description)/config/gazebo_controller_manager_cfg.yaml</parameters>
      </plugin>
    </gazebo>

Defining it like this should work

gazebo_ros2_control:
  ros__parameters:
    pid_gains:
      position:
        leg_left_1_joint: {kp:  5000.0, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}
        leg_left_2_joint: {kp:  5000.0, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}
        leg_left_3_joint: {kp:  5000.0, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}
        leg_left_4_joint: {kp:  5000.0, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}
        leg_left_5_joint: {kp:  5000, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}
        leg_left_6_joint: {kp:  5000.0, kd: 20.0, ki:  5.0, max_integral_error: 10000.0}

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Do you mind to add an example and document how to set up the pid values ?

"Parameter '%s' has wrong type: %s", entry.c_str(), ex.what());
return false;
}
return std::isfinite(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

include <cmath>

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I will add it. I just wanted to leave it for initial review. Thank you for the review. I'll get it done soon

@saikishor
Copy link
Member Author

Do you mind to add an example and document how to set up the pid values ?

@ahcorde I've just added it an example, let me know how it looks

If this ros-simulation/gazebo_ros_pkgs#1546 is merged, we can have parameters tag as how we had in gazebo_ros2_control currently and we can make changes in such a way, we declare once and both same the params file

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

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

Changes look fine for me.

doc/index.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved
doc/index.rst Outdated Show resolved Hide resolved
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
@ahcorde ahcorde merged commit 6a4cc84 into ros-controls:master Sep 16, 2024
5 checks passed
@ahcorde
Copy link
Collaborator

ahcorde commented Sep 16, 2024

https://github.com/Mergifyio backport humble iron

Copy link
Contributor

mergify bot commented Sep 16, 2024

backport humble iron

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 16, 2024
Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 6a4cc84)
mergify bot pushed a commit that referenced this pull request Sep 16, 2024
Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 6a4cc84)
saikishor added a commit to pal-robotics/talos_robot that referenced this pull request Sep 17, 2024
ahcorde pushed a commit that referenced this pull request Sep 17, 2024
…375)

Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 6a4cc84)

Co-authored-by: Sai Kishor Kothakota <[email protected]>
ahcorde pushed a commit that referenced this pull request Sep 17, 2024
…376)

Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 6a4cc84)

Co-authored-by: Sai Kishor Kothakota <[email protected]>
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.

3 participants