Skip to content

fix ParameterAlreadyDeclaredException in _on_heartbeat_timeout#114

Open
y-bachmann wants to merge 2 commits intoros:ros2from
y-bachmann:fix_ParameterAlreadyDeclaredException
Open

fix ParameterAlreadyDeclaredException in _on_heartbeat_timeout#114
y-bachmann wants to merge 2 commits intoros:ros2from
y-bachmann:fix_ParameterAlreadyDeclaredException

Conversation

@y-bachmann
Copy link

When a bond times out and after that a new bond is created which also times out, the following exception occurs:

Exception in thread Thread-121:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1378, in run
    self.function(*self.args, **self.kwargs)
  File "/opt/ros/humble/lib/python3.10/site-packages/bondpy/bondpy.py", line 85, in _on_timer
    self.on_timeout()
  File "/opt/ros/humble/lib/python3.10/site-packages/bondpy/bondpy.py", line 187, in _on_heartbeat_timeout
    self.node.declare_parameter(Constants.DISABLE_HEARTBEAT_TIMEOUT_PARAM, False)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 367, in declare_parameter
    return self.declare_parameters('', [args], ignore_override)[0]
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 490, in declare_parameters
    raise ParameterAlreadyDeclaredException(parameters_already_declared)
rclpy.exceptions.ParameterAlreadyDeclaredException: ('Parameter(s) already declared', ['/bond_disable_heartbeat_timeout'])

By guarding against ParameterAlreadyDeclaredException this can be easily handled.

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.

1 participant