Ask Your Question
0

Can't publish data on gazebo_ros_control command topics

asked 2022-06-13 14:54:34 -0500

Rellum gravatar image

updated 2022-06-14 09:21:03 -0500

Hello ROS community!

I am trying to follow this gazebo tutorial on ros_control in order to control the links of a custom robot model. I am using ROS1 and gazebo 11.11.0 on ubuntu 20.04.04 LTS.

I was able to spawn my robot in gazebo and control it using gazebo's force controllers (right hand side tab) and it behaved the way I expected. Naturally the next step was to control it through ROS as I said above.

The problem is that even though i can see the new /microbot topics with rostopic list

rellum@yoga:~$ rostopic list 
/clock
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates 
/gazebo/performance_metrics
/gazebo/set_link_state
/gazebo/set_model_state
/microbot/joint_states
/microbot/left_joint_controller/command
/microbot/left_joint_controller/pid/parameter_descriptions
/microbot/left_joint_controller/pid/parameter_updates
/microbot/left_joint_controller/state
/microbot/right_joint_controller/command
/microbot/right_joint_controller/pid/parameter_descriptions
/microbot/right_joint_controller/pid/parameter_updates
/microbot/right_joint_controller/state
/rosout
/rosout_agg

nothing is happening after i publish data to the /command topics, as instructed in the tutorial.

rellum@yoga:~$ rostopic pub -1 /microbot/left_joint_controller/command std_msgs/Float64 "data: 0.8" 
publishing and latching message for 3.0 seconds

After I run my launch file, everything seems to start without warnings or errors.

SUMMARY
========

PARAMETERS
 * /gazebo/enable_ros_network: True
 * /microbot/joint_state_controller/publish_rate: 50
 * /microbot/joint_state_controller/type: joint_state_contr...
 * /microbot/left_joint_controller/joint: platform_to_left_...
 * /microbot/left_joint_controller/pid/d: 1
 * /microbot/left_joint_controller/pid/i: 1
 * /microbot/left_joint_controller/pid/p: 1
 * /microbot/left_joint_controller/type: effort_controller...
 * /microbot/right_joint_controller/joint: platform_to_right...
 * /microbot/right_joint_controller/pid/d: 1
 * /microbot/right_joint_controller/pid/i: 1
 * /microbot/right_joint_controller/pid/p: 1
 * /microbot/right_joint_controller/type: effort_controller...
 * /robot_description: <?xml version="1....
 * /rosdistro: noetic
 * /rosversion: 1.15.14
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    spawn_urdf (gazebo_ros/spawn_model)
  /microbot/
    controller_spawner (controller_manager/spawner)

auto-starting new master
process[master]: started with pid [880913]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to ea0d1d5a-eb39-11ec-8ffc-bd72914f1943
process[rosout-1]: started with pid [880937]
started core service [/rosout]
process[gazebo-2]: started with pid [880940]
process[gazebo_gui-3]: started with pid [880947]
process[spawn_urdf-4]: started with pid [880954]
process[microbot/controller_spawner-5]: started with pid [880956]
[ INFO] [1655139452.531792, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[ INFO] [1655139452.841190758]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1655139452.841940214]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1655139452.939723190]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1655139452.940800785]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, 
waiting...
[ INFO] [1655139453.230924421, 0.008000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1655139453.244949178, 0.022000000]: Physics dynamic reconfigure ready.
[ INFO] [1655139453.658197765, 0.368000000]: Loading gazebo_ros_control plugin
[ INFO] [1655139453.658298649, 0.368000000]: Starting gazebo_ros_control plugin in namespace: /microbot
[ INFO] [1655139453.658703745, 0.368000000]: gazebo_ros_control plugin is waiting for model URDF in parameter 
[/robot_description] on the ROS param server.
[ INFO] [1655139453.801262215, 0.368000000]: Loaded gazebo_ros_control.
[INFO] [1655139454.039562, 0.607000]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1655139454.041235, 0.609000]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1655139454.043021, 0.611000]: Loading controller: left_joint_controller
[INFO] [1655139454.065464, 0.634000]: Loading controller: right_joint_controller
[INFO] [1655139454 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-18 05:21:23 -0500

Rellum gravatar image

I found the problem, i will answer my question in case it helps someone.

I had wrong pid values in the config.yaml. I had followed the tutorials on gazebo_ros_control correctly but i noticed that the robot span out of control when i launched the simulation so i zeroed the values of i and d.

I ended up using velocity controllers so the pid wasn't even needed in the first place. Moral of the story, don't put random values to your pid's.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-06-13 14:54:34 -0500

Seen: 27 times

Last updated: Jul 18