1
$\begingroup$

I have a Gazebo simulation running with a spawned robot. I also have initialized two trajectory-based controllers using JointEffortInterface for Gazebo-ROS plugin - arm_controller and gripper_controller. I am using MoveIt Group Commander for these two controllers.

I suspect these controllers are shut down at some point in time of the simulation and throw the following error when trying to read /joint_states topic:

[ERROR]: Didn't receive robot state (joint angles) with recent timestamp within 1 seconds.
Check clock synchronization if your are running ROS across multiple machines!

Is there a way I can check if these controllers are enabled and running at any time during the simulation?

$\endgroup$
4
  • 1
    $\begingroup$ Do you mean like these are ROS services? Something else? It's not clear to me what's throwing your errors, but when you say you get an error when trying to read /joint_states topic I would guess the error there is with whatever is supposed to be publishing the /joint_states topic (I would think this should be Gazebo) and not with the thing subscribing to the topic (the controllers). First thing I would do is look at rostopic info /joint_states and see what the publisher is. $\endgroup$
    – Chuck
    Aug 2 at 18:30
  • 1
    $\begingroup$ Also if you're in simulation, especially if the simulation is running slower than realtime, you may need to rosparam set /use_sim_time true before running your simulations. Remember that nodes/services won't pick up that parameter if you set it after starting them, so be sure to restart any nodes/services after setting /use_sim_time true. $\endgroup$
    – Chuck
    Aug 2 at 18:31
  • 1
    $\begingroup$ Thanks for your responses! The error was being thrown since the simulation was paused and my MoveIt /move_group node was not able to access the /joint_states topic. Your point about the issue being with the publisher got me thinking - thanks! $\endgroup$
    – rl4haai
    Aug 4 at 14:04
  • 1
    $\begingroup$ I already had the use_sim_time parameter set True. Thanks again for providing the explanation on its usage! $\endgroup$
    – rl4haai
    Aug 4 at 14:05

1 Answer 1

1
$\begingroup$

I was able to keep a track of the controllers and their states using:

import rospy
from controller_manager_msgs.srv import ListControllers

__list_controllers = rospy.ServiceProxy("/controller_manager/list_controllers", ListControllers)

__list_controllers.call() #whenever required
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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