Skip to content

Commit

Permalink
Merge pull request #20 from rice-eclipse/dev
Browse files Browse the repository at this point in the history
Add support for heartbeat thread
  • Loading branch information
amyloid8 authored Feb 19, 2023
2 parents 8ef3b50 + 1503efc commit dd67d0a
Show file tree
Hide file tree
Showing 11 changed files with 371 additions and 70 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ name = "slonk"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"
default-run = "slonk"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
24 changes: 18 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ and similar.
## Example timeline

1. Controller and dashboard both start.
The controller begins listening for an incoming connection on its TCP server.
The controller begins listening for an incoming connection on its TCP server.

1. User enters the IP address of the controller, and then presses "Connect to Controller" or similar
button on dashboard.
button on dashboard.

1. Dashboard connects to the specified IP address for the controller.

1. Controller transmits a configuration message immediately.

1. Controller sends a series of status messages containing sensor data, and each is plotted on the
dashboard.
dashboard.

1. User begins an ignition sequence.
Ignition start message is sent to controller.
Ignition start message is sent to controller.

1. Controller completes ignition process.

Expand All @@ -74,7 +74,7 @@ The fields of the main configuration object are as follows:
When a log buffer is full, its data will be flushed into a log file.

- `sensor_groups` - array: A list describing each set of sensors and the threads that manage them.
It also includes calibration information.
It also includes calibration information.

- `pre_ignite_time` - number. The duration of the pre-ignition period in milliseconds.
During pre-ignition, sensors log data at a high frequency, but the ignition procedure has not yet
Expand All @@ -93,13 +93,23 @@ It also includes calibration information.
- `estop_sequence` - array: A list of objects describing each sequential operation to be taken
during the shutoff sequence.

- `pin_heartbeat` - number: The GPIO pin ID of the pin to be lit on and off for the heartbeat light.

### Drivers

Each driver is represented by an object in the `drivers` list.
It will have the following keys:

- `label` - string: A human-readable name for the driver.

- `label_actuate` - string: A human-readable name describing what will happen when the driver is
actuated.
For example, this could be `Open` or `Ignite`.

- `label_deactuate` - string: A human-readable name describing what will happen when the driver is
deactuated.
For example, this could be `Close` or `Shutoff`.

- `pin` - int: The GPIO pin that the driver controls.
Note that the GPIO pin is by software standards, and it is _not_ the phyiscal pinout on the
Raspberry Pi.
Expand Down Expand Up @@ -129,7 +139,7 @@ following fields:
ignition), messages will be sent on a time scale according to how often they were sampled.

- `sensors` - array: The set of sensors. Each sensor will be an object containing the following
keys:
keys:

- `label` - string: The unique identifier for the sensor.
May not be shared across sensor groups.
Expand Down Expand Up @@ -234,6 +244,8 @@ However, it makes the syntax and structure of a configuration apparent.
"drivers": [
{
"label": "OXI_FILL",
"label_actuate": "Open",
"label_deactuate": "Close",
"pin": 33
}
],
Expand Down
194 changes: 194 additions & 0 deletions config/titan-karca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
{
"frequency_status": 10,
"log_buffer_size": 256,
"sensor_groups": [
{
"label": "Thermocouples",
"frequency_standby": 5,
"frequency_ignition": 20,
"frequency_transmission": 5,
"sensors": [
{
"label": "TC1: Oxidizer tank",
"color": "#FC6453",
"units": "°C",
"calibration_intercept": -250,
"calibration_slope": 0.2441,
"adc": 0,
"channel": 0
},
{
"label": "TC2: Combustion chamber",
"color": "#EF3B9E",
"units": "°C",
"calibration_intercept": -250,
"calibration_slope": 0.2441,
"adc": 0,
"channel": 1
}
]
},
{
"label": "Pressure transducers",
"frequency_standby": 5,
"frequency_ignition": 2000,
"frequency_transmission": 5,
"sensors": [
{
"label": "PT1: Combustion chamber",
"units": "psi",
"color": "#EBF927",
"calibration_intercept": -249.8,
"calibration_slope": 0.339,
"rolling_average_width": 10,
"range": [-300, 700],
"adc": 1,
"channel": 0
},
{
"label": "PT2: Oxidizer feedline",
"units": "psi",
"color": "#1D8718",
"calibration_intercept": -249.8,
"calibration_slope": 0.339,
"adc": 1,
"channel": 1
},
{
"label": "PT3: Injector",
"units": "psi",
"color": "#4104D1",
"calibration_intercept": -249.8,
"calibration_slope": 0.339,
"rolling_average_width": 10,
"adc": 1,
"channel": 2
},
{
"label": "PT4: Oxidizer tank",
"color": "#F9864D",
"units": "psi",
"calibration_intercept": -249.8,
"calibration_slope": 0.339,
"adc": 1,
"channel": 3
}
]
},
{
"label": "Load cells",
"frequency_standby": 5,
"frequency_ignition": 2000,
"frequency_transmission": 5,
"sensors": [
{
"label": "Main axial cell",
"color": "#3292FF",
"units": "lb",
"calibration_intercept": -304.38,
"calibration_slope": 0.967,
"adc": 2,
"channel": 0
}
]
}
],
"drivers": [
{
"label": "Feedline",
"label_actuate": "Open",
"label_deactuate": "Close",
"pin": 19,
"protected": false
},
{
"label": "Ox tank vent",
"label_actuate": "Open",
"label_deactuate": "Close",
"pin": 13,
"protected": false
},
{
"label": "Ground vent",
"label_actuate": "Close",
"label_deactuate": "Open",
"pin": 6,
"protected": false
},
{
"label": "Ignition",
"label_actuate": "Ignite",
"label_deactuate": "Shufoff",
"pin": 17,
"protected": true
}
],
"pre_ignite_time": 1000,
"post_ignite_time": 5000,
"ignition_sequence": [
{
"type": "Actuate",
"driver_id": 0,
"value": false
},
{
"type": "Actuate",
"driver_id": 1,
"value": false
},
{
"type": "Actuate",
"driver_id": 2,
"value": true
},
{
"type": "Actuate",
"driver_id": 3,
"value": true
},
{
"type": "Sleep",
"duration": {
"secs": 10,
"nanos": 0
}
},
{
"type": "Actuate",
"driver_id": 3,
"value": false
}
],
"estop_sequence": [
{
"type": "Actuate",
"driver_id": 0,
"value": false
},
{
"type": "Actuate",
"driver_id": 1,
"value": false
},
{
"type": "Actuate",
"driver_id": 2,
"value": true
},
{
"type": "Actuate",
"driver_id": 3,
"value": false
}
],
"spi_mosi": 10,
"spi_miso": 9,
"spi_clk": 11,
"spi_frequency_clk": 100000,
"adc_cs": [
7,
8,
25
],
"pin_heartbeat": 5
}
Loading

0 comments on commit dd67d0a

Please sign in to comment.