Class ScriptCommandInterface

Inheritance Relationships

Base Type

Class Documentation

class ScriptCommandInterface : public urcl::control::ReverseInterface

The ScriptCommandInterface class starts a TCPServer for a robot to connect to and this connection is then used to forward script commands to the robot, which will be executed locally on the robot.

The script commands will be executed in a separate thread in the external control script.

Public Functions

ScriptCommandInterface() = delete
ScriptCommandInterface(uint32_t port)

Creates a ScriptCommandInterface object, including a new TCPServer.

Parameters:

port – Port to start the server on

bool zeroFTSensor()

Zero the force torque sensor.

Returns:

True, if the write was performed successfully, false otherwise.

bool setPayload(const double mass, const vector3d_t *cog)

Set the active payload mass and center of gravity.

Parameters:
  • mass – mass in kilograms

  • cog – Center of Gravity, a vector [CoGx, CoGy, CoGz] specifying the displacement (in meters) from the toolmount

Returns:

True, if the write was performed successfully, false otherwise.

bool setToolVoltage(const ToolVoltage voltage)

Set the tool voltage.

Parameters:

voltage – Tool voltage

Returns:

True, if the write was performed successfully, false otherwise.

bool startForceMode(const vector6d_t *task_frame, const vector6uint32_t *selection_vector, const vector6d_t *wrench, const unsigned int type, const vector6d_t *limits)

Set robot to be controlled in force mode.

Parameters:
  • task_frame – A pose vector that defines the force frame relative to the base frame

  • selection_vector – A 6d vector of 0s and 1s. 1 means that the robot will be compliant in the corresponding axis of the task frame

  • wrench – The forces/torques the robot will apply to its environment. The robot adjusts its position along/about compliant axis in order to achieve the specified force/torque. Values have no effect for non-compliant axes

  • type – An integer [1;3] specifying how the robot interprets the force frame 1: The force frame is transformed in a way such that its y-axis is aligned with a vector pointing from the robot tcp towards the origin of the force frame 2: The force frame is not transformed. 3: The force frame is transformed in a way such that its x-axis is the projection of the robot tcp velocity vector onto the x-y plane of the force frame

  • limits – (Float) 6d vector. For compliant axes, these values are the maximum allowed tcp speed along/about the axis. For non-compliant axes, these values are the maximum allowed deviation along/about an axis between the actual tcp position and the one set by the program

Returns:

True, if the write was performed successfully, false otherwise.

bool endForceMode()

Stop force mode and put the robot into normal operation mode.

Returns:

True, if the write was performed successfully, false otherwise.

bool startToolContact()

This will make the robot look for tool contact in the tcp directions that the robot is currently moving. Once a tool contact has been detected all movements will be canceled. Call endToolContact to enable movements again.

Returns:

True, if the write was performed successfully, false otherwise.

bool endToolContact()

This will stop the robot from looking for a tool contact, it will also enable sending move commands to the robot again if the robot’s tool is in contact.

Returns:

True, if the write was performed successfully, false otherwise.

bool clientConnected()

Returns whether a client/robot is connected to this server.

inline void setToolContactResultCallback(std::function<void(ToolContactResult)> callback)

Set the tool contact result callback object.

Parameters:

callback – Callback function that will be triggered when the robot enters tool contact

Protected Functions

virtual void connectionCallback(const int filedescriptor) override
virtual void disconnectionCallback(const int filedescriptor) override
virtual void messageCallback(const int filedescriptor, char *buffer, int nbytesrecv) override