Servo

class ingenialink.ethernet.servo.EthernetServo(cffi_servo, cffi_net, target, port, communication_protocol, dictionary_path=None, servo_status_listener=True)[source]

Servo object for all the Ethernet slave functionalities.

Parameters
  • cffi_servo (CData) – CData instance of the servo.

  • cffi_net (CData) – CData instance of the network.

  • target (str) – Target ID for the slave.

  • port (int) – Port for the communication.

  • communication_protocol (NET_TRANS_PROT) – Transmission protocol.

  • dictionary_path (str) – Path to the dictionary.

  • servo_status_listener (bool) – Toggle the listener of the servo for its status, errors, faults, etc.

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.

destroy()

Destroy servo instance.

Returns

Result code.

Return type

int

disable(subnode=1, timeout=1000)

Disable PDS.

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

  • timeout (int) – Timeout in milliseconds.

Raises
disturbance_channel_data(channel, dtype, data_arr)

Send disturbance data.

Parameters
  • channel (int) – Identity channel number.

  • dtype (REG_DTYPE) – Data type of the register mapped.

  • data_arr (array) – Data that will be sent to the drive.

Returns

Return code.

Return type

int

disturbance_disable()

Disable disturbance process.

Returns

Result code.

Return type

int

disturbance_enable()

Enable disturbance process.

Returns

Result code.

Return type

int

disturbance_remove_all_mapped_registers()

Remove all disturbance mapped registers.

Returns

Return code.

Return type

int

disturbance_remove_data()

Remove disturbance data.

Returns

Result code.

Return type

int

disturbance_set_mapped_register(channel, address, subnode, dtype, size)

Set disturbance mapped register.

Parameters
  • channel (int) – Identity channel number.

  • address (int) – Register address to map.

  • dtype (REG_DTYPE) – Data type of the register to map.

Returns

Return code.

Return type

int

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.

emcy_subscribe(cb)

Subscribe to emergency messages.

Parameters

cb – Callback

Returns

Assigned slot.

Return type

int

emcy_unsubscribe(slot)

Unsubscribe from emergency messages.

Parameters

slot (int) – Assigned slot when subscribed.

enable(subnode=1, timeout=1000)

Enable PDS.

Parameters
  • subnode (int, optional) – Subnode.

  • timeout (int) – Timeout in milliseconds.

Raises
  • ILTimeoutError – The servo could not be enabled due to timeout.

  • ILError – The servo could not be enabled.

fault_reset(subnode=1, timeout=1000)

Fault reset.

Parameters
  • subnode (int, optional) – Subnode.

  • timeout (int) – Timeout in milliseconds.

Raises
get_state(subnode=1)

Obtain state of the servo.

Parameters

subnode (int, optional) – Subnode.

Returns

Servo state and state flags.

Return type

tuple

homing_start()

Start the homing procedure.

homing_wait(timeout)

Wait until homing completes.

Notes

The homing itself has a configurable timeout. The timeout given here is purely a ‘communications’ timeout, e.g. it could happen that the statusword change is never received. This timeout should be >= than the programmed homing timeout.

Parameters

timeout (int, float) – Timeout (s).

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)

Load configuration from dictionary file to the servo drive.

Parameters
  • config_file (str) – Dictionary.

  • subnode (int) – Target subnode.

monitoring_channel_data(channel, dtype)

Obtain processed monitoring data of a channel.

Parameters
  • channel (int) – Identity channel number.

  • dtype (REG_DTYPE) – Data type of the register to map.

Returns

Monitoring data.

Return type

array

monitoring_disable()

Disable monitoring process.

Returns

Result code.

Return type

int

monitoring_enable()

Enable monitoring process.

Returns

Result code.

Return type

int

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 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.

Returns

Result code.

Return type

int

monitoring_remove_data()

Remove monitoring data.

Returns

Result code.

Return type

int

monitoring_set_mapped_register(channel, address, subnode, dtype, size)

Set monitoring mapped register.

Parameters
  • channel (int) – Identity channel number.

  • reg_idx (int) – Register address to map.

  • dtype (REG_DTYPE) – Data type of the register to map.

Returns

Result code.

Return type

int

raw_read(reg, subnode=1)

Raw read from servo.

Parameters

reg (IPBRegister) – Register.

Returns

Otained value

Return type

int

Raises

TypeError – If the register type is not valid.

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

Raw write to servo.

Parameters
  • reg (IPBRegister) – 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.

read(reg, subnode=1)

Read from servo.

Parameters

reg (str, Register) – Register.

Returns

Obtained value

Return type

float

Raises

TypeError – If the register type is not valid.

read_sdo(idx, subidx, dtype, slave=1)

Read SDO from network.

Parameters
  • idx (int) – Register index.

  • subidx (int) – Register subindex.

  • dtype (REG_DTYPE) – Register data type.

  • slave (int, Optional) – Identifier of an slave in the network.

Returns

Obtained value

Return type

float

Raises

TypeError – If the register type is not valid.

read_string_sdo(idx, subidx, size, slave=1)

Read string SDO from network.

Parameters
  • idx (int) – Register index.

  • subidx (int) – Register subindex.

  • size (int) – Size in bytes to read.

  • slave (int, Optional) – Identifier of an slave in the network.

Returns

Obtained value

Return type

str

Raises

TypeError – If the register type is not valid.

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) – Dictionary.

reset()

Reset servo.

Notes

You may need to reconnect the network after reset.

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

  • parameters. (all the) –

Raises
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 save it to a new dictionary.

Parameters
  • config_file (str) – Dictionary.

  • subnode (int) – Target subnode.

start_status_listener()

Start listening for servo status events (SERVO_STATE).

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

  • parameters. (all the) –

Raises
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 – Callback

switch_on(timeout=2.0)

Switch on PDS.

This function switches on the PDS but it does not enable the motor. For most application cases, you should only use the enable function.

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

  • timeout (int) – Timeout in milliseconds.

Raises
units_factor(reg)

Obtain units scale factor for the given register.

Parameters

reg (IPBRegister) – Register.

Returns

Scale factor for the given register.

Return type

float

units_update()

Update units scaling factors.

Notes

This must be called if any encoder parameter, rated torque or pole pitch are changed, otherwise, the readings conversions will not be correct.

unsubscribe_from_status(callback)

Unsubscribe from state changes.

Parameters

callback (function) – Callback function.

wait_reached(timeout)

Wait until the servo does a target reach.

Parameters

timeout (int, float) – Timeout (s).

write(reg, data, confirm=True, extended=0, subnode=1)

Write to servo.

Parameters
  • reg (IPBRegister, str) – Register or UID to be written.

  • data (int) – Data to be written.

  • confirm (bool, optional) – Confirm write.

  • extended (int, optional) – Extended frame.

Raises

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

write_sdo(idx, subidx, dtype, value, slave=1)

Write SDO from network.

Parameters
  • idx (int) – Register index.

  • subidx (int) – Register subindex.

  • dtype (REG_DTYPE) – Register data type.

  • value (float) – Value to write.

  • slave (int, Optional) – Identifier of an slave in the network.

Returns

Obtained value

Return type

float

Raises

TypeError – If the register type is not valid.

communication_protocol

Protocol used to connect to the servo.

Type

NET_TRANS_PROT

property dictionary

Obtain dictionary of the servo.

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 errors

Obtain drive errors.

Returns

Current errors.

Return type

dict

property extended_buffer

Obtain extended buffer data.

Returns

Current extended buffer data.

Return type

str

full_name

Obtains the servo full name.

Type

str

property info

Servo information.

Type

dict

property mode

Obtains Operation mode.

Returns

Current operation mode.

Return type

SERVO_MODE

property monitoring_data

Obtain monitoring data.

Returns

Current monitoring data.

Return type

array

property monitoring_data_size

Obtain monitoring data size.

Returns

Current monitoring data size.

Return type

int

name

Obtains the servo name.

Type

str

property ol_frequency

Get open loop frequency.

Returns

Open loop frequency (mHz).

Return type

float

property ol_voltage

Get open loop voltage.

Returns

Open loop voltage (% relative to DC-bus, -1…1).

Return type

float

port

Port number used for connections to the servo.

Type

int

property position

Get actual position.

Returns

Actual position.

Return type

float

property position_res

Get position resolution.

Returns

Position resolution (c/rev/s, c/ppitch/s).

Return type

int

property subnodes

Obtain number of subnodes.

Returns

Current number of subnodes.

Return type

int

property torque

Get actual torque.

Returns

Actual torque.

Return type

float

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

property velocity

Get actual velocity.

Returns

Actual velocity.

Return type

float

property velocity_res

Get velocity resolution.

Returns

Velocity resolution (c/rev, c/ppitch).

Return type

int