Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Nov 9, 2024
1 parent 1d53452 commit cfb77c2
Show file tree
Hide file tree
Showing 23 changed files with 884 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Bug
description: For any issue related to a bug
title: '[Area] - Short Description'
labels: [bug]
body:
- type: textarea
id: observed-behavior
attributes:
label: Observed Behavior
description: What happened?
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: What should have happened?
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: How could someone reproduce this bug?
value: "1. \n2. \n3. "
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots (as needed)
description: Add screenshots of the bug if applicable
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/epic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Epic
description: A collection of many tasks
title: '[Area] - Short Description'
labels: [epic]
body:
- type: textarea
id: overview
attributes:
label: Overview
description: Provide a brief summary of this epic
validations:
required: true
- type: textarea
id: stakeholders
attributes:
label: Stakeholders
description: Who to contact for this epic?
value: |
Product Stakeholder:
Software Stakeholder:
Reference Users:
- type: textarea
id: metrics
attributes:
label: Success Metrics
description: What are the metrics we will use to determine if this is successful?
validations:
required: true
- type: textarea
id: rollout
attributes:
label: Rollout Plan
description: How will this be released? All at once? In parts?
validations:
required: true
- type: textarea
id: scope
attributes:
label: Out of Scope
description: What is not included in this epic?
validations:
required: true
- type: textarea
id: background-context
attributes:
label: Background / Context
description: What is the context for this epic? What already exists?
validations:
required: true
- type: textarea
id: acceptance
attributes:
label: Acceptance Criteria
description: How are we evaluating the success of this epic?
validations:
required: true
- type: textarea
id: tickets
attributes:
label: Tickets
description: What tickets will be a part of this epic?
value: " - [ ] #\n - [ ] #"
validations:
required: true
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Feature Request
description: Suggest a new feature for the project
title: '[Area] - Short Description'
labels: [new feature]
body:
- type: textarea
id: current-features
attributes:
label: Current Features
description: What exists currently?
validations:
required: true
- type: textarea
id: desired-features
attributes:
label: Desired Additional Features
description: What features do you want to add?
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots (as needed)
description: Add screenshots of the current or desired state if applicable
validations:
required: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Other
description: For issues that don't fit the other categories
title: '[Area] - Short Description'
body:
- type: textarea
id: desired-changes
attributes:
label: Desired Changes
description: What changes do you want to make?
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots (as needed)
description: Add screenshots if applicable
validations:
required: false
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/spike.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Spike
description: For any research or investigation into a feature or our current architecture
title: '[Area] - Short Description'
labels: [spike]
body:
- type: markdown
attributes:
value: For a spike ticket, please make sure to remember to add links to the resources you are pulling information from so others who are reviewing and giving feedback can also take a look at the same information you are looking at.
- type: dropdown
id: spike-type
attributes:
label: Spike Type
description: Is this spike about the product (functional) or the implementation of the product (technical)?
multiple: true
options:
- Functional
- Technical
- type: textarea
id: goal
attributes:
label: Goal
description: What is this spike ticket looking into/trying to solve? Is this about enhancing something we currently do or looking into a new feature?
validations:
required: true
- type: textarea
id: purpose
attributes:
label: Reason for Spike
description: Why is this spike ticket necessary?
validations:
required: true
- type: textarea
id: sidenotes
attributes:
label: Additional notes
description: Add any extra comments related to the spike.
validations:
required: false
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Task
description: Create a task that a developer can complete.
title: '[Area] - Short Description'
body:
- type: textarea
id: description
attributes:
label: Description
description: Provide a brief summary of this issue
validations:
required: true
- type: textarea
id: acceptance-criteria
attributes:
label: Acceptance Criteria
description: What are the conditions that need to be satisified to complete this task?
validations:
required: true
- type: textarea
id: proposed-solution
attributes:
label: Proposed Solution
description: How will this solution be implemented? What will be changed or added?
validations:
required: true
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
35 changes: 35 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Changes

_Explanation of changes goes here_

## Notes

_Any other notes go here_

## Test Cases

- Case A
- Edge case
- ...

## To Do

_Any remaining things that need to get done_

- [ ] item 1
- [ ] ...

## Checklist

It can be helpful to check the `Checks` and `Files changed` tabs.
Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

- [ ] No merge conflicts
- [ ] All checks passing
- [ ] Remove any non-applicable sections of this template
- [ ] Assign the PR to yourself
- [ ] Request reviewers & ping on Slack
- [ ] PR is linked to the ticket (fill in the closes line below)

Closes # (issue #)
31 changes: 31 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Rust CI

on:
push:
branches:
- main
- Develop
pull_request:
branches:
- main
- Develop

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Setup Rust
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
- name: Clippy
run: cargo clippy --verbose -- -D warnings
- name: Audit
run: cargo audit
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ Cargo.lock
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#.idea/

*.nix


# Added by cargo

/target

# protobuf
serverdata.rs

# test videos
*.avi
19 changes: 19 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "odysseus-daemon"
version = "0.1.0"
edition = "2021"

[dependencies]
clap = { version = "4.5.20", features = ["derive", "env"] }
protobuf = "3.7.1"
rumqttc = "0.24.0"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"
sysinfo = "0.32.0"
tokio = { version = "1.41.0", features = ["full", "tracing"] }
tokio-util = { version = "0.7.12", features = ["full"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["ansi", "env-filter"] }

[build-dependencies]
protobuf-codegen = "3.7.1"
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# Odysseus-Daemon
System state daemon for the Odysseus on-car telemetry OS

This handles a variety of functions on the car, including security guarrantees, etc.
These functions are considered modules.

Core principles:
- Each module should not bring down another (do not unwrap or expect, return error)
- Each module should use tracing when needed
- Each module should have an enable flag at a minimum, and be off by default


Modules
- `visual`: Camera process manager and writer. Status: Beta
- `lockdown`: Feature disabler and modifier upon HV enablement. Status: Alpha
- `audible`: Call feature trigger and monitor. Status: Alpha
- `numerical`: Telemetry scraper and sender (tpu-telemetry python replacement). Status: Incomplete


**This program will only run on Odysseus**
14 changes: 14 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Prebuild script */
fn main() {
println!("cargo:rerun-if-changed=src/proto");

protobuf_codegen::Codegen::new()
.pure()
// All inputs and imports from the inputs must reside in `includes` directories.
.includes(["src/proto"])
// Inputs must reside in some of include paths.
.input("src/proto/serverdata.proto")
// Specify output directory relative to Cargo output directory.
.out_dir("src")
.run_from_script();
}
Empty file added src/audible.rs
Empty file.
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pub mod lockdown;
pub mod mqtt_handler;
pub mod numerical;
pub mod serverdata;
pub mod visual;

#[derive(std::fmt::Debug)]
pub struct PublishableMessage {
pub topic: &'static str,
pub data: Vec<f32>,
pub unit: &'static str,
}

/// the topic to listen for for HV enable, 1 is on 0 is off
pub const HV_EN_TOPIC: &str = "MPU/State/TSMS";
17 changes: 17 additions & 0 deletions src/lockdown.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::error::Error;

use tokio::sync::watch::Receiver;
use tracing::info;

pub async fn lockdown_runner(
mut hv_stat_recv: Receiver<bool>,
) -> Result<(), Box<dyn Error + Send + Sync>> {
loop {
tokio::select! {
new = hv_stat_recv.changed() => {
new?;
info!("New HV state:{}", *hv_stat_recv.borrow_and_update());
}
}
}
}
Loading

0 comments on commit cfb77c2

Please sign in to comment.