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

set_parameters callback returns None #1423

Open
belalhmedan90 opened this issue Mar 5, 2025 · 3 comments
Open

set_parameters callback returns None #1423

belalhmedan90 opened this issue Mar 5, 2025 · 3 comments
Labels
more-information-needed Further information is required

Comments

@belalhmedan90
Copy link

belalhmedan90 commented Mar 5, 2025

The callback returns None, and I get an error:

AttributeError: 'NoneType' object has no attribute 'successful'

in this line 832

@fujitatomoya
Copy link
Collaborator

can you provide more description about this?

  • what is the expected behavior?
  • what is the actual behavior?
  • self-contained, complete reproducible procedure or sample code.

@fujitatomoya fujitatomoya added the more-information-needed Further information is required label Mar 5, 2025
@bhomaidan1990
Copy link

bhomaidan1990 commented Mar 6, 2025

  • what is the expected behavior?

To set parameters from a list without Errors.

*what is the actual behavior?

I get the error mentioned above when processing the second parameter

sample code.

from rclpy.node import Node

class Test(Node):
    def __init__(self):
        super.__init__(node_name="test")
        params_list = [
            ("param1", "val1"),
            ("param2", "val2"),
            ("param3", "val3")
        ]
        self.declare_parameters(namespace="package_name", parameters=params_list)

Same Issue happens on Jazzy as well, however different line number:

Full Error msg:

Traceback (most recent call last):
  File "/opt/ros/jazzy/lib/my_pkg/action_server.py", line 441, in <module>
    main()
  File "/opt/ros/jazzy/lib/my_pkg/action_server.py", line 430, in main
    test = Test()
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/my_pkg/action_server.py", line 79, in __init__
    self.declare_params()
  File "/opt/ros/jazzy/lib/my_pkg/action_server.py", line 166, in declare_params
    self.declare_parameters(namespace="my_pkg", parameters=params_list)
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/node.py", line 528, in declare_parameters
    self._declare_parameter_common(
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/node.py", line 577, in _declare_parameter_common
    result = self._set_parameters_atomically_common(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/rclpy/node.py", line 910, in _set_parameters_atomically_common
    if not result.successful:
           ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'successful'
[ros2run]: Process exited with failure 1

@belalhmedan90
Copy link
Author

@fujitatomoya if the result of this callback is None, there should be an exception handling, or something like that imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed Further information is required
Projects
None yet
Development

No branches or pull requests

3 participants