Servo¶
-
class
ingenialink.ethernet.servo.
EthernetServo
(socket, dictionary_path=None, servo_status_listener=False)[source] Servo object for all the Ethernet slave functionalities.
- Parameters
socket (socket) –
dictionary_path (str) – Path to the dictionary.
servo_status_listener (bool) – Toggle the listener of the servo for its status, errors, faults, etc.
-
DICTIONARY_CLASS
alias of
ingenialink.ethernet.dictionary.EthernetDictionary
-
change_tcp_ip_parameters
(ip_address, subnet_mask, gateway)[source] Stores the TCP/IP values. Affects IP address, network mask and gateway
Note
The drive needs a power cycle after this in order for the changes to be properly applied.
- Parameters
ip_address (str) – IP Address to be changed.
subnet_mask (str) – Subnet mask to be changed.
gateway (str) – Gateway to be changed.
- Raises
ValueError – If the drive or gateway IP is not a
valid IP address. –
ValueError – If the drive IP and gateway IP are not
on the same network. –
NetmaskValueError – If the subnet_mask is not a valid
netmask. –
-
disable
(subnode=1, timeout=1000) Disable PDS.
- Parameters
subnode (int) – Subnode of the drive.
timeout (int) – Timeout in milliseconds.
- Raises
ILTimeoutError – The servo could not be disabled due to timeout.
ILError – Failed to disable PDS.
-
disturbance_disable
() Disable disturbance process.
-
disturbance_enable
() Enable disturbance process.
-
disturbance_get_num_mapped_registers
() Obtain the number of disturbance mapped registers.
- Returns
Actual number of mapped registers.
- Return type
int
-
disturbance_remove_all_mapped_registers
() Remove all disturbance mapped registers.
-
disturbance_remove_data
() Remove disturbance data.
-
disturbance_set_mapped_register
(channel, address, subnode, dtype, size) Set monitoring mapped register.
- Parameters
channel (int) – Identity channel number.
address (int) – Register address to map.
subnode (int) – Subnode to be targeted.
dtype (int) – Register data type.
size (int) – Size of data in bytes.
-
disturbance_write_data
(channels, dtypes, data_arr) Write disturbance data.
- Parameters
channels (int or list of int) – Channel identifier.
dtypes (int or list of int) – Data type.
data_arr (list or list of list) – Data array.
-
enable
(subnode=1, timeout=1000) Enable PDS.
- Args:
subnode (int): Subnode of the drive. timeout (int): Timeout in milliseconds.
- Raises
ILTimeoutError – The servo could not be enabled due to timeout.
ILError – Failed to enable PDS.
-
fault_reset
(subnode=1, timeout=1000) Executes a fault reset on the drive.
- Parameters
subnode (int) – Subnode of the drive.
timeout (int) – Timeout in milliseconds.
- Raises
ILTimeoutError – If fault reset spend too much time.
ILError – Failed to fault reset.
-
get_state
(subnode=1) SERVO_STATE: Current drive state.
-
is_alive
() 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) Write current dictionary storage to the servo drive.
- Parameters
config_file (str) – Path to the dictionary.
subnode (int) – Subnode of the axis.
- Raises
FileNotFoundError – If the configuration file cannot be found.
ValueError – If a configuration file from a subnode different from 0
is attempted to be loaded to subnode 0. –
ValueError – If an invalid subnode is provided.
-
monitoring_actual_number_bytes
() Get the number of monitoring bytes left to be read.
-
monitoring_channel_data
(channel, dtype=None) Obtain processed monitoring data of a channel.
- Parameters
channel (int) – Identity channel number.
dtype (REG_DTYPE) – Data type of the register to map.
Note
The dtype argument is not necessary for this function, it was added to maintain compatibility with IPB’s implementation of monitoring.
- Returns
Monitoring data.
- Return type
List
-
monitoring_disable
() Disable monitoring process.
-
monitoring_enable
() Enable monitoring process.
-
monitoring_get_bytes_per_block
() Obtain Bytes x Block configured.
- Returns
Actual number of Bytes x Block configured.
- Return type
int
-
monitoring_get_num_mapped_registers
() Obtain the number of monitoring mapped registers.
- Returns
Actual number of mapped registers.
- Return type
int
-
monitoring_read_data
() Obtain processed monitoring data.
- Returns
Actual processed monitoring data.
- Return type
array
-
monitoring_remove_all_mapped_registers
() Remove all monitoring mapped registers.
-
monitoring_remove_data
() Remove monitoring data.
-
monitoring_set_mapped_register
(channel, address, subnode, dtype, size) Set monitoring mapped register.
- Parameters
channel (int) – Identity channel number.
address (int) – Register address to map.
subnode (int) – Subnode to be targeted.
dtype (int) – Register data type.
size (int) – Size of data in bytes.
-
read
(reg, subnode=1) Read a register value from servo.
- Parameters
reg (str, Register) – Register.
subnode (int) – Target axis of the drive.
- Returns
Value stored in the register.
- Return type
int, float or str
- Raises
ILAccessError – Wrong access to the register.
ILIOError – Error writing the register.
-
reload_errors
(dictionary) Force to reload all dictionary errors.
- Parameters
dictionary (str) – Dictionary.
-
replace_dictionary
(dictionary) Deletes and creates a new instance of the dictionary.
- Parameters
dictionary (str) – Path to the dictionary.
-
restore_parameters
(subnode=None) 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
the parameters. (all) –
- Raises
ILError – Invalid subnode.
ILObjectNotExist – Failed to write to the registers.
-
restore_tcp_ip_parameters
()[source] Restores the TCP/IP values back to default. Affects IP address, subnet mask and gateway
-
save_configuration
(config_file, subnode=None) 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
() Start listening for servo status events (SERVO_STATE).
-
state_wait_change
(state, timeout, subnode=1) Waits for a state change.
- Parameters
state (SERVO_STATE) – Servo state to wait for.
timeout (int) – Maximum value to wait for the change.
subnode (int) – Subnode of the drive.
- Returns
Error code.
- Return type
int
-
static
status_word_decode
(status_word) 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) 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
() Stop listening for servo status events (SERVO_STATE).
-
store_parameters
(subnode=None) Store all the current parameters of the target subnode.
- Parameters
subnode (int) – Subnode of the axis. None by default which stores
the parameters. (all) –
- Raises
ILError – Invalid subnode.
ILObjectNotExist – Failed to write to the registers.
-
store_tcp_ip_parameters
()[source] Stores the TCP/IP values. Affects IP address, subnet mask and gateway
-
subscribe_to_status
(callback) Subscribe to state changes.
- Parameters
callback (function) – Callback function.
- Returns
Assigned slot.
- Return type
int
-
unsubscribe_from_status
(callback) Unsubscribe from state changes.
- Parameters
callback (function) – Callback function.
-
write
(reg, data, subnode=1) Writes a data to a target register.
- Parameters
reg (Register, str) – Target register to be written.
data (int, str, float) – Data to be written.
subnode (int) – Target axis of the drive.
- Raises
ILAccessError – Wrong access to the register.
ILIOError – Error reading the register.
-
property
dictionary
Returns dictionary object
-
property
disturbance_data
Obtain disturbance data.
- Returns
Current disturbance data.
- Return type
array
-
property
disturbance_data_size
Obtain disturbance data size.
- Returns
Current disturbance data size.
- Return type
int
-
property
disturbance_number_mapped_registers
Get the number of mapped disturbance registers.
-
property
errors
Errors.
- Type
dict
-
property
full_name
Drive full name.
- Type
str
-
property
info
Servo information.
- Type
dict
-
property
monitoring_data_size
Obtain monitoring data size.
- Returns
Current monitoring data size in bytes.
- Return type
int
-
property
monitoring_number_mapped_registers
Get the number of mapped monitoring registers.
-
property
status
Servo status.
- Type
dict
-
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