STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
actuator_testing_gui Namespace Reference

Classes

class  PacketType
class  BoardState
class  SensorReceiver
class  ActuatorTestingWindow

Functions

float actuator_counts_to_volts (int data_u32)
str board_state_name (int state)
Optional[Tuple[int, int, int]] parse_packet_header (bytes data)
Optional[Tuple[tuple, bytes, int, int, int]] parse_board_heartbeat_packet (bytes data)
Optional[Tuple[dict, List[dict]]] parse_sensor_data_packet (bytes data)
bytes _make_header (int packet_type)
bytes build_server_heartbeat_packet ()
bytes build_minimal_actuator_config_packet ()
bytes create_actuator_command_packet (List[Tuple[int, int]] commands)
 main ()

Variables

int DIABLO_COMMS_VERSION = 0
int MAX_PACKET_SIZE = 512
str PACKET_HEADER_FORMAT = "<BBI"
int PACKET_HEADER_SIZE = 6
tuple BOARD_HEARTBEAT_BODY_FORMAT
int BOARD_HEARTBEAT_BODY_SIZE = 35
str SENSOR_DATA_PACKET_FORMAT = "<BB"
int SENSOR_DATA_PACKET_SIZE = 2
str SENSOR_DATA_CHUNK_FORMAT = "<I"
int SENSOR_DATA_CHUNK_SIZE = 4
str SENSOR_DATAPOINT_FORMAT = "<BI"
int SENSOR_DATAPOINT_SIZE = 5
int ACT_ADC_MAX = 4095
float ACT_ADC_VREF = 3.3
str ACTUATOR_COMMAND_PACKET_FORMAT = "<B"
int ACTUATOR_COMMAND_PACKET_SIZE = 1
str ACTUATOR_COMMAND_FORMAT = "<BB"
int ACTUATOR_COMMAND_SIZE = 2
int NUM_ACTUATORS = 10
str DEFAULT_ACTUATOR_IP = "192.168.2.11"
int ACTUATOR_COMMAND_PORT = 5005
int SENSOR_RECEIVE_PORT = 5006
float WINDOW_SECONDS = 10.0
int UPDATE_INTERVAL_MS = 100
int MAX_POINTS = 50000
float HEARTBEAT_TIMEOUT_SEC = 2.5
int HEARTBEAT_RATE_WINDOW = 20
int SERVER_HEARTBEAT_INTERVAL_MS = 500
list SENSOR_COLORS

Function Documentation

◆ _make_header()

bytes actuator_testing_gui._make_header ( int packet_type)
protected

◆ actuator_counts_to_volts()

float actuator_testing_gui.actuator_counts_to_volts ( int data_u32)
Actuator current-sense datapoint -> volts.

Boards send raw 12-bit counts (<= 4095). Firmware from before that sent
float volts as bits; any nonzero voltage float encodes far above 4095, so
those are still read as floats until every board is reflashed.

Definition at line 46 of file actuator_testing_gui.py.

◆ board_state_name()

str actuator_testing_gui.board_state_name ( int state)

Definition at line 92 of file actuator_testing_gui.py.

◆ build_minimal_actuator_config_packet()

bytes actuator_testing_gui.build_minimal_actuator_config_packet ( )
DAQv2-Comms ACTUATOR_CONFIG: not abort controller, no actuators/PTs, serial printing on.

Definition at line 221 of file actuator_testing_gui.py.

References _make_header().

Referenced by actuator_testing_gui.ActuatorTestingWindow._send_minimal_actuator_config().

◆ build_server_heartbeat_packet()

bytes actuator_testing_gui.build_server_heartbeat_packet ( )
Server heartbeat: header + 1 byte engine_state (0 = SAFE).

Definition at line 216 of file actuator_testing_gui.py.

References _make_header().

Referenced by actuator_testing_gui.ActuatorTestingWindow._send_server_heartbeat_once().

◆ create_actuator_command_packet()

bytes actuator_testing_gui.create_actuator_command_packet ( List[Tuple[int, int]] commands)
commands: list of (actuator_id, state) where id is 1-10, state 0/1.

Definition at line 231 of file actuator_testing_gui.py.

References time.time().

Referenced by actuator_testing_gui.ActuatorTestingWindow.on_actuator_toggled().

◆ main()

actuator_testing_gui.main ( void )

Definition at line 762 of file actuator_testing_gui.py.

References main().

◆ parse_board_heartbeat_packet()

Optional[Tuple[tuple, bytes, int, int, int]] actuator_testing_gui.parse_board_heartbeat_packet ( bytes data)

Definition at line 134 of file actuator_testing_gui.py.

References parse_packet_header().

Referenced by actuator_testing_gui.SensorReceiver.run().

◆ parse_packet_header()

Optional[Tuple[int, int, int]] actuator_testing_gui.parse_packet_header ( bytes data)

◆ parse_sensor_data_packet()

Optional[Tuple[dict, List[dict]]] actuator_testing_gui.parse_sensor_data_packet ( bytes data)

Definition at line 152 of file actuator_testing_gui.py.

References parse_packet_header().

Referenced by actuator_testing_gui.SensorReceiver.run().

Variable Documentation

◆ ACT_ADC_MAX

int actuator_testing_gui.ACT_ADC_MAX = 4095

Definition at line 42 of file actuator_testing_gui.py.

◆ ACT_ADC_VREF

float actuator_testing_gui.ACT_ADC_VREF = 3.3

Definition at line 43 of file actuator_testing_gui.py.

◆ ACTUATOR_COMMAND_FORMAT

str actuator_testing_gui.ACTUATOR_COMMAND_FORMAT = "<BB"

Definition at line 60 of file actuator_testing_gui.py.

◆ ACTUATOR_COMMAND_PACKET_FORMAT

str actuator_testing_gui.ACTUATOR_COMMAND_PACKET_FORMAT = "<B"

Definition at line 58 of file actuator_testing_gui.py.

◆ ACTUATOR_COMMAND_PACKET_SIZE

int actuator_testing_gui.ACTUATOR_COMMAND_PACKET_SIZE = 1

Definition at line 59 of file actuator_testing_gui.py.

◆ ACTUATOR_COMMAND_PORT

int actuator_testing_gui.ACTUATOR_COMMAND_PORT = 5005

Definition at line 66 of file actuator_testing_gui.py.

◆ ACTUATOR_COMMAND_SIZE

int actuator_testing_gui.ACTUATOR_COMMAND_SIZE = 2

Definition at line 61 of file actuator_testing_gui.py.

◆ BOARD_HEARTBEAT_BODY_FORMAT

tuple actuator_testing_gui.BOARD_HEARTBEAT_BODY_FORMAT
Initial value:
1= (
2 "<32sBBB" # firmware_hash[32], board_id, engine_state, board_state
3)

Definition at line 29 of file actuator_testing_gui.py.

◆ BOARD_HEARTBEAT_BODY_SIZE

int actuator_testing_gui.BOARD_HEARTBEAT_BODY_SIZE = 35

Definition at line 32 of file actuator_testing_gui.py.

◆ DEFAULT_ACTUATOR_IP

str actuator_testing_gui.DEFAULT_ACTUATOR_IP = "192.168.2.11"

Definition at line 65 of file actuator_testing_gui.py.

◆ DIABLO_COMMS_VERSION

int actuator_testing_gui.DIABLO_COMMS_VERSION = 0

Definition at line 14 of file actuator_testing_gui.py.

◆ HEARTBEAT_RATE_WINDOW

int actuator_testing_gui.HEARTBEAT_RATE_WINDOW = 20

Definition at line 74 of file actuator_testing_gui.py.

◆ HEARTBEAT_TIMEOUT_SEC

float actuator_testing_gui.HEARTBEAT_TIMEOUT_SEC = 2.5

Definition at line 73 of file actuator_testing_gui.py.

◆ MAX_PACKET_SIZE

int actuator_testing_gui.MAX_PACKET_SIZE = 512

Definition at line 15 of file actuator_testing_gui.py.

◆ MAX_POINTS

int actuator_testing_gui.MAX_POINTS = 50000

Definition at line 71 of file actuator_testing_gui.py.

◆ NUM_ACTUATORS

int actuator_testing_gui.NUM_ACTUATORS = 10

Definition at line 63 of file actuator_testing_gui.py.

◆ PACKET_HEADER_FORMAT

str actuator_testing_gui.PACKET_HEADER_FORMAT = "<BBI"

Definition at line 26 of file actuator_testing_gui.py.

◆ PACKET_HEADER_SIZE

int actuator_testing_gui.PACKET_HEADER_SIZE = 6

Definition at line 27 of file actuator_testing_gui.py.

◆ SENSOR_COLORS

list actuator_testing_gui.SENSOR_COLORS
Initial value:
1= [
2 (255, 80, 80),
3 (80, 255, 80),
4 (80, 150, 255),
5 (255, 200, 80),
6 (200, 80, 255),
7 (80, 255, 255),
8 (255, 150, 150),
9 (150, 255, 150),
10 (150, 200, 255),
11 (255, 255, 80),
12]

Definition at line 108 of file actuator_testing_gui.py.

◆ SENSOR_DATA_CHUNK_FORMAT

str actuator_testing_gui.SENSOR_DATA_CHUNK_FORMAT = "<I"

Definition at line 36 of file actuator_testing_gui.py.

◆ SENSOR_DATA_CHUNK_SIZE

int actuator_testing_gui.SENSOR_DATA_CHUNK_SIZE = 4

Definition at line 37 of file actuator_testing_gui.py.

◆ SENSOR_DATA_PACKET_FORMAT

str actuator_testing_gui.SENSOR_DATA_PACKET_FORMAT = "<BB"

Definition at line 34 of file actuator_testing_gui.py.

◆ SENSOR_DATA_PACKET_SIZE

int actuator_testing_gui.SENSOR_DATA_PACKET_SIZE = 2

Definition at line 35 of file actuator_testing_gui.py.

◆ SENSOR_DATAPOINT_FORMAT

str actuator_testing_gui.SENSOR_DATAPOINT_FORMAT = "<BI"

Definition at line 38 of file actuator_testing_gui.py.

◆ SENSOR_DATAPOINT_SIZE

int actuator_testing_gui.SENSOR_DATAPOINT_SIZE = 5

Definition at line 39 of file actuator_testing_gui.py.

◆ SENSOR_RECEIVE_PORT

int actuator_testing_gui.SENSOR_RECEIVE_PORT = 5006

Definition at line 67 of file actuator_testing_gui.py.

◆ SERVER_HEARTBEAT_INTERVAL_MS

int actuator_testing_gui.SERVER_HEARTBEAT_INTERVAL_MS = 500

Definition at line 75 of file actuator_testing_gui.py.

◆ UPDATE_INTERVAL_MS

int actuator_testing_gui.UPDATE_INTERVAL_MS = 100

Definition at line 70 of file actuator_testing_gui.py.

◆ WINDOW_SECONDS

float actuator_testing_gui.WINDOW_SECONDS = 10.0

Definition at line 69 of file actuator_testing_gui.py.