|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | ValvePanel |
| class | BallValveGui |
Functions | |
| bytes | _header (int packet_type) |
| bytes | build_server_heartbeat () |
| bytes | build_actuator_command (int actuator_id, int state) |
| parse_board_heartbeat (bytes data) | |
| parse_sensor_data (bytes data) | |
| main () | |
Variables | |
| int | DIABLO_COMMS_VERSION = 0 |
| str | PACKET_HEADER_FORMAT = "<BBI" |
| int | PACKET_HEADER_SIZE = 6 |
| int | BOARD_HEARTBEAT = 1 |
| int | SERVER_HEARTBEAT = 2 |
| int | SENSOR_DATA = 3 |
| int | ACTUATOR_COMMAND = 4 |
| str | BOARD_HEARTBEAT_BODY_FORMAT = "<32sBBB" |
| int | BOARD_HEARTBEAT_BODY_SIZE = 35 |
| dict | BOARD_STATES = {1: "SETUP", 2: "ACTIVE"} |
| str | SENSOR_DATAPOINT_FORMAT = "<BI" |
| int | SENSOR_DATAPOINT_SIZE = 5 |
| int | VALVE_BOARD_ID = 71 |
| list | VALVES = [(1, 1), (2, 2)] |
| float | POSITION_SHUNT_OHMS = 100.0 |
| float | ADC_MAX = 4095.0 |
| float | ADC_VREF = 3.3 |
| str | DEFAULT_BOARD_IP = "192.168.2.71" |
| int | COMMAND_PORT = 5005 |
| int | LISTEN_PORT = 5006 |
| int | SERVER_HEARTBEAT_INTERVAL_MS = 500 |
| float | BOARD_SILENT_SEC = 2.5 |
| int | POLL_MS = 50 |
Ball Valve GUI — open/close the BallValve_Hotfire board's two valves over
Ethernet and watch their positions.
Sends DAQv2 packets to firmware/Hotfire_Code/BallValve_Hotfire on UDP 5005:
- SERVER_HEARTBEAT every 500 ms while "Heartbeats" is running. The board
only leaves the open state with a current heartbeat, and OPENS the valve
5 s after they stop (its safe state: 20 mA), so stopping heartbeats or
closing this window opens every valve.
- ACTUATOR_COMMAND (actuator_id 1 or 2): state 1 = open (20 mA), 0 = closed.
Listens on UDP 5006 for the board's BOARD_HEARTBEAT (alive, and ACTIVE when it
hears our heartbeats) and SENSOR_DATA (sensor_id 1, 2: raw 12-bit ADC counts of
each valve's 100 ohm position shunt; V = counts / 4095 * 3.3, 4-20 mA = 0.4-2.0 V).
Your computer needs an address on the board's subnet, e.g. 192.168.2.20/24.
python ball_valve_gui.py [--ip 192.168.2.71]
|
protected |
Definition at line 63 of file ball_valve_gui.py.
References time.time().
Referenced by build_actuator_command(), and build_server_heartbeat().
| bytes ball_valve_gui.build_actuator_command | ( | int | actuator_id, |
| int | state ) |
Definition at line 72 of file ball_valve_gui.py.
References _header().
Referenced by ball_valve_gui.BallValveGui.command().
| bytes ball_valve_gui.build_server_heartbeat | ( | ) |
Definition at line 68 of file ball_valve_gui.py.
References _header().
Referenced by ball_valve_gui.BallValveGui.send_server_heartbeat().
| ball_valve_gui.main | ( | void | ) |
Definition at line 417 of file ball_valve_gui.py.
References main().
| ball_valve_gui.parse_board_heartbeat | ( | bytes | data | ) |
Return (board_id, board_state, firmware_hash) or None.
Definition at line 77 of file ball_valve_gui.py.
Referenced by ball_valve_gui.BallValveGui.on_board_heartbeat().
| ball_valve_gui.parse_sensor_data | ( | bytes | data | ) |
Return {sensor_id: raw value} from the last chunk of a SENSOR_DATA packet.
Definition at line 89 of file ball_valve_gui.py.
Referenced by ball_valve_gui.BallValveGui.poll_socket().
| int ball_valve_gui.ACTUATOR_COMMAND = 4 |
Definition at line 38 of file ball_valve_gui.py.
| float ball_valve_gui.ADC_MAX = 4095.0 |
Definition at line 52 of file ball_valve_gui.py.
| float ball_valve_gui.ADC_VREF = 3.3 |
Definition at line 53 of file ball_valve_gui.py.
| int ball_valve_gui.BOARD_HEARTBEAT = 1 |
Definition at line 35 of file ball_valve_gui.py.
| str ball_valve_gui.BOARD_HEARTBEAT_BODY_FORMAT = "<32sBBB" |
Definition at line 40 of file ball_valve_gui.py.
| int ball_valve_gui.BOARD_HEARTBEAT_BODY_SIZE = 35 |
Definition at line 41 of file ball_valve_gui.py.
| float ball_valve_gui.BOARD_SILENT_SEC = 2.5 |
Definition at line 59 of file ball_valve_gui.py.
| dict ball_valve_gui.BOARD_STATES = {1: "SETUP", 2: "ACTIVE"} |
Definition at line 42 of file ball_valve_gui.py.
| int ball_valve_gui.COMMAND_PORT = 5005 |
Definition at line 55 of file ball_valve_gui.py.
| str ball_valve_gui.DEFAULT_BOARD_IP = "192.168.2.71" |
Definition at line 54 of file ball_valve_gui.py.
| int ball_valve_gui.DIABLO_COMMS_VERSION = 0 |
Definition at line 31 of file ball_valve_gui.py.
| int ball_valve_gui.LISTEN_PORT = 5006 |
Definition at line 56 of file ball_valve_gui.py.
| str ball_valve_gui.PACKET_HEADER_FORMAT = "<BBI" |
Definition at line 32 of file ball_valve_gui.py.
| int ball_valve_gui.PACKET_HEADER_SIZE = 6 |
Definition at line 33 of file ball_valve_gui.py.
| int ball_valve_gui.POLL_MS = 50 |
Definition at line 60 of file ball_valve_gui.py.
| float ball_valve_gui.POSITION_SHUNT_OHMS = 100.0 |
Definition at line 51 of file ball_valve_gui.py.
| int ball_valve_gui.SENSOR_DATA = 3 |
Definition at line 37 of file ball_valve_gui.py.
| str ball_valve_gui.SENSOR_DATAPOINT_FORMAT = "<BI" |
Definition at line 44 of file ball_valve_gui.py.
| int ball_valve_gui.SENSOR_DATAPOINT_SIZE = 5 |
Definition at line 45 of file ball_valve_gui.py.
| int ball_valve_gui.SERVER_HEARTBEAT = 2 |
Definition at line 36 of file ball_valve_gui.py.
| int ball_valve_gui.SERVER_HEARTBEAT_INTERVAL_MS = 500 |
Definition at line 58 of file ball_valve_gui.py.
| int ball_valve_gui.VALVE_BOARD_ID = 71 |
Definition at line 47 of file ball_valve_gui.py.
| list ball_valve_gui.VALVES = [(1, 1), (2, 2)] |
Definition at line 50 of file ball_valve_gui.py.