STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
combined_gui.ActuatorControlWidget Class Reference
Inheritance diagram for combined_gui.ActuatorControlWidget:
[legend]
Collaboration diagram for combined_gui.ActuatorControlWidget:
[legend]

Public Member Functions

 __init__ (self, receiver, str device_ip=None, int device_port=None, parent=None)
 init_ui (self)
 open_pwm_control (self)
 update_label_display (self, actuator_id, text)
 on_label_changed (self, int actuator_id, str text)
 update_actuator_visibility (self)
 on_status_update (self, str message)
 on_sensor_data (self, dict header, List[dict] chunks, str source_ip)
 update_button_highlight (self, int array_idx, int actuator_state)
 set_actuator_state (self, int actuator_id, int gui_state, bool force=False)
 send_actuator_command (self, int actuator_id, int hardware_command)
 update_current_display (self)
 close_socket (self)

Public Attributes

 receiver = receiver
 device_ip = CONFIG.config["network"]["actuator_ip"]
 device_port = CONFIG.config["network"]["actuator_port"]
list actuator_states = [0] * get_num_actuators()
dict actuator_types
 main_window_ref = None
 pwm_window = None
bool manual_control_enabled = False
list voltage_readings = [0.0] * get_num_actuators()
dict actuator_labels
 only_show_actuators_with_roles
 command_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 on_sensor_data
 on_status_update
 update_timer = QtCore.QTimer(self)
 update_current_display
 grid_container = QtWidgets.QWidget()
 grid_layout = QtWidgets.QGridLayout(self.grid_container)
list actuator_widgets = []
 pwm_btn = QtWidgets.QPushButton("PWM CONTROL")
 open_pwm_control

Detailed Description

Reusable actuator control panel. Used in ActuatorControlWindow and CombinedMainWindow.

Definition at line 2283 of file combined_gui.py.

Constructor & Destructor Documentation

◆ __init__()

combined_gui.ActuatorControlWidget.__init__ ( self,
receiver,
str device_ip = None,
int device_port = None,
parent = None )

Definition at line 2286 of file combined_gui.py.

References __init__().

Referenced by __init__().

Member Function Documentation

◆ close_socket()

combined_gui.ActuatorControlWidget.close_socket ( self)
Close the command socket

Definition at line 2753 of file combined_gui.py.

References command_sock.

◆ init_ui()

combined_gui.ActuatorControlWidget.init_ui ( self)
Initialize the user interface

Definition at line 2344 of file combined_gui.py.

◆ on_label_changed()

combined_gui.ActuatorControlWidget.on_label_changed ( self,
int actuator_id,
str text )
Update local actuator label and display (config is written via set_actuator_role in settings).

Definition at line 2544 of file combined_gui.py.

References actuator_labels, only_show_actuators_with_roles, update_actuator_visibility(), and update_label_display().

◆ on_sensor_data()

combined_gui.ActuatorControlWidget.on_sensor_data ( self,
dict header,
List[dict] chunks,
str source_ip )
Handle received sensor data (actuator current-sense voltage readings).

Definition at line 2602 of file combined_gui.py.

References combined_gui.actuator_counts_to_volts(), actuator_testing_gui.ActuatorTestingWindow.device_ip, device_ip, combined_gui.get_num_actuators(), and voltage_readings.

◆ on_status_update()

combined_gui.ActuatorControlWidget.on_status_update ( self,
str message )
Handle status updates from receiver thread

Definition at line 2598 of file combined_gui.py.

◆ open_pwm_control()

combined_gui.ActuatorControlWidget.open_pwm_control ( self)
Open the PWM control window, creating it lazily.

Definition at line 2523 of file combined_gui.py.

References main_window_ref, combined_gui.SensorPlotWidget.main_window_ref, open_pwm_control, and pwm_window.

Referenced by combined_gui.SensorPlotWidget.on_navigation_requested().

◆ send_actuator_command()

combined_gui.ActuatorControlWidget.send_actuator_command ( self,
int actuator_id,
int hardware_command )
Send an actuator command packet to the device.
hardware_command: 0 = OFF, 1 = ON (hardware level)

Definition at line 2716 of file combined_gui.py.

References actuator_states, command_sock, combined_gui.create_actuator_command_packet(), actuator_testing_gui.ActuatorTestingWindow.device_ip, device_ip, actuator_testing_gui.ActuatorTestingWindow.device_port, and device_port.

Referenced by set_actuator_state().

◆ set_actuator_state()

combined_gui.ActuatorControlWidget.set_actuator_state ( self,
int actuator_id,
int gui_state,
bool force = False )
Set actuator state and send command packet.
gui_state: 0 = CLOSED, 1 = OPEN (from GUI button)
force: If True, bypass manual control lock (used by state machine)
Converts to hardware command based on NC/NO type:
- NC: OPEN (1) -> hardware ON (1), CLOSED (0) -> hardware OFF (0)
- NO: OPEN (1) -> hardware OFF (0), CLOSED (0) -> hardware ON (1)

Definition at line 2678 of file combined_gui.py.

References actuator_labels, actuator_states, actuator_types, main_window_ref, combined_gui.SensorPlotWidget.main_window_ref, manual_control_enabled, send_actuator_command(), and update_button_highlight().

◆ update_actuator_visibility()

combined_gui.ActuatorControlWidget.update_actuator_visibility ( self)
Update visibility of actuator widgets based on whether they have roles.
When filtering is enabled, reflow visible actuators in order: row1 vents, row2 press, row3 mains; col1 fuel, col2 lox.

Definition at line 2552 of file combined_gui.py.

References actuator_widgets, combined_gui.get_num_actuators(), grid_layout, and only_show_actuators_with_roles.

Referenced by on_label_changed().

◆ update_button_highlight()

combined_gui.ActuatorControlWidget.update_button_highlight ( self,
int array_idx,
int actuator_state )
Update button highlighting based on actuator state. Selected OPEN = saturated green, selected CLOSED = saturated red.

Definition at line 2630 of file combined_gui.py.

References actuator_widgets.

Referenced by set_actuator_state().

◆ update_current_display()

combined_gui.ActuatorControlWidget.update_current_display ( self)
Update the voltage reading display for all actuators

Definition at line 2746 of file combined_gui.py.

References actuator_widgets, combined_gui.get_num_actuators(), and voltage_readings.

◆ update_label_display()

combined_gui.ActuatorControlWidget.update_label_display ( self,
actuator_id,
text )
External method to update label display when changed in settings

Definition at line 2537 of file combined_gui.py.

References actuator_widgets.

Referenced by on_label_changed().

Member Data Documentation

◆ actuator_labels

dict combined_gui.ActuatorControlWidget.actuator_labels
Initial value:
= {
i: CONFIG.get_actuator_label(i) for i in range(1, get_num_actuators() + 1)
}

Definition at line 2320 of file combined_gui.py.

Referenced by on_label_changed(), and set_actuator_state().

◆ actuator_states

list combined_gui.ActuatorControlWidget.actuator_states = [0] * get_num_actuators()

Definition at line 2297 of file combined_gui.py.

Referenced by send_actuator_command(), and set_actuator_state().

◆ actuator_types

dict combined_gui.ActuatorControlWidget.actuator_types
Initial value:
= {
i: CONFIG.get_actuator_type_by_id(i)
for i in range(1, get_num_actuators() + 1)
}

Definition at line 2301 of file combined_gui.py.

Referenced by set_actuator_state().

◆ actuator_widgets

list combined_gui.ActuatorControlWidget.actuator_widgets = []

◆ command_sock

◆ device_ip

◆ device_port

combined_gui.ActuatorControlWidget.device_port = CONFIG.config["network"]["actuator_port"]

◆ grid_container

combined_gui.ActuatorControlWidget.grid_container = QtWidgets.QWidget()

Definition at line 2352 of file combined_gui.py.

◆ grid_layout

combined_gui.ActuatorControlWidget.grid_layout = QtWidgets.QGridLayout(self.grid_container)

Definition at line 2353 of file combined_gui.py.

Referenced by update_actuator_visibility().

◆ main_window_ref

combined_gui.ActuatorControlWidget.main_window_ref = None

Definition at line 2307 of file combined_gui.py.

Referenced by open_pwm_control(), and set_actuator_state().

◆ manual_control_enabled

bool combined_gui.ActuatorControlWidget.manual_control_enabled = False

Definition at line 2313 of file combined_gui.py.

Referenced by set_actuator_state().

◆ on_sensor_data

combined_gui.ActuatorControlWidget.on_sensor_data

Definition at line 2336 of file combined_gui.py.

◆ on_status_update

combined_gui.ActuatorControlWidget.on_status_update

Definition at line 2337 of file combined_gui.py.

◆ only_show_actuators_with_roles

combined_gui.ActuatorControlWidget.only_show_actuators_with_roles
Initial value:
= disp.get(
"only_show_actuators_with_roles", False
)

Definition at line 2326 of file combined_gui.py.

Referenced by on_label_changed(), and update_actuator_visibility().

◆ open_pwm_control

combined_gui.ActuatorControlWidget.open_pwm_control

◆ pwm_btn

combined_gui.ActuatorControlWidget.pwm_btn = QtWidgets.QPushButton("PWM CONTROL")

Definition at line 2475 of file combined_gui.py.

◆ pwm_window

combined_gui.ActuatorControlWidget.pwm_window = None

Definition at line 2310 of file combined_gui.py.

Referenced by open_pwm_control().

◆ receiver

◆ update_current_display

combined_gui.ActuatorControlWidget.update_current_display

Definition at line 2341 of file combined_gui.py.

◆ update_timer

combined_gui.ActuatorControlWidget.update_timer = QtCore.QTimer(self)

◆ voltage_readings

list combined_gui.ActuatorControlWidget.voltage_readings = [0.0] * get_num_actuators()

Definition at line 2317 of file combined_gui.py.

Referenced by on_sensor_data(), and update_current_display().


The documentation for this class was generated from the following file: