Monitoring¶
-
class
ingeniamotion.monitoring.base_monitoring.
Monitoring
(mc, servo='default')¶ Class to configure a monitoring in a servo.
- Parameters
mc (MotionController) – MotionController instance.
servo (str) – servo alias to reference it.
default
by default.
-
set_frequency
(prescaler)¶ Function to define monitoring frequency with a prescaler. Frequency will be
Position & velocity loop rate frequency / prescaler
, seeingeniamotion.configuration.Configuration.get_position_and_velocity_loop_rate()
to know about this frequency. Monitoring must be disabled.- Parameters
prescaler (int) – determines monitoring frequency. It must be
1
or higher.- Raises
ValueError – If prescaler is less than
1
.
-
map_registers
(registers)¶ Map registers to monitoring. Monitoring must be disabled.
- Parameters
registers (list of dict) –
List of registers to map. Each register must be a dict with two keys:
{ "name": "CL_POS_FBK_VALUE", # Register name. "axis": 1 # Register axis. # If it has no axis field, by default axis 1. }
- Raises
IMMonitoringError – If register maps fails in the servo.
IMMonitoringError – If buffer size is not enough for all the registers.
-
abstract
set_trigger
(trigger_mode, edge_condition=None, trigger_signal=None, trigger_value=None)¶ Configure monitoring trigger. Monitoring must be disabled.
- Parameters
trigger_mode (MonitoringSoCType) – monitoring start of condition type.
edge_condition (MonitoringSoCConfig) – edge event type.
None
by default.trigger_signal (dict) – dict with name and axis of trigger signal for rising or falling edge trigger.
None
by default.trigger_value (int or float) – value for rising or falling edge trigger.
None
by default.
- Raises
TypeError – If trigger_mode is trigger event edge and edge_condition, trigger_signal or trigger_value are None.
IMMonitoringError – If trigger signal is not mapped.
-
abstract
configure_number_samples
(total_num_samples, trigger_delay_samples)¶ Configure monitoring number of samples. Monitoring must be disabled.
- Parameters
- Raises
ValueError – If trigger_delay_samples is less than
0
or higher than total_num_samples.IMMonitoringError – If buffer size is not enough for all the samples.
-
configure_sample_time
(total_time, trigger_delay)¶ Configure monitoring number of samples defines by sample and trigger delay time. Monitoring must be disabled.
- Parameters
- Raises
ValueError – If trigger_delay is not between
-total_time/2
andtotal_time/2
.IMMonitoringError – If buffer size is not enough for all the samples.
-
read_monitoring_data
(timeout=None, progress_callback=None)¶ Blocking function that read the monitoring data.
- Parameters
timeout (float) – maximum time trigger is waited, in seconds.
None
by default.- Returns
data of monitoring. Each element of the list is a different register data.
- Return type
list of list
-
stop_reading_data
()¶ Stops read_monitoring_data function.
-
abstract
rearm_monitoring
()¶ Rearm monitoring.
-
get_trigger_type
()¶ Get monitoring trigger type.
- Returns
trigger type
- Return type
-
raise_forced_trigger
(blocking=False, timeout=5)¶ Raise trigger for Forced Trigger type.
-
read_monitoring_data_forced_trigger
(trigger_timeout=5)¶ Trigger and read Forced Trigger monitoring.
- Parameters
trigger_timeout (float) – maximum time function wait to raise the trigger, in seconds.
5
by default.- Returns
data of monitoring. Each element of the list is a different register data.
- Return type
list of list