Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Bennett-Petzold committed Apr 9, 2024
1 parent 7bc9def commit 264180b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/missions/action.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use async_trait::async_trait;
use opencv::core::InputArray;

use core::fmt::Debug;
use std::{marker::PhantomData, sync::Arc, thread};
use tokio::{join, runtime::Handle, sync::Mutex};
Expand Down
6 changes: 1 addition & 5 deletions src/missions/buoy_hit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ use super::{
basic::DelayAction,
movement::{StraightMovement, ZeroMovement},
};
use crate::vision::{
buoy::{self, Buoy},
nn_cv2::OnnxModel,
VisualDetector,
};
use crate::vision::{buoy::Buoy, nn_cv2::OnnxModel, VisualDetector};

use anyhow::Result;
use async_trait::async_trait;
Expand Down
13 changes: 5 additions & 8 deletions src/missions/circle_buoy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,20 @@ use crate::{
vision::{Average, ExtractPosition, VisionNorm},
},
vision::{
buoy,
nn_cv2::OnnxModel,
path::{Path, Yuv},
Offset2D, VisualDetection, VisualDetector,
Offset2D,
},
};

use super::{
action::{Action, ActionExec, ActionMod, ActionSequence, ActionWhile},
action::{Action, ActionExec, ActionMod, ActionSequence},
action_context::{GetControlBoard, GetFrontCamMat, GetMainElectronicsBoard},
basic::DelayAction,
movement::{StraightMovement, ZeroMovement},
movement::ZeroMovement,
};

use anyhow::Result;
use async_trait::async_trait;
use core::fmt::Debug;

use opencv::core::Size;
use tokio::io::WriteHalf;
use tokio_serial::SerialStream;
Expand All @@ -35,7 +32,7 @@ pub struct CircleBuoy<'a, T> {
}

impl<'a, T> CircleBuoy<'a, T> {
pub fn new(context: &'a T, target_depth: f32, forward_power: f32, lateral_power: f32) -> Self {
pub fn new(context: &'a T, target_depth: f32, _forward_power: f32, lateral_power: f32) -> Self {
CircleBuoy {
context,
target_depth,
Expand Down
1 change: 0 additions & 1 deletion src/missions/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::{
vision::{
gate_poles::{GatePoles, Target},
nn_cv2::{OnnxModel, YoloClass},
path::Path,
Offset2D, VisualDetection,
},
};
Expand Down
10 changes: 2 additions & 8 deletions src/missions/octagon.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
use anyhow::Result;
use async_trait::async_trait;
use tokio::io::WriteHalf;
use tokio_serial::SerialStream;

use crate::{act_nest, vision::path::Path};

use super::{
action::{
Action, ActionConcurrent, ActionConditional, ActionExec, ActionMod, ActionSequence,
RaceAction,
},
action::{ActionExec, ActionSequence},
action_context::{GetControlBoard, GetFrontCamMat, GetMainElectronicsBoard},
basic::DelayAction,
example::initial_descent,
extra::NoOp,
meb::WaitArm,
movement::{Descend, Stability2Movement, Stability2Pos},
movement::{Stability2Movement, Stability2Pos},
vision::VisionNorm,
};

Expand Down
5 changes: 4 additions & 1 deletion src/missions/vision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ impl<T: Display, U: Send + Sync + Clone, V: Send + Sync + Clone>
ActionMod<anyhow::Result<Vec<VisualDetection<U, V>>>> for DetectTarget<T, U, V>
{
fn modify(&mut self, input: &anyhow::Result<Vec<VisualDetection<U, V>>>) {
self.results = input.as_ref().map(|valid| valid.clone()).ok()
#[allow(clippy::all)]
{
self.results = input.as_ref().map(|valid| valid.clone()).ok()
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/vision/buoy.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use anyhow::Result;
use opencv::{core::Size, prelude::Mat};
use tokio::sync::Mutex;

use crate::load_onnx;

use super::{
nn_cv2::{OnnxModel, VisionModel, YoloDetection}, path::Yuv, yolo_model::YoloProcessor
nn_cv2::{OnnxModel, VisionModel, YoloDetection},
yolo_model::YoloProcessor,
};

use core::hash::Hash;
use std::{error::Error, fmt::Display, ops::RangeInclusive, sync::Arc};
use std::{error::Error, fmt::Display};

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub enum Target {
Expand Down
6 changes: 1 addition & 5 deletions src/vision/path.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
use std::{
ops::{Deref, DerefMut, RangeInclusive},
sync::Arc,
};
use std::ops::{Deref, DerefMut, RangeInclusive};

use itertools::Itertools;
use opencv::{
core::{in_range, Size, VecN},
imgproc::{cvt_color, COLOR_RGB2YUV, COLOR_YUV2RGB},
prelude::{Mat, MatTraitConst},
};
use std::sync::Mutex;

use crate::vision::image_prep::{binary_pca, cvt_binary_to_points};

Expand Down

0 comments on commit 264180b

Please sign in to comment.