0
$\begingroup$

I am working with Inverted double pendulum in ROS2 Gazebo. I have written a controller which subscribes to /dynamic_joint_states and publishes to /effort_controller/commands of effort controller of ROS2 control to stabilize the links in vertical position.

My controller doesn't seems to be working.

Problem While trying to diagnose the issue, I realize when I echo the effort from /dynamic_joint_states and commanded effort from /effort_controller/commands, I see a lag between the two values.

Example When I command the effort to be 10 for all time, for first 1-2 seconds effort from /dynamic_joint_interface reads 0 then it goes to 10.

I am suspecting this lag to be causing my controller to fail. Even if this is not the issue can someone explain why there's a lag and is there a method to reduce that lag.

$\endgroup$

1 Answer 1

1
$\begingroup$

I'm writing here as I couldn't comment yet. Did you write a ROS2 Controller or a ROS2 node?.

If it is a ROS2 node, can you check if the spin is done properly? and also checking the code of the controller (https://github.com/ros-controls/ros2_controllers/blob/bdb7ad5bdcdfec0cd0b17bb05aaf3cac8229e7b5/forward_command_controller/src/forward_controllers_base.cpp#L61C1-L63C84), it writes into the RT Publisher as soon as it gets. You can clone both ros2_controllers and realtime_tools packages and debug it from there

If it is a ROS2 Controller, then you are not supposed to subscribe to the joint states, instead in the state interface ask for ALL (https://github.com/ros-controls/ros2_controllers/blob/bdb7ad5bdcdfec0cd0b17bb05aaf3cac8229e7b5/joint_state_broadcaster/src/joint_state_broadcaster.cpp#L79). Later, use that data to command the interfaces.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.