Skip to content
Open
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
21 changes: 6 additions & 15 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,18 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Update Ubuntu Packages
run: sudo apt-get update

- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: llvm \
clang \
libclang-dev \
libopencv-dev

- uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
with:
components: clippy
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: Swatinem/rust-cache@v2

- name: Build docs
run: cargo doc --features logging,graphing
run: nix develop ./#noFHS --command cargo doc --features logging,graphing

- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0;url=sw8s_rust_lib/index.html">' > target/doc/index.html
Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,13 @@ env:

jobs:
build:

runs-on: ubuntu-latest

runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Update Ubuntu Packages
run: sudo apt-get update

- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: llvm \
clang \
libclang-dev \
libopencv-dev \
libavutil-dev \
libavcodec-dev \
libavformat-dev

- name: Install gstreamer
run: |
sudo apt update
sudo apt install -y aptitude
sudo aptitude install -y libgstreamer1.0-dev

- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --features logging,graphing --verbose
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: nix develop ./#noFHS --command cargo test --features logging,graphing --verbose
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ mod graphing {
})
.for_each(|(path, file, actions)| {
let actions_str =
"pub fn graph_actions<T: GraphActionContext::GetMainElectronicsBoard + GraphActionContext::GetControlBoard<tokio::io::WriteHalf<tokio_serial::SerialStream>> + GraphActionContext::GetFrontCamMat + GraphActionContext::GetBottomCamMat + Send + Sync + std::marker::Unpin>(context: &'static T) -> Vec<(String, Box<dyn GraphAction + '_>)> { vec!["
"pub fn graph_actions<T: GraphActionContext::GetMainElectronicsBoard + GraphActionContext::GetControlBoard<tokio::io::WriteHalf<tokio_serial::SerialStream>> + GraphActionContext::FrontCamIO + GraphActionContext::BottomCamIO + Send + Sync + std::marker::Unpin>(context: &'static T) -> Vec<(String, Box<dyn GraphAction + '_>)> { vec!["
.to_string()
+ &actions
.into_iter()
.fold("".to_string(), |acc, x| acc + &format!("(\"{x}\".to_string(), Box::new({x}(context))),"))
+ "]}";
let file_contents =
quote! { use sw8s_rust_lib::missions::action::Action as GraphAction; use sw8s_rust_lib::missions::action::ActionExec as GraphActionExec; use sw8s_rust_lib::missions::action_context as GraphActionContext; #file };
quote! { use sw8s_rust_lib::missions::action::Action as GraphAction; use sw8s_rust_lib::missions::action::ActionExec as GraphActionExec; use sw8s_rust_lib::missions::action_context as GraphActionContext; use sw8s_rust_lib::logln; #file };
let output_loc = out_path.join(path.strip_prefix::<PathBuf>("src/missions".into()).unwrap());
create_dir_all(output_loc.parent().unwrap()).unwrap();
write(
Expand Down
3 changes: 1 addition & 2 deletions src/comms/auv_control_board/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use tokio::io::AsyncReadExt;
use tokio::{fs::OpenOptions, io::AsyncWriteExt, sync::Mutex};

use super::util::{END_BYTE, ESCAPE_BYTE, START_BYTE};
use crate::logln;

#[cfg(feature = "logging")]
static LOG_NAMES: Mutex<Vec<String>> = Mutex::const_new(Vec::new());
Expand Down Expand Up @@ -194,7 +193,7 @@ mod tests {
)
.collect::<Vec<Vec<u8>>>()
.await,
vec![vec![]]
Vec::<Vec<u8>>::from([vec![]])
);

assert_eq!(
Expand Down
1 change: 0 additions & 1 deletion src/comms/control_board/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use self::{
};

use super::auv_control_board::{AUVControlBoard, MessageId};
use crate::logln;

pub mod response;
pub mod util;
Expand Down
2 changes: 0 additions & 2 deletions src/missions/basic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::logln;

use super::{
action::{Action, ActionChain, ActionExec, ActionSequence},
action_context::{GetControlBoard, GetMainElectronicsBoard},
Expand Down
2 changes: 0 additions & 2 deletions src/missions/extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ use std::marker::PhantomData;
use anyhow::{anyhow, bail};
use uuid::Uuid;

use crate::logln;

use super::{
action::{Action, ActionExec, ActionMod},
graph::{stripped_fn, stripped_type, DotString},
Expand Down
2 changes: 0 additions & 2 deletions src/missions/meb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use std::time::Duration;

use tokio::time::sleep;

use crate::logln;

use super::{
action::{Action, ActionExec},
action_context::GetMainElectronicsBoard,
Expand Down
1 change: 0 additions & 1 deletion src/missions/movement.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::comms::control_board::ControlBoard;
use crate::comms::control_board::LAST_YAW;
use crate::logln;
use crate::vision::DrawRect2d;
use crate::vision::Offset2D;
use crate::vision::RelPos;
Expand Down
1 change: 0 additions & 1 deletion src/missions/vision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{iter::Sum, marker::PhantomData};
use super::action::{Action, ActionExec, ActionMod};
use super::action_context::BottomCamIO;
use super::graph::DotString;
use crate::logln;
use crate::vision::{
Angle2D, Draw, DrawRect2d, Offset2D, RelPos, RelPosAngle, VisualDetection, VisualDetector,
};
Expand Down
2 changes: 1 addition & 1 deletion src/vision/buoy_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use derive_getters::Getters;
use opencv::{core::Rect2d, core::Size, prelude::Mat};

use crate::{load_onnx, logln};
use crate::load_onnx;

use super::{
nn_cv2::{OnnxModel, VisionModel, YoloClass, YoloDetection},
Expand Down
2 changes: 1 addition & 1 deletion src/vision/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ mod tests {
imgcodecs::{imread, imwrite, IMREAD_COLOR},
};

use crate::{logln, vision::Draw};
use crate::vision::Draw;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion src/vision/path_cv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
imgcodecs::{imread, imwrite, IMREAD_COLOR},
};

use crate::{logln, vision::Draw};
use crate::vision::Draw;

use super::*;

Expand Down
2 changes: 0 additions & 2 deletions src/vision/pca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use opencv::{
prelude::Mat,
};

use crate::logln;

use super::{Angle2D, Draw, Offset2D, RelPosAngle, VisualDetection};

#[derive(Debug, Clone, Getters)]
Expand Down
Loading