Example driver

In the examples subfolder you will find a minimal example of a running driver. It starts an instance of the UrDriver class and prints the RTDE values read from the controller. To run it make sure to

  • have an instance of a robot controller / URSim running at the configured IP address (or adapt the address to your needs)

  • run it from the package’s main folder (the one where the README.md file is stored), as for simplicity reasons it doesn’t use any sophisticated method to locate the required files.

This page will walk you through the full_driver.cpp example.

Initialization

At first, we create a ExampleRobotWrapper object giving it the robot’s IP address, script file and RTDE recipes.

Robot control loop

This example reads the robot’s joint positions, increments / decrements the 5th axis and sends that back as a joint command for the next cycle. This way, the robot will move its wrist first until a positive limit and then back to 0.

To read the joint data, the driver’s RTDE client is used:

The first read operation will initialize the target buffer with the current robot position. Next, the target joint configuration is calculated:

To send the control command, the robot’s ReverseInterface is used via the writeJointCommand() function: