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.

Return type

float

Returns

Sample period in seconds.

Raises

ValueError – If divider is less than 1.

map_registers(registers)

Map registers to Disturbance. Disturbance must be disabled.

Parameters

registers (Union[Dict[str, Union[str, int, REG_DTYPE]], List[Dict[str, Union[str, int, REG_DTYPE]]]]) –

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

Return type

float

Returns

Max number of samples

Raises
write_disturbance_data(registers_data)

Write data in mapped registers. Disturbance must be disabled.

Parameters

registers_data (Union[List[Union[int, float, ndarray[Any, dtype[int32]], ndarray[Any, dtype[float64]], List[Union[int, float]]]], ndarray[Any, dtype[int32]], ndarray[Any, dtype[float64]]]) – data to write in disturbance. Registers should have same order as in map_registers().

Raises
  • IMDisturbanceError – If there are no mapped registers or the sampling frequency is not set yet.

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

Return type

None

map_registers_and_write_data(registers)

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

Parameters

registers (Union[Dict[str, Union[str, int, List[float]]], List[Dict[str, Union[str, int, List[float]]]]]) –

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
  • IMDisturbanceError – If the register is not allowed to be mapped as a disturbance register.

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

Return type

None