ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

service call succeeds, but not applied in gazebo

asked 2013-03-24 02:37:47 -0500

inflo gravatar image

hi, in my gtest i do a service call

ros::ServiceClient client = nH.serviceClient<gazebo_msgs::applyjointeffort>("/gazebo/apply_joint_effort"); EXPECT_TRUE(;

this service call returns true, the response message tells me: ApplyJointEffort: effort set

but the effort is not applied to the model in the running gazebo simulator ?

I have checked the network tcp/ip streams, and see that there are some packets talking about the service /gazebo/apply_joint_effort, but i cannot see anywhere some values i send like duration,start_time,effort ?

How can i do a better inspection of the services? what could this error cause?

thanks flo

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-29 03:27:22 -0500

inflo gravatar image

hi, as this topic is very interresting, see view-count :) i will answer it by myself.

If you use the cmdline tool "rosservice" with the command "call" you can specify, e.g. when calling /gazebo/apply_joint_effort service, the duration. This duration is of type ros::duration. You can check this by calling:

rosservice info gazebo/apply_joint_effort Node: /gazebo URI: rosrpc://ros:43892 Type: gazebo_msgs/ApplyJointEffort Args: joint_name effort start_time duration

The type gazebo_msgs/ApplyJointEffort contains ros::duration as type of the duration.

But when you can e.g. (with -v for verbose outpt):

rosservice call -v gazebo/apply_joint_effort '{joint_name: myjoint, effort: 100, start_time: 0, duration: 100000}'

you can see, that rosservice uses the 100000 as nanoseconds:

duration: secs: 0 nsecs: 100000

But if you use the ros::ServiceClient and set the duration with:

gazebo_msgs::ApplyJointEffort r; r.request.duration = ros::Duration(100000.);

you set 100000. seconds.

If you print out the values in seconds from inside gazebo_ros_api_plugin.cpp:GazeboRosApiPlugin::applyJointEffort() function, you get with rosservice call:

duration >0.000100<

and with ros::duration(100000.) you get:

duration >100000.000000<

So if you know this, adjust your values and it will work.


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


Asked: 2013-03-24 02:37:47 -0500

Seen: 322 times

Last updated: Mar 29 '13