Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
8 changes: 0 additions & 8 deletions .github/actions/common/setup-rust-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ runs:
workspaces: |
. -> target

- name: Cache Rustup Toolchains
uses: actions/cache@v3
with:
path: |
~/.rustup/toolchains/
~/.rustup/update-hashes/
key: ${{ runner.os }}-rustup-stable-thumbv7em-none-eabihf

- name: Disable man-db (skip Manual Page Installs)
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/argus-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
working-directory: boards/argus

- name: Check for Clippy Warnings
run: cargo clippy -p argus --all-features --no-deps
run: cargo clippy -p argus --features temperature --no-deps
working-directory: boards/argus

build_pressure:
Expand Down
21 changes: 16 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
{
// Formatting
"editor.detectIndentation": true,
// Default cargo target is for embedded. Use Rust Target extension to dynamically change it based on project.
"rust-analyzer.cargo.target": "thumbv7em-none-eabihf",
"editor.formatOnSave": true,
// Rust Settings
"rust-analyzer.cargo.target": "thumbv7em-none-eabihf", // Default cargo target is for embedded. Use Rust Target extension to dynamically change it based on project.
"rust-analyzer.cargo.features": [
"pressure",
"strain",
"temperature"
],
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
"editor.defaultFormatter": "rust-lang.rust-analyzer",
},
// Python Settings
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python-envs.pythonProjects": [],
"python.analysis.extraPaths": [
"common/messages/python"
],
"protoc": {
"options": [
"--proto_path=${workspaceRoot}/common/messages/proto",
"--python_out=${workspaceRoot}/common/messages/python",
]
},
// Spelling
"cSpell.words": [
"uorocketry"
]
Expand Down
101 changes: 1 addition & 100 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed apps/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion apps/argus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Make sure you have `uv` installed: `pipx install uv`
## Running
Ensure `grafana` and `persistence` services are running by calling `docker compose up -d` within their respective directories.

Find out which port your UART-to-USB adapter is mounted on and run the argus service by calling `uv run main.py <port>`.
Find out which port your UART-to-USB adapter is mounted on and run the argus service by calling `uv run argus/main.py <port>`.

Once argus is connected and you're seeing logs of data stream coming in, you can open up grafana at `http://localhost:3000` and import one of the dashboards from `apps/grafana/dashboards` that is configured to connect to the `postgres` service defined in `persistence/docker-compose.yml` and you can see the logs coming in.

Expand Down
45 changes: 42 additions & 3 deletions apps/argus/argus/dtos.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
# Temperature
from models.thermocouple_reading import ThermocoupleReading
from argus.temperature.thermocouple_reading_pb2 import (
from messages.argus.temperature.thermocouple_reading_pb2 import (
ThermocoupleReading as ThermocoupleReadingProto,
)

message_type_to_model = {
ThermocoupleReadingProto: ThermocoupleReading,
# Pressure
from models.pressure_reading import PressureReading
from messages.argus.pressure.pressure_reading_pb2 import (
PressureReading as PressureReadingProto,
)

# Strain
from models.strain_reading import StrainReading
from messages.argus.strain.strain_reading_pb2 import (
StrainReading as StrainReadingProto,
)

proto_to_model = {
ThermocoupleReadingProto: lambda proto: ThermocoupleReading(
local_session=proto.local_session,
adc_device=proto.adc_device,
thermocouple_channel=proto.thermocouple_channel,
recorded_at=int(proto.recorded_at),
voltage=proto.voltage,
compensated_temperature=proto.compensated_temperature,
uncompensated_temperature=proto.uncompensated_temperature,
cold_junction_temperature=proto.cold_junction_temperature,
),
PressureReadingProto: lambda proto: PressureReading(
local_session=proto.local_session,
adc_device=proto.adc_device,
pressure_channel=proto.pressure_channel,
recorded_at=int(proto.recorded_at),
voltage=proto.voltage,
pressure=proto.pressure,
temperature=proto.temperature,
),
StrainReadingProto: lambda proto: StrainReading(
local_session=proto.local_session,
adc_device=proto.adc_device,
strain_channel=proto.strain_channel,
recorded_at=int(proto.recorded_at),
voltage=proto.voltage,
strain=proto.strain,
),
}
6 changes: 3 additions & 3 deletions apps/argus/argus/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
import argparse
import contextlib
import utils.logger
import messages.argus
from services.persistence_service import PersistenceService
from services.protobuf_serial_service import ProtobufSerialService
from services.grpc_service import GrpcService
from services.argus_service import ArgusService
from services.message_ingestion_service import MessageIngestionService
from services.session_service import SessionService

# from argus.envelope_pb2 import Envelope
# from argus.temperature.thermocouple_calibration_pb2 import ThermocoupleCalibration
from utils.database import database

program = argparse.ArgumentParser(description="Argus Ground Station Application")

Expand All @@ -19,6 +18,7 @@


async def main():
database.evolve()
args = program.parse_args()
session_service = SessionService()
session_service.start_session()
Expand Down
44 changes: 44 additions & 0 deletions apps/argus/argus/models/pressure_reading.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from datetime import datetime
from peewee import (
Model,
CharField,
TimestampField,
DoubleField,
ForeignKeyField,
IntegerField,
)
from models.recording_session import HostRecordingSession
from utils.database import database


class PressureReading(Model):
# The recording session this reading belongs to
host_session = ForeignKeyField(HostRecordingSession, null=True)

# Local recording session identifier from the device that took the reading
local_session = IntegerField(null=True)

# ADC device index from which the reading was taken
adc_device = CharField(max_length=255, null=True)

# Pressure channel from which the reading was taken
pressure_channel = CharField(max_length=255, null=True)

# Milliseconds since the board's epoch when the reading was recorded
recorded_at = TimestampField(null=True)

# Full timestamp of when the reading was stored
stored_at = TimestampField(default=datetime.now)

# Wheatstone bridge voltage difference measured in millivolts
voltage = DoubleField(null=True)

# Pressure reading in psi
pressure = DoubleField(null=True)

# Temperature of the manifold from the NTC resistor at the time of the recording in degrees Celsius
temperature = DoubleField(null=True)

class Meta:
database = database
table_name = "pressure_readings"
3 changes: 0 additions & 3 deletions apps/argus/argus/models/recording_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ class HostRecordingSession(Model):
class Meta:
table_name = "host_recording_sessions"
database = database


database.evolve()
41 changes: 41 additions & 0 deletions apps/argus/argus/models/strain_reading.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from datetime import datetime
from peewee import (
Model,
CharField,
TimestampField,
DoubleField,
ForeignKeyField,
IntegerField,
)
from models.recording_session import HostRecordingSession
from utils.database import database


class StrainReading(Model):
# The recording session this reading belongs to
host_session = ForeignKeyField(HostRecordingSession, null=True)

# Local recording session identifier from the device that took the reading
local_session = IntegerField(null=True)

# ADC device index from which the reading was taken
adc_device = CharField(max_length=255, null=True)

# Pressure channel from which the reading was taken
strain_channel = CharField(max_length=255, null=True)

# Milliseconds since the board's epoch when the reading was recorded
recorded_at = TimestampField(null=True)

# Full timestamp of when the reading was stored
stored_at = TimestampField(default=datetime.now)

# Wheatstone bridge voltage difference measured in millivolts
voltage = DoubleField(null=True)

# Strain reading in microstrain
strain = DoubleField(null=True)

class Meta:
database = database
table_name = "strain_readings"
Loading
Loading