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
the drive status. (check) –
-
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
-
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_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
- Raises
ILIOError – If the dictionary is not loaded.
ILWrongRegisterError – If the register has invalid format.
-
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
(path, subnode=0)[source]¶ Write current dictionary storage to the servo drive.
- Parameters
path (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.
-
restore_parameters
()[source]¶ Restore all the current parameters of all the slave to default.
- Raises
ILError – Invalid subnode.
ILObjectNotExist – Failed to write to the registers.
-
save_configuration
(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 axis.
-
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
-
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
-
store_parameters
(subnode=0, sdo_timeout=3)[source]¶ Store all the current parameters of the target subnode.
- Parameters
subnode (int) – Subnode of the axis.
sdo_timeout (int) – Timeout value for each SDO response.
- Raises
ILError – Invalid subnode.
ILObjectNotExist – Failed to write to the registers.
-
subscribe_to_status
(callback)[source]¶ Subscribe to state changes.
- Parameters
callback (Callback) – Callback function.
- Returns
Assigned slot.
- Return type
int
-
unsubscribe_from_status
(callback)[source]¶ Unsubscribe from state changes.
- Parameters
callback (Callback) – 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
state
¶ Servo state and state flags.
- Type
tuple
-
property
subnodes
¶ Number of subnodes.
- Type
int
-
units_acc
¶ Acceleration units.
- Type
-
units_pos
¶ Position units.
- Type
-
units_torque
¶ Torque units.
- Type
-
units_vel
¶ Velocity units.
- Type
-
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.