Servo

class ingenialink.canopen.servo.CanopenServo(target, node, dictionary_path=None, eds=None, servo_status_listener=True)[source]

CANopen Servo instance.

Parameters
  • node (canopen.RemoteNode) – Remote Node of the drive.

  • dictionary_path (str) – Path to the dictionary.

  • servo_status_listener (bool) – Boolean to initialize the ServoStatusListener and check the drive status.

disable(subnode=1, timeout=1000)[source]

Disable PDS.

Parameters
  • subnode (int) – Subnode of the drive.

  • timeout (int) – Timeout in milliseconds.

Raises
enable(subnode=1, timeout=1000)[source]

Enable PDS.

Args:

subnode (int): Subnode of the drive. timeout (int): Timeout in milliseconds.

Raises
fault_reset(subnode=1, timeout=1000)[source]

Executes a fault reset on the drive.

Parameters
  • subnode (int) – Subnode of the drive.

  • timeout (int) – Timeout in milliseconds.

Raises
get_state(subnode=1)[source]

SERVO_STATE: Current drive state.

is_alive()[source]

Checks if the servo responds to a reading a register.

Returns

Return code with the result of the read.

Return type

bool

load_configuration(config_file, subnode=None)[source]

Write current dictionary storage to the servo drive.

Parameters
  • config_file (str) – Path to the dictionary.

  • subnode (int) – Subnode of the axis.

read(reg, subnode=1)[source]

Read from servo.

Parameters

reg (str, Register) – Register.

Returns

Error code of the read operation.

Return type

int

Raises
  • TypeError – If the register type is not valid.

  • ILAccessError – Wrong access to the register.

  • ILIOError – Error reading the register.

reload_errors(dictionary)[source]

Force to reload all dictionary errors.

Parameters

dictionary (str) – Dictionary.

replace_dictionary(dictionary)[source]

Deletes and creates a new instance of the dictionary.

Parameters

dictionary (str) – Dictionary.

restore_parameters(subnode=None)[source]

Restore all the current parameters of all the slave to default.

Note

The drive needs a power cycle after this in order for the changes to be properly applied.

Parameters
  • subnode (int) – Subnode of the axis. None by default which restores

  • parameters. (all the) –

Raises
save_configuration(config_file, subnode=None)[source]

Read all dictionary registers content and put it to the dictionary storage.

Parameters
  • config_file (str) – Destination path for the configuration file.

  • subnode (int) – Subnode of the axis.

start_status_listener()[source]

Start listening for servo status events (SERVO_STATE).

static status_word_decode(status_word)[source]

Decodes the status word to a known value.

Parameters

status_word (int) – Read value for the status word.

Returns

Status word value.

Return type

SERVO_STATE

status_word_wait_change(status_word, timeout, subnode=1)[source]

Waits for a status word change.

Parameters
  • status_word (int) – Status word to wait for.

  • timeout (int) – Maximum value to wait for the change.

  • subnode (int) – Subnode of the drive.

Returns

Error code.

Return type

int

stop_status_listener()[source]

Stop listening for servo status events (SERVO_STATE).

store_parameters(subnode=None, sdo_timeout=3)[source]

Store all the current parameters of the target subnode.

Parameters
  • subnode (int) – Subnode of the axis. None by default which stores

  • parameters. (all the) –

  • sdo_timeout (int) – Timeout value for each SDO response.

Raises
subscribe_to_status(callback)[source]

Subscribe to state changes.

Parameters

callback (function) – Callback function.

Returns

Assigned slot.

Return type

int

unsubscribe_from_status(callback)[source]

Unsubscribe from state changes.

Parameters

callback (function) – Callback function.

write(reg, data, subnode=1)[source]

Writes a data to a target register.

Parameters
  • reg (CanopenRegister, str) – Target register to be written.

  • data (int, str, float) – Data to be written.

  • subnode (int) – Target axis of the drive.

Raises
  • TypeError – If the register type is not valid.

  • ILAccessError – Wrong access to the register.

  • ILIOError – Error reading the register.

property dictionary

Returns dictionary object

property errors

Errors.

Type

dict

property full_name

Drive full name.

Type

str

property info

Servo information.

Type

dict

name

Obtains the servo name.

Type

str

property node

Remote node of the servo.

Type

canopen.RemoteNode

property status

Servo status and state flags.

Type

tuple

property subnodes

Number of subnodes.

Type

int

units_acc

Acceleration units.

Type

SERVO_UNITS_ACC

units_pos

Position units.

Type

SERVO_UNITS_POS

units_torque

Torque units.

Type

SERVO_UNITS_TORQUE

units_vel

Velocity units.

Type

SERVO_UNITS_VEL

class ingenialink.canopen.servo.ServoStatusListener(servo)[source]

Reads the status word to check if the drive is alive.

Parameters

servo (CanopenServo) – Servo instance of the drive.

run()[source]

Checks if the drive is alive by reading the status word register

stop()[source]

Stops the loop that reads the status word register