You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was switching my code, which uses the PID controller from this project, from ROS1 to ROS2 and ran into the following issue:
When the PID controller is created a reference on the node is taken as a parameter. I assumed that this should be a reference to the node that is using this PID controller. The description of the constructor (https://github.com/ros-controls/control_toolbox/blob/ros2-master/include/control_toolbox/pid_ros.hpp#L58-L61) seemed to suggest that I only need to put it in a correct namespace.
Therefore, I programmed something like this:
[Node-4] terminate called after throwing an instance of 'rclcpp::exceptions::InvalidParameterValueException'
[Node-4] what(): parameter 'not_related_to_pid' could not be set: Invalid parameter
I think, the reason is that the pid controller sets the add_on_set_parameters_callback here:
My question is now: Is this intended behavior? Should every PID controller have its own node?
If yes, I think the description of the constructor should be improved or a clearer error message should be thrown to point out that it needs it own node.
Additionally, I needed to declare the parameters of the controller before calling pid.initPid() to load yaml parameters from a launch file correctly. I think this is because the PID controller only calls the decleration
I was switching my code, which uses the PID controller from this project, from ROS1 to ROS2 and ran into the following issue:
When the PID controller is created a reference on the node is taken as a parameter. I assumed that this should be a reference to the node that is using this PID controller. The description of the constructor (https://github.com/ros-controls/control_toolbox/blob/ros2-master/include/control_toolbox/pid_ros.hpp#L58-L61) seemed to suggest that I only need to put it in a correct namespace.
Therefore, I programmed something like this:
Executing this leads to following error:
I think, the reason is that the pid controller sets the
add_on_set_parameters_callback
here:control_toolbox/src/pid_ros.cpp
Lines 281 to 326 in d7462e9
This is now for the whole node and therefore any other not PID related parameters will result in errors.
I managed to fix this by creating a seperate node for the pid controller.
My question is now: Is this intended behavior? Should every PID controller have its own node?
If yes, I think the description of the constructor should be improved or a clearer error message should be thrown to point out that it needs it own node.
Additionally, I needed to declare the parameters of the controller before calling
pid.initPid()
to load yaml parameters from a launch file correctly. I think this is because the PID controller only calls the declerationcontrol_toolbox/src/pid_ros.cpp
Lines 144 to 149 in d7462e9
control_toolbox/src/pid_ros.cpp
Lines 114 to 118 in d7462e9
The text was updated successfully, but these errors were encountered: