Force Mode example
The ur_client_library
supports leveraging the robot’s force mode directly. An example on how to
use it can be found in force_mode_example.cpp.
In order to utilize force mode, we’ll have to create and initialize a driver object
first. We use the ExampleRobotWrapper
class for this example. That starts a UrDriver
and a DashboardClient to communicate with the robot:
Start force mode
After that, we can start force mode by calling the startForceMode()
function:
All parameters for the force mode are included into the startForceMode()
function call. If you
want to change the parameters, e.g. change the forces applied, you can simply call
startForceMode()
again with the new parameters.
Note
CB3 robots don’t support specifying force_mode’s gain_scaling
, so there are two different
functions available.
Once force mode is started successfully, we’ll have to send keepalive messages to the robot in order to keep the communication active:
Stop force mode
Once finished, force_mode can be stopped by calling endForceMode()
.