Skip to content
Closed
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
4 changes: 2 additions & 2 deletions src/missions/coinflip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ pub fn coinflip<
const TRUE_COUNT: u32 = 4;
const DELAY_TIME: f32 = 3.0;

const DEPTH: f32 = -1.15;
const DEPTH: f32 = -1.75;
const ALIGN_X_SPEED: f32 = 0.0;
const ALIGN_Y_SPEED: f32 = 0.0;
const ALIGN_YAW_SPEED: f32 = -6.0;
const ALIGN_YAW_SPEED: f32 = -3.0;
const ALIGN_YAW_CORRECTION_SPEED: f32 = 0.0;

act_nest!(
Expand Down
2 changes: 1 addition & 1 deletion src/missions/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn gate_run_coinflip<
) -> impl ActionExec<anyhow::Result<()>> + '_ {
const TIMEOUT: f32 = 30.0;

let depth: f32 = -1.0;
let depth: f32 = -1.6;

act_nest!(
ActionSequence::new,
Expand Down
109 changes: 101 additions & 8 deletions src/missions/path_align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ use crate::{
TupleSecond,
},
basic::DelayAction,
extra::{CountTrue, OutputType, Terminal, ToVec},
extra::{CountFalse, CountTrue, OutputType, Terminal, ToVec},
movement::{
LinearYawFromX, OffsetToPose, Stability2Adjust, Stability2Movement, Stability2Pos,
ZeroMovement,
AdjustType, ClampX, FlipX, LinearYawFromX, OffsetToPose, SetY, Stability2Adjust,
Stability2Movement, Stability2Pos, ZeroMovement,
},
vision::{DetectTarget, ExtractPosition, MidPoint, VisionNormBottom},
},
vision::path::Path,
vision::path_cv::PathCV,
};

use super::{
Expand All @@ -33,15 +34,50 @@ pub fn path_align<
>(
context: &Con,
) -> impl ActionExec<()> + '_ {
const DEPTH: f32 = -1.25;
const DEPTH: f32 = -1.5;
const PATH_ALIGN_SPEED: f32 = 0.3;

act_nest!(
ActionSequence::new,
ZeroMovement::new(context, DEPTH),
DelayAction::new(2.0),
ActionWhile::new(ActionChain::new(
VisionNormBottom::<Con, Path, f64>::new(context, Path::default()),
VisionNormBottom::<Con, PathCV, f64>::new(context, PathCV::default()),
TupleSecond::new(ActionConcurrent::new(
act_nest!(
ActionChain::new,
ActionDataConditional::new(
DetectTarget::new(true),
act_nest!(
ActionChain::new,
ExtractPosition::new(),
MidPoint::new(),
OffsetToPose::default(),
// LinearYawFromX::<Stability2Adjust>::new(0.0),
ClampX::new(1.0),
// SetY::<Stability2Adjust>::new(AdjustType::Adjust(0.02)),
// FlipX::default(),
Stability2Movement::new(
context,
Stability2Pos::new(0.0, 0.0, 0.0, 0.0, None, DEPTH),
),
),
act_nest!(
ActionSequence::new,
Terminal::new(),
Stability2Movement::new(
context,
Stability2Pos::new(0.0, PATH_ALIGN_SPEED, 0.0, 0.0, None, DEPTH),
),
),
),
OutputType::<()>::new(),
),
ActionChain::new(DetectTarget::new(true), CountTrue::new(10)),
)),
)),
ActionWhile::new(ActionChain::new(
VisionNormBottom::<Con, PathCV, f64>::new(context, PathCV::default()),
TupleSecond::new(ActionConcurrent::new(
act_nest!(
ActionChain::new,
Expand All @@ -55,21 +91,78 @@ pub fn path_align<
LinearYawFromX::<Stability2Adjust>::default(),
Stability2Movement::new(
context,
Stability2Pos::new(0.0, PATH_ALIGN_SPEED, 30.0, 0.0, None, DEPTH),
Stability2Pos::new(0.0, PATH_ALIGN_SPEED, 0.0, 0.0, None, DEPTH),
),
),
act_nest!(
ActionSequence::new,
Terminal::new(),
Stability2Movement::new(
context,
Stability2Pos::new(0.0, PATH_ALIGN_SPEED, 30.0, 0.0, None, DEPTH),
Stability2Pos::new(0.0, PATH_ALIGN_SPEED, 0.0, 0.0, None, DEPTH),
),
),
),
OutputType::<()>::new(),
),
ActionChain::new(DetectTarget::new(true), CountTrue::new(5)),
ActionChain::new(DetectTarget::new(true), CountTrue::new(10)),
)),
)),
ActionWhile::new(ActionChain::new(
VisionNormBottom::<Con, PathCV, f64>::new(context, PathCV::default()),
TupleSecond::new(ActionConcurrent::new(
act_nest!(
ActionChain::new,
// act_nest!(
// ActionChain::new,
// ActionDataConditional::new(
// DetectTarget::new(true),
// act_nest!(
// ActionChain::new,
// ExtractPosition::new(),
// MidPoint::new(),
// OffsetToPose::default(),
// LinearYawFromX::<Stability2Adjust>::default(),
// Stability2Movement::new(
// context,
// Stability2Pos::new(
// 0.0,
// PATH_ALIGN_SPEED,
// 0.0,
// 0.0,
// None,
// DEPTH
// ),
// ),
// ),
// act_nest!(
// ActionSequence::new,
// Terminal::new(),
// Stability2Movement::new(
// context,
// Stability2Pos::new(
// 0.0,
// PATH_ALIGN_SPEED,
// 0.0,
// 0.0,
// None,
// DEPTH
// ),
// ),
// ),
// OutputType::<()>::new(),
// ),
act_nest!(
ActionSequence::new,
Terminal::new(),
Stability2Movement::new(
context,
Stability2Pos::new(0.0, PATH_ALIGN_SPEED / 1.5, 0.0, 0.0, None, DEPTH),
),
),
OutputType::<()>::new(),
),
ActionChain::new(DetectTarget::new(true), CountFalse::new(5)),
)),
)),
Terminal::new(),
Expand Down
1 change: 1 addition & 0 deletions src/vision/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub mod image_prep;
pub mod nn_cv2;
pub mod octagon;
pub mod path;
pub mod path_cv;
pub mod pca;
pub mod yolo_model;

Expand Down
Loading