Disturbance

class ingeniamotion.disturbance.Disturbance(mc, servo='default')

Class to configure a disturbance in a servo.

Parameters
  • mc (MotionController) – MotionController instance.

  • servo (str) – servo alias to reference it. default by default.

set_frequency_divider(divider)

Function to define disturbance frequency with a prescaler. Frequency will be Position & velocity loop rate frequency / prescaler, see ingeniamotion.configuration.Configuration.get_position_and_velocity_loop_rate() to know about this frequency. Monitoring/Disturbance must be disabled.

Parameters

divider (int) – determines disturbance frequency. It must be 1 or higher.

Returns

sample period in seconds.

Return type

float

Raises

ValueError – If divider is less than 1.

map_registers(registers)

Map registers to Disturbance. Disturbance must be disabled.

Parameters

registers (dict or list of dict) –

registers to map. Each register must be a dict with two keys.

{
    "name": "CL_POS_SET_POINT_VALUE",  # Register name.
    "axis": 1  # Register axis. If it has no axis field, by default axis 1.
}

Returns

max number of samples

Return type

int

Raises

DisturbanceError – If the register is not allowed to be mapped as a disturbance register.

write_disturbance_data(registers_data)

Write data in mapped registers. Disturbance must be disabled.

Parameters

registers_data (list of (list or float or int)) – data to write in disturbance. Registers should have same order as in map_registers().

Raises

DisturbanceError – If buffer size is not enough for all the registers and samples.

map_registers_and_write_data(registers)

Map registers to Disturbance and write data. Disturbance must be disabled.

Parameters

registers (dict or list of dict) –

registers to map and write data. Each register must be a dict with three keys:

{
    "name": "CL_POS_SET_POINT_VALUE",  # Register name.
    "axis": 1,  # Register axis. If it has no axis field, by default axis 1.
    "data": [0.0, 0.1, 0.2, ...]  # Data for load in this register
}

Raises
  • DisturbanceError – If the register is not allowed to be mapped as a disturbance register.

  • DisturbanceError – If buffer size is not enough for all the registers and samples.

enable_disturbance()

Enable disturbance

Raises

DisturbanceError – If disturbance can’t be enabled.

disable_disturbance()

Disable disturbance

get_monitoring_disturbance_status()

Get Monitoring/Disturbance Status.

Returns

Monitoring/Disturbance Status.

Return type

int

is_disturbance_enabled()

Check if disturbance is enabled.

Returns

True if disturbance is enabled, else False.

Return type

bool

get_max_sample_size()

Return disturbance max size, in bytes.

Returns

Max buffer size in bytes.

Return type

int

exception ingeniamotion.disturbance.DisturbanceError