Servo

class ingenialink.ethernet.servo.EthernetServo(cffi_servo, cffi_net, target, port, communication_protocol, dictionary_path=None)[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.

destroy()

Destroy servo instance.

Returns

Result code.

Return type

int

disable(subnode=1)

Disable PDS.

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_remove_all_mapped_registers()

Remove all disturbance mapped registers.

Returns

Return code.

Return type

int

disturbance_set_mapped_register(channel, address, dtype)

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(timeout=2.0, subnode=1)

Enable PDS.

Parameters
  • timeout (int, float, optional) – Timeout (s).

  • subnode (int, optional) – Subnode.

fault_reset(subnode=1)

Fault reset.

Parameters

subnode (int, optional) – Subnode.

get_reg(reg, subnode)

Obtain Register object and its identifier.

Parameters
  • reg (IPBRegister, str) – Register.

  • subnode (int) – Subnode.

Returns

Actual Register instance and its

identifier.

Return type

tuple (Register, string)

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(dictionary, subnode=0)

Load configuration from dictionary file to the servo drive.

Parameters
  • dictionary (str) – Dictionary.

  • subnode (int, optional) – 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_set_mapped_register(channel, reg_idx, dtype)

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 (Register) – 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 (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.

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.

reset()

Reset servo.

Notes

You may need to reconnect the network after reset.

restore_parameters()

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

Raises
save_configuration(new_path, subnode=0)
Read all dictionary registers content and save it to a

new dictionary.

Parameters

new_path (str) – Dictionary.

state_subs_stop(stop)

Stop servo state subscriptions.

Parameters

stop (int) – start: 0, stop: 1.

Returns

Result code.

Return type

int

store_app()

Store all servo current application parameters to the NVM.

store_comm()

Store all servo current communications to the NVM.

store_parameters(subnode=0)

Store all the current parameters of the target subnode.

Parameters

subnode (int) – Subnode of the axis.

Raises
subscribe_to_status(callback)

Subscribe to state changes.

Parameters

callback – Callback

Returns

Assigned slot.

Return type

int

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

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

units_factor(reg)

Obtain units scale factor for the given register.

Parameters

reg (Register) – 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(slot)

Unsubscribe from state changes.

Parameters

slot (int) – Assigned slot when subscribed.

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

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

Obtain servo information.

Returns

Servo information.

Return 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