Skip to content

Commit

Permalink
Merge branch 'master' into namespaced_example
Browse files Browse the repository at this point in the history
  • Loading branch information
ahcorde authored Nov 4, 2024
2 parents 0fb3bc1 + def1a86 commit 2e8741c
Show file tree
Hide file tree
Showing 12 changed files with 389 additions and 62 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -35,7 +35,7 @@ repos:

# Python hooks
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand All @@ -51,7 +51,7 @@ repos:
args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"]

- repo: https://github.com/pycqa/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8
args: ["--extend-ignore=E501"]
Expand All @@ -72,7 +72,7 @@ repos:
- id: ament_cppcheck
name: ament_cppcheck
description: Static code analysis of C/C++ files.
stages: [commit]
stages: [pre-commit]
entry: ament_cppcheck
language: system
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
Expand All @@ -83,7 +83,7 @@ repos:
- id: ament_cpplint
name: ament_cpplint
description: Static code analysis of C/C++ files.
stages: [commit]
stages: [pre-commit]
entry: ament_cpplint
language: system
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
Expand All @@ -95,7 +95,7 @@ repos:
- id: ament_lint_cmake
name: ament_lint_cmake
description: Check format of CMakeLists.txt files.
stages: [commit]
stages: [pre-commit]
entry: ament_lint_cmake
language: system
files: CMakeLists\.txt$
Expand All @@ -106,13 +106,13 @@ repos:
- id: ament_copyright
name: ament_copyright
description: Check if copyright notice is available in all files.
stages: [commit]
stages: [pre-commit]
entry: ament_copyright
language: system

# Docs - RestructuredText hooks
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
rev: v1.1.2
hooks:
- id: doc8
args: ['--max-line-length=100', '--ignore=D001']
Expand All @@ -136,7 +136,7 @@ repos:
exclude: CHANGELOG\.rst|\.(svg|pyc)$

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
rev: 0.29.4
hooks:
- id: check-github-workflows
args: ["--verbose"]
Expand Down
35 changes: 35 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ Where the parameters are as follows:

The same definitions apply to the ``vel_*`` parameters.

The PID parameters can be defined for ``position`` or ``position_pid`` and ``velocity`` or ``velocity_pid`` command interfaces as explained above, or defining them in a YAML file and loading it in the ``gazebo_ros2_control`` plugin as below:

.. code-block:: yaml
gazebo_ros2_control:
ros__parameters:
pid_gains:
position_pid: # (or) position
slider_to_cart: {kp: 100.0, kd: 10.0, ki: 1.0, max_integral_error: 10000.0}
.. code-block:: xml
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
...
<ros>
<argument>--ros-args</argument>
<argument>--params-file</argument>
<argument>Path to the configuration file</argument>
</ros>
</plugin>
</gazebo>
Add the gazebo_ros2_control plugin
==========================================

Expand Down Expand Up @@ -386,10 +410,21 @@ The following examples shows a vertical cart control by a PID joint using positi

.. code-block:: shell
ros2 launch gazebo_ros2_control_demos vertical_cart_example_position_pids_in_yaml.launch.py
ros2 launch gazebo_ros2_control_demos vertical_cart_example_position_pid.launch.py
ros2 launch gazebo_ros2_control_demos vertical_cart_example_velocity_pid.launch.py
.. code-block:: shell
ros2 run gazebo_ros2_control_demos example_position_pid
ros2 run gazebo_ros2_control_demos example_velocity
The ``vertical_cart_example_position_pids_in_yaml.launch.py`` example uses a YAML file as following to set the PID gains:

.. code-block:: yaml
gazebo_ros2_control:
ros__parameters:
pid_gains:
position:
slider_to_cart: {kp: 100.0, kd: 10.0, ki: 1.0, max_integral_error: 10000.0}
8 changes: 8 additions & 0 deletions gazebo_ros2_control/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog for package gazebo_ros2_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.7.3 (2024-09-17)
------------------
* Add support for getting PID parameters from loaded parameters (`#374 <https://github.com/ros-controls/gazebo_ros2_control//issues/374>`_)
Co-authored-by: Christoph Fröhlich <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
* propagate gazebo remapping and other arguments to the controller node (`#370 <https://github.com/ros-controls/gazebo_ros2_control//issues/370>`_)
* Contributors: Sai Kishor Kothakota

0.7.2 (2024-07-09)
------------------
* Propagate the node clock and logging interface to ResourceManager (`#357 <https://github.com/ros-controls/gazebo_ros2_control/issues/357>`_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ class GazeboSystem : public GazeboSystemInterface
const hardware_interface::HardwareInfo & hardware_info,
gazebo::physics::ModelPtr parent_model);

control_toolbox::Pid extractPID(
std::string prefix,
hardware_interface::ComponentInfo joint_info);
bool extractPID(
const std::string & prefix,
const hardware_interface::ComponentInfo & joint_info, control_toolbox::Pid & pid);

bool extractPIDFromParameters(
const std::string & control_mode, const std::string & joint_name, control_toolbox::Pid & pid);

/// \brief Private data class
std::unique_ptr<GazeboSystemPrivate> dataPtr;
Expand Down
2 changes: 1 addition & 1 deletion gazebo_ros2_control/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>gazebo_ros2_control</name>
<version>0.7.2</version>
<version>0.7.3</version>
<description>gazebo_ros2_control</description>

<maintainer email="[email protected]">Alejandro Hernandez</maintainer>
Expand Down
4 changes: 3 additions & 1 deletion gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,14 @@ void GazeboRosControlPlugin::Load(gazebo::physics::ModelPtr parent, sdf::Element

// Create the controller manager
RCLCPP_INFO(impl_->model_nh_->get_logger(), "Loading controller_manager");
rclcpp::NodeOptions options = controller_manager::get_cm_node_options();
options.arguments(arguments);
impl_->controller_manager_.reset(
new controller_manager::ControllerManager(
std::move(resource_manager_),
impl_->executor_,
controllerManagerNodeName,
impl_->model_nh_->get_namespace()));
impl_->model_nh_->get_namespace(), options));
impl_->executor_->add_node(impl_->controller_manager_);

auto cm_update_rate = impl_->controller_manager_->get_update_rate();
Expand Down
Loading

0 comments on commit 2e8741c

Please sign in to comment.