ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
![]() | 1 | initial version |
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.
flo