API reference for C/C++ Runtime

class EDScorbot

Class that handles communication with EDScorbot’s controller in the FPGA.

This class makes use of the underlying register-memory mapping that the MPSoC is able to provide. From the ARM point of view, 7 32-bit registers are available, 1 write register used for control of each joint’s controller and 6 read registers which hold the position of each joint at any given moment. From the FPGA point of view, the register’s use is inverted, thus having 1 read register and 6 write registers. The read register will contain 24-bit packets of data (packaged in 32 bits, so the 8 most significant are discarded) that are able to command each joint’s controller individually. The write registers are directly mapped to the counter registers that receive the optic encoders’ signal.

This will be the description for the following group of variables

It can be arbitrarily long, but the first line will show up in bold, and any subsequent lines will show up like a description under it

EDScorbotJoint j1 = {"M1", 1}

Joint initialization for EDScorbot handler

EDScorbotJoint j2 = {"M2", 2}

Joint initialization for EDScorbot handler

EDScorbotJoint j3 = {"M3", 3}

Joint initialization for EDScorbot handler

EDScorbotJoint j4 = {"M4", 4}

Joint initialization for EDScorbot handler

EDScorbotJoint j5 = {"M5", 5}

Joint initialization for EDScorbot handler

EDScorbotJoint j6 = {"M6", 6}

Joint initialization for EDScorbot handler

Public Functions

EDScorbot()

Construct a new EDScorbot object.

EDScorbot(std::string)

Construct a new EDScorbot object and initializes configuration for SPID controllers of EDScorbot.

This constructor populates each joint’s object variable with the parameters it needs to configure the underlying controller implementation.

Parameters

config_path – relative path to json configuration file.

~EDScorbot()

Default destructor for EDScorbot class.

void initJoints()

Explicitly initialize joint 1-6 configuration using loaded json config file.

void configureInitJoint(EDScorbotJoint)

Initialize joint configuration for the specified joint.

Parameters

j – Joint to be initialized

void searchHome(EDScorbotJoint, bool)

Home routine, to be performed per joint.

This function performs the home routine for a specific joint, indicated in the j parameter. Usually, a joint is commanded to move until it hits one of its mechanical limits and then a gradual increase in position allows for searching the home signal, given by a microswitch in each joint

Parameters
  • j – Joint to perform the home routine to

  • v – Whether to behave verbosely or not

int sendRef(int, EDScorbotJoint)

Command a specific position to a specific joint.

Parameters
  • ref – Reference (position) to be commanded

  • j – Joint to be commanded the reference ref

void resetJPos(EDScorbotJoint)

Reset the controller’s home position (reference 0) for a specific joint.

Parameters

j – Joint which we want to reset the position of

float count_to_angle(int, int)

Implements counter register value to position in angles transformation.

Parameters
  • motor – Joint/Motor for which to perform the conversion (different joints have different conversion values)

  • count – Value read from the robot’s counter register, which indicates absolute position of the joint

Returns

float Converted position value in angles (not radians) for the specified joint

void readJoints(int*)

Function to read the state of all the robot’s joints.

This function receives an integer array of 6 elements and assigns each of them the value of one of the robot’s joints. As such, if joints is the name of the array, joints[0] will hold the position of joint 1, joints[1] will hold the position of joint 2, etc., up to joints[5], which would hold the position of joint 6

Parameters

joints – [in,out] Array of six integers, to be filled with each joint’s position per element

Public Static Functions

static int ref_to_count(int, int)

Implements digital reference to counter register transformation.

Parameters
  • motor – Joint/Motor for which to perform the conversion (different joints have different conversion values)

  • ref – Value to be converted

Returns

int Converted position value in 16-bit format, centered at 32768

static int count_to_ref(int, int)

Implements counter register value to position in digital reference transformation.

Parameters
  • motor – Joint/Motor for which to perform the conversion (different joints have different conversion values)

  • count – Value read from the robot’s counter register, which indicates absolute position of the joint

Returns

int Converted position

static int angle_to_ref(int, float)

Implements angle position to digital reference transformation.

Parameters
  • motor – Joint/Motor for which to perform the conversion (different joints have different conversion values)

  • angle – Value to be converted from position in angles to digital reference

Returns

int Converted position

static float ref_to_angle(int, int)

Implements digital reference to angle position transformation.

Parameters
  • motor – Joint/Motor for which to perform the conversion (different joints have different conversion values)

  • ref – Value to be converted from digital reference to position in angles

Returns

float Converted position in angles (not radians)

Private Members

int *bram_ptr

Pointer to the base memory address in which the FPGA registers are placed.

class EDScorbotJoint

Class to implement joint functionalities.

Public Functions

inline EDScorbotJoint(int EI_FD, int PD_FD, int PI_FD, int leds, int spike_exp, int address, std::string id)

Construct a new EDScorbotJoint object specifying each parameter.

Parameters
  • EI_FD

  • PD_FD

  • PI_FD

  • leds

  • spike_exp

  • address

  • id

inline EDScorbotJoint(std::string id, int jnum)

Construct a new EDScorbotJoint object specifing motor ID and joint number (1-6)

This constructor allows for later initialization of the joint’s parameters

Parameters
  • id – String identifying joint/motor

  • jnum – Number identifying joint/motor. Used for indexing

inline ~EDScorbotJoint()

Default destructor for EDScorbotJoint class.