Skip to content

Commit 6075635

Browse files
pre semis
1 parent ed32f56 commit 6075635

7 files changed

Lines changed: 88 additions & 9 deletions

File tree

jetson/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async fn main() -> Result<()> {
3939
"build".to_string(),
4040
"--release".to_string(),
4141
"--features".to_string(),
42-
"logging,annotated_streams".to_string(),
42+
"logging".to_string(),
4343
];
4444
}
4545

src/comms/control_board/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<T: 'static + AsyncWriteExt + Unpin + Send> ControlBoard<T> {
129129
.await?;
130130
self.stability_assist_pid_tune('Y', 2.0, 0.0, 0.0, 0.1, false)
131131
.await?;
132-
self.stability_assist_pid_tune('Z', 6.0, 0.0, 0.0, 1.0, false)
132+
self.stability_assist_pid_tune('Z', 4.0, 0.0, 0.0, 1.0, false)
133133
.await?;
134134
self.stability_assist_pid_tune('D', 1.5, 0.0, 0.0, 1.0, false)
135135
.await

src/main.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use sw8s_rust_lib::{
2424
example::{initial_descent, pid_test},
2525
fire_torpedo::{FireLeftTorpedo, FireRightTorpedo},
2626
gate::{
27-
gate_run_complex, gate_run_cv_procedural, gate_run_naive, gate_run_procedural,
28-
gate_run_testing,
27+
gate_run_complex, gate_run_cv_procedural, gate_run_dead_reckon, gate_run_naive,
28+
gate_run_procedural, gate_run_testing,
2929
},
3030
meb::WaitArm,
3131
octagon::octagon,
@@ -399,6 +399,27 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
399399
&config.missions.gate,
400400
&config.get_color_profile().unwrap(),
401401
)),
402+
"gate_run_yolo" => ctwrap!(gate_run_procedural(
403+
&FullActionContext::new(
404+
control_board().await,
405+
meb().await,
406+
front_cam().await,
407+
bottom_cam().await,
408+
gate_target().await,
409+
),
410+
&config.missions.gate
411+
)),
412+
"gate_run_reckon" => ctwrap!(gate_run_dead_reckon(
413+
&FullActionContext::new(
414+
control_board().await,
415+
meb().await,
416+
front_cam().await,
417+
bottom_cam().await,
418+
gate_target().await,
419+
),
420+
&config.missions.gate,
421+
&config.get_color_profile().unwrap(),
422+
)),
402423
"gate_run_testing" => ctwrap!(gate_run_testing(&FullActionContext::new(
403424
control_board().await,
404425
meb().await,

src/missions/gate.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,63 @@ use super::{
3939
vision::{DetectTarget, ExtractPosition, VisionNorm, VisionNormOffset},
4040
};
4141

42+
pub async fn gate_run_dead_reckon<
43+
Con: Send + Sync + GetControlBoard<WriteHalf<SerialStream>> + GetMainElectronicsBoard + FrontCamIO,
44+
>(
45+
context: &Con,
46+
config: &Config,
47+
color_profile: &ColorProfile,
48+
) {
49+
#[cfg(feature = "logging")]
50+
logln!("Starting Procedural Gate");
51+
52+
let cb = context.get_control_board();
53+
let _ = cb.bno055_periodic_read(true).await;
54+
55+
let initial_yaw = loop {
56+
if let Some(initial_angle) = cb.responses().get_angles().await {
57+
break *initial_angle.yaw();
58+
} else {
59+
#[cfg(feature = "logging")]
60+
logln!("Failed to get initial angle");
61+
}
62+
};
63+
64+
// let _ = cb
65+
// .stability_2_speed_set(0.0, 0.0, 0.0, 0.0, initial_yaw, config.depth)
66+
// .await;
67+
68+
// sleep(Duration::from_secs_f32(config.init_duration)).await;
69+
// let mut mult = 1.0;
70+
// if let Side::Left = config.side {
71+
// mult = -1.0;
72+
// } else {
73+
// mult = 1.0;
74+
// }
75+
// let _ = cb
76+
// .stability_2_speed_set(
77+
// config.strafe_speed * mult,
78+
// 0.0,
79+
// 0.0,
80+
// 0.0,
81+
// initial_yaw,
82+
// config.depth,
83+
// )
84+
// .await;
85+
86+
// sleep(Duration::from_secs_f32(config.strafe_duration)).await;
87+
88+
let _ = cb
89+
.stability_2_speed_set(0.0, config.speed, 0.0, 0.0, initial_yaw, config.depth)
90+
.await;
91+
92+
sleep(Duration::from_secs_f32(config.traversal_duration)).await;
93+
94+
let _ = cb
95+
.stability_1_speed_set(0.0, 0.0, 0.0, 0.0, 0.0, config.depth)
96+
.await;
97+
}
98+
4299
pub async fn gate_run_cv_procedural<
43100
Con: Send + Sync + GetControlBoard<WriteHalf<SerialStream>> + GetMainElectronicsBoard + FrontCamIO,
44101
>(

src/missions/slalom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub async fn slalom<
151151
false_count += 1;
152152
#[cfg(feature = "logging")]
153153
logln!("NO DETECTIONS");
154-
if false_count >= 100 {
154+
if false_count >= 500 {
155155
#[cfg(feature = "logging")]
156156
logln!("KILLED NO DET");
157157
break 'detections;

src/missions/spin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ pub fn spin<
2424
>(
2525
context: &Con,
2626
) -> impl ActionExec<()> + '_ {
27-
const GATE_DEPTH: f32 = -2.0;
28-
const DEPTH: f32 = -2.0;
27+
const GATE_DEPTH: f32 = -1.75;
28+
const DEPTH: f32 = -1.15;
2929
const Z_TARGET: f32 = 0.0;
30-
const FORWARD_SPEED: f32 = 1.0;
30+
const FORWARD_SPEED: f32 = 0.0;
3131
const SPIN_SPEED: f32 = 1.0;
3232

3333
act_nest!(
@@ -39,7 +39,7 @@ pub fn spin<
3939
),
4040
OutputType::<()>::new(),
4141
),
42-
DelayAction::new(6.0),
42+
DelayAction::new(2.0),
4343
ActionWhile::new(TupleSecond::new(ActionConcurrent::new(
4444
act_nest!(
4545
ActionSequence::new,

src/video_source/appsink.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl Camera {
7676
+ " rtspclientsink location=rtsp://127.0.0.1:8554/"
7777
+ camera_name
7878
+ "_annotated.mp4 ";
79+
#[cfg(feature = "annotated_streams")]
7980
dbg!(&output_string);
8081
// pipeline_head(camera_path, camera_dimensions.0, camera_dimensions.1, 30)
8182
// "appsrc ! image/jpeg, width=480, height=640, framerate=30/1".to_string()

0 commit comments

Comments
 (0)