Servo

class ingenialink.canopen.servo_node.DriveStatusThread(parent)[source]

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

Parameters

parent (Servo) – Servo instance of the drive.

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class ingenialink.canopen.servo_node.Servo(net, node, dict_, boot_mode=False)[source]

Servo.

Parameters
  • net (Network) – Ingenialink Network of the drive.

  • node (int) – Node ID of the drive.

  • dict (str) – Path to the dictionary.

  • boot_mode (bool) – Booloan to avoid reading registers initially.

property dict

Dictionary.

Type

Dictionary

dict_load(dict_f)[source]

Load dictionary.

Parameters

dict_f (str) – Dictionary to be laoded.

dict_storage_read(new_path, subnode=0)[source]

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

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

  • subnode (int) – Subnode of the drive.

dict_storage_write(path, subnode=0)[source]

Write current dictionary storage to the servo drive.

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

  • subnode (int) – Subnode of the drive.

disable(subnode=1)[source]

Disable PDS.

Parameters

subnode (int) – Subnode of the drive.

Returns

Error code.

Return type

int

enable(timeout=2000, subnode=1)[source]

Enable PDS.

Parameters
  • timeout (int) – Maximum value to wait for the operation to be done.

  • subnode (int) – Subnode of the drive.

Returns

Error code.

Return type

int

property errors

Errors.

Type

dict

fault_reset(subnode=1)[source]

Executes a fault reset on the drive.

Parameters

subnode (int) – Subnode of the drive.

Returns

Error code.

Return type

int

get_all_registers()[source]

Prints all registers from the dictionary.

get_reg(reg, subnode=1)[source]

Validates a register.

Parameters
  • reg (Register, str) – Targeted register to validate.

  • subnode (int) – Subnode for the register.

Returns

Instance of the desired register from the dictionary.

Return type

Register

Raises
get_state(subnode=1)[source]

SERVO_STATE: Current drive state.

property info

Servo information.

Type

dict

init_info()[source]

Initializes the basic identification info of the drive.

property name

Drive name.

Type

str

property net

CANopen Network.

Type

net

property node

Node.

Type

int

raw_read(reg, subnode=1)[source]

Raw read from servo.

Parameters

reg (Register) – Register.

Returns

Error code of the read operation.

Return type

int

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

  • ILAccessError – Wrong acces to the register.

  • ILIOError – Error reading the register.

raw_write(reg, data, confirm=True, extended=0, subnode=1)[source]

Raw write to servo.

Parameters
  • reg (Register) – Register.

  • data (int) – Data.

  • confirm (bool, optional) – Confirm write.

  • extended (int, optional) – Extended frame.

Raises
  • TypeError – If any of the arguments type is not valid or unsupported.

  • ILAccessError – Wrong acces to the register.

  • ILIOError – Error reading the register.

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 acces to the register.

  • ILIOError – Error reading the register.

set_state(state, subnode)[source]

Sets the state internally.

Parameters
  • state (SERVO_STATE) – Curretn servo state.

  • subnode (int) – Subnode of the drive.

property state

Servo state and state flags.

Type

tuple

state_subscribe(cb)[source]

Subscribe to state changes.

Parameters

cb – Callback

Returns

Assigned slot.

Return type

int

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_drive_status_thread()[source]

Stops the DriveStatusThread.

store_all(subnode=1)[source]

Store all servo current parameters to the NVM.

Parameters

subnode (int) – Subnode of the drive.

Returns

int: Error code.

property subnodes

Number of subnodes.

Type

SUBNODES

property units_acc

Acceleration units.

Type

SERVO_UNITS_ACC

property units_pos

Position units.

Type

SERVO_UNITS_POS

property units_torque

Torque units.

Type

SERVO_UNITS_TORQUE

property units_vel

Velocity units.

Type

SERVO_UNITS_VEL