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

Fix deprecation warning in paramater declaration #1280

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

kumar-sanjeeev
Copy link
Contributor

Updated the paramater declaration in publisher_forward_position_controller to resolve a deprecation warning when running the demo using ros2 launch ros2_control_demo_example_1 test_forward_position_controller.launch.py.

Changes Made:

  • Replaced self.declare_parameter(name) with self.declare_parameter(name, descriptor=ParameterDescriptor(dynamic_typing=True))

Fixes: #1239

Updated the paramater declaration in `publisher_forward_position_controller` to resolve a deprecation warning.

Changes Made:
- Replaced `self.declare_parameter(name)` with `self.declare_parameter(name, descriptor=ParameterDescriptor(dynamic_typing=True))`

Fixes: ros-controls#1239
Copy link

codecov bot commented Sep 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.33%. Comparing base (c08bdab) to head (cc4694a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...est_nodes/publisher_forward_position_controller.py 0.00% 1 Missing ⚠️
...est_nodes/publisher_joint_trajectory_controller.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1280      +/-   ##
==========================================
- Coverage   80.36%   80.33%   -0.03%     
==========================================
  Files         105      105              
  Lines        9389     9392       +3     
  Branches      827      831       +4     
==========================================
  Hits         7545     7545              
+ Misses       1571     1570       -1     
- Partials      273      277       +4     
Flag Coverage Δ
unittests 80.33% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...est_nodes/publisher_forward_position_controller.py 0.00% <0.00%> (ø)
...est_nodes/publisher_joint_trajectory_controller.py 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

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.

Thanks for your contribution.
One question: Why shouldn't we specify the type of being a PARAMETER_STRING instead of activating dynamic_typing?

@kumar-sanjeeev
Copy link
Contributor Author

kumar-sanjeeev commented Sep 2, 2024

Hi @christophfroehlich

I opted for dynamic_typing because it is implemented in the publisher_joint_trajectory_controller.

As you suggested, I tried using the type during the declaration of parameters, and it works as well: self.declare_parameter(name, rclpy.Parameter.Type.DOUBLE_ARRAY)

@destogl
Copy link
Member

destogl commented Sep 2, 2024

As you suggested, I tried using the type during the declaration of parameters, and it works as well: self.declare_parameter(name, rclpy.Parameter.Type.DOUBLE_ARRAY)

Let's use this exact approach. As rather to use explicit instead of implicit

Sanjeev Kumar added 2 commits September 2, 2024 19:12
Updated the paramater declaration to include type in `publisher_forward_position_controller` and `publisher_joint_trajectory_controller`

Changes Made:
- Replaced `self.declare_parameter(name)` with `self.declare_parameter(name, rclpy.Parameter.Type.DOUBLE_ARRAY)`
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.

LGTM!

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

LGTM

@bmagyar bmagyar merged commit 48a7f8b into ros-controls:master Sep 11, 2024
12 of 17 checks passed
RobertWilbrandt pushed a commit to RobertWilbrandt/ros2_controllers that referenced this pull request Sep 19, 2024
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.

publisher_forward_position_controller uses deprecated parameter API
5 participants