Skip to content

setpathparameters

Salvo Virga edited this page Feb 2, 2017 · 4 revisions

Setting Path Parameters at Runtime

Using the KUKA APIs, ROSSmartServo provides a ROS Service to change the relative velocity and acceleration of the robot online.
Once you start ROSSmartServo the ROS Service will be advertized on /iiwa /configuration/pathParameters.
We call velocity and acceleration "Path Parameters" just because KUKA refers to them with this naming in their documentation.

IMPORTANT: by default, when you start ROSSmartServo the robot will use the default values for velocity and acceleration (1.0, i.e. 100%)

The service request is described here and it is pretty simple, you can set:

  • joint velocity
  • joint acceleration
  • override of the joint acceleration You can find their description in the KUKA manuals.

NOTE: currently, it appears to us that changing joint acceleration doesn't result in any actual change in the behavior of the robot. But the values is correctly set using the KUKA APIs, so something is wrong with them. We already told KUKA.

C++ Example

You can call the service like any other ROS Service, as explained in the ROS Tutorials.

Additionally, we provide an helper class in iiwa_ros - surprisingly called iiwaRos in a moment of wild imagination - that handles all the functionalities you might need.
For example, you could directly use iiwaRos in your own ROS package to easily call the aforementioned service:

iiwa_ros::iiwaRos my_iiwa_ros_object;
[...]
my_iiwa_ros_object.init(); // this initializes all the subscribers, publishers and services, it has to be called after you are sure a ros::init() was called.
[...]
my_iiwa_ros_object.getPathParametersService().setJointRelativeVelocity(0.5) // The robot will now move at 50% velocity. No values were given for acceleration and override acceleration, so the current one will continue to be used.

iiwaRos has a bunch of useful methods to use the ROS topics (to read and command the robot) and the ROS services (to change control mode, change velocity/acceleration and get the time left to destination). You can check out its methods.
The methods for just calling this service are actually provided by the [PathParametersService class] (../blob/master/iiwa_ros/include/path_parameters_service.h), you can just include that if you only need this service.


The same without any helper class would look like this:

ros::ServiceClient client = nh.serviceClient<iiwa_msgs::ConfigureSmartServo>("/iiwa/configuration/pathParameters");
iiwa_msgs:: SetPathParameters config;

config. joint_relative_velocity = 0.5;
config. joint_relative_acceleration = -1; // negative values will be ignored.
config. override_joint_acceleration = -1; // negative values will be ignored.

if (client.call(config)) {
    if(!config.response.success)
        ROS_ERROR_STREAM("Config failed, Java error: " << config.response.error);
    else
        ROS_INFO_STREAM("Path Parameter Service successfully called.");
}
else {
    ROS_ERROR_STREAM("Config failed - service could not be called - QUITTING NOW !");
}
Clone this wiki locally