Robot Driver#

enum Result
enumerator Success = 1

Finished successfully.

enumerator Error = -1

General (unspecified) error.

enumerator ErrorStartPositionDeviation = -100

The start position of the trajectory deviates from the current robotā€™s position.

enumerator ErrorTrajectoryDidNotUpdate = -101

Failed to update the trajectory.

enumerator ErrorReachGoalTimeout = -102

Waiting to reach goal position has timed out.

enumerator ErrorCommandAlreadyInProgress = -103

Another command already in progress.

enumerator ErrorTrajectoryAborted = -104

Trajectory aborted by stop command.

enumerator ErrorController = -200

General error on the controller.

enumerator ErrorControllerEStopActive = -201

E-Stop is active on the controller.

enumerator ErrorControllerSafetyViolation = -202

Safety violation occured on the controller.

enumerator ErrorControllerAlarmActive = -203

An alarm is active on the controller.

enumerator ErrorControllerNotInAutoMode = -204

Controller is not in automatic mode.

enumerator ErrorControllerNotInRemoteMode = -205

Controller not in a remote mode for external control.

enumerator ErrorControllerInHoldState = -206

Controller is in a hold state.

enumerator ErrorControllerEnableMotors = -207

The robotā€™s motors are not enabled.

enumerator ErrorControllerProgramStopped = -208

Controller program stopped unexpectedly.

enumerator ErrorControllerSendingStop = -209

Failed to send the stop command to the controller.

enumerator ErrorControllerConnection = -210

No connection to controller.

class FutureResult
Result wait()

Blocks the code execution until the robot has finished the motion and then returns its result.

bool has_finished()

Returns whether the corresponding motions has already finished.

class Driver
bool reconnect()

Connect to the robot, in particular after an external disconnection. Returns reconnection success.

bool disconnect()

Disconnect from the robot. Returns disconnection success.

bool is_connected() const

Is the robot currently connected?

ControllerStatus get_controller_status() const

Current status of the robotā€™s controller.

Result enable()

Enable robotā€™s servos (if available).

Result disable()

Disable robotā€™s servos (if available).

bool is_running() const

Is the robot is currently running a motion in a synchronously or asynchronously manner?

double get_speed() const

The speed parameter to change the driverā€™s execution speed. It is usually between 0.0 and 1.0, or might be higher for the SimulatedDriver for faster than real-time speeds.

void set_speed(double speed)

Sets the speed parameter.

void set_speed(double speed, double duration)

Change the speed parameter smoothly with a linear interpolation over the given time duration [s].

Config get_current_joint_position() const

Returns the current joint position of the robot.

RobotState get_current_state() const

Returns the current joint state of the robot. Velocity and acceleration information are only available for some drivers.

Result run(const Trajectory &trajectory)

Run a trajectory.

FutureResult run_async(const Trajectory &trajectory)

Run a trajectory asynchronously.

Result move_to(const ExactPoint &goal, bool ignore_collision = false)

Move to an exact waypoint.

FutureResult move_to_async(const ExactPoint &goal, bool ignore_collision = false)

Move to an exact waypoint asynchronously.

Result move_along(const std::string &name, bool ignore_collision = false)

Move along a pre-defined motion profile.

FutureResult move_along_async(const std::string &name, bool ignore_collision = false)

Move along a pre-defined motion profile asynchronously.

Result stop(bool fast_stop = true)

Stop a motion as fast as possible.

FutureResult stop_async(bool fast_stop = true)

Stop a motion as fast as possible asynchronously.

void create_io_alias(const std::string &name, size_t address)

Creates an alias name for a given I/O address.

int get_digital_input(const std::string &name)

Read a digital input.

bool set_digital_output(const std::string &name, int value)

Write to a digital output. Returns whether successful.

float get_analog_input(const std::string &name)

Read a analog input.

bool set_analog_output(const std::string &name, float value)

Write to a analog output. Returns whether successful.

int get_group_input(const std::string &name)

Read a group input.

bool set_group_output(const std::string &name, int value)

Write to a group output. Returns whether successful.


class ABBDriver : Driver
class RapidModule
RapidModule(const std::string &unit = "ROB_1", const std::string &egm_config = "default", double max_speed_deviation = 100.0)

Create a new Rapid module.

RapidModule(const std::string &manual_code)

Create a module with completly custom manual Rapid code.

std::string unit

The name of the robot unit to be controlled.

bool upload = true

Whether the rapid file should be uploaded to the controller on connection.

void add_procedure(const std::string &name, const std::string &rapid)

Adds a procedure to call with arbitrary Rapid code.

std::string get_rapid_code(const std::string &init = "egm")

Returns the overall Rapid code.

class RWS

A robot connection using the ABB Robot Web Services interface.

class Signal
std::string name

The name of the signal.

std::string category

The category of the signal.

std::string lvalue

The current value of the signal.

std::string get_version()

Get the version of the robot controller.

std::string get_robot_type()

Get the robot type.

int get_speed_ratio()

Get the robotā€™s speed ratio.

void set_speed_ratio(int speed_ratio)

Set the robotā€™s speed ratio.

Config get_joint_position(const std::string &mechunit = "ROB_1")

Get the current robot unit joint position via the RWS interface.

void call_procedure(const std::string &name)

Call a Rapid procedure.

Result execute_rapid_main()

Execute the current Rapid program from main.

Result execute(const RapidModule &module, const std::string &init = "egm")

Executes the given Rapid module, starting from the given method.

void stop_execution()

Stop the execution of the currently running program.

void restart_controller()

Restart the controller.

Signal get_signal(const std::string &signal, const std::string &network = "", const std::string &device = "")

Read the signal of the given name.

void set_signal(const std::string &signal, const std::string &value, const std::string &network = "", const std::string &device = "")

Write the signal to the given value.

std::shared_ptr<RWS> rws

The RWS module, if initialized.

ABBDriver(std::shared_ptr<Planner> planner, int port)

Starts an ABB Robot Driver using an underlying EGM server at the specified port.

ABBDriver(std::shared_ptr<Planner> planner, std::shared_ptr<Robot> robot, int port)

Starts an ABB Robot Driver for a specified robot using an underlying EGM server at the specified port.

ABBDriver(std::shared_ptr<Planner> planner, const std::string &host, const RapidModule &module = RapidModule(), RobotWareVersion version = RobotWareVersion.RobotWare7)

Starts an ABB Robot Driver with an underyling RWS connection.

ABBDriver(std::shared_ptr<Planner> planner, std::shared_ptr<Robot> robot, const std::string &host, const RapidModule &module = RapidModule(), RobotWareVersion version = RobotWareVersion.RobotWare7)

Starts an ABB Robot Driver for a specified robot with an underyling RWS connection.

ABBDriver(std::shared_ptr<Planner> planner, const std::string &host, int port, const RapidModule &module = RapidModule(), RobotWareVersion version = RobotWareVersion.RobotWare7)

Starts an ABB Robot Driver with both an EGM server and an RWS connection.

ABBDriver(std::shared_ptr<Planner> planner, std::shared_ptr<Robot> robot, const std::string &host, int port, const RapidModule &module = RapidModule(), RobotWareVersion version = RobotWareVersion.RobotWare7)

Starts an ABB Robot Driver for a specified robot with both an EGM server and an RWS connection.

class SimulatedDriver : Driver
double time_speed = 1.0

A factor for speeding up the time, e.g. for faster than real-world simulations.

Studio studio

The underlying connection to Jacobi Studio.

Result run_result = Result::Success

The result type for motions.

Result enable_result = Result::Success

The result type for enabling or disabling the controller.

bool connect_result = true

The result type for reconnecting or disconnection the controller.

SimulatedDriver(std::shared_ptr<Planner> planner, bool sync_with_studio = false, bool log_stream = false, bool serve_io_viewer = false)

Starts an Simulated Robot Driver, possibly connecting to Jacobi Studio via Studio Live, or streaming the current positions to cout.

void set_current_joint_position(const Config &joint_position)

Sets the current robotā€™s joint position to the given value.

void create_io(const std::string &name, std::variant<int, float> default_value)

Create a simulated I/O with the given name and default value.

void load_io_config(const std::vector<Signal> &config)

Load a config a list of signals to create multiple I/Os at once.

void load_io_config_from_file(const std::filesystem::path &file)

Load a config from file to create multiple I/Os at once. The file required to be a *.json with names mapping to their default values.

class UniversalDriver : Driver
UniversalDriver(std::shared_ptr<Planner> planner, const std::string &host)

Starts an Universal Robot Driver using RTDE.

class YaskawaDriver : Driver
YaskawaDriver(std::shared_ptr<Planner> planner, const std::string &host = "192.168.1.31", int port = 50240)

Starts an Yaskawa Robot Driver connecting to the MotoPlus application running on the robot controller.