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
38 changes: 35 additions & 3 deletions control-board/src/bin/hwtest-drib/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![no_std]
#![no_main]

Check warning on line 3 in control-board/src/bin/hwtest-drib/main.rs

View workflow job for this annotation

GitHub Actions / format

Diff in /home/runner/work/firmware/firmware/control-board/src/bin/hwtest-drib/main.rs
use ateam_common_packets::{bindings::BasicControl, bindings::KickRequest, radio::DataPacket};
use embassy_executor::InterruptExecutor;
use embassy_stm32::{interrupt, pac::Interrupt};
use embassy_stm32::{gpio::{Input, Pull}, interrupt, pac::Interrupt};
use embassy_sync::pubsub::PubSubChannel;

use defmt_rtt as _;
Expand Down Expand Up @@ -74,6 +74,11 @@
// start tasks //
///////////////////

// let pg10_read = Input::new(p.PG10, Pull::Up);
// let pg11_read = Input::new(p.PG11, Pull::Up);
// let pd0_read = Input::new(p.PD0, Pull::Up);
// let pd1_read = Input::new(p.PD1, Pull::Up);

create_io_task!(main_spawner, robot_state, p);

create_kicker_task!(
Expand All @@ -86,7 +91,34 @@
);

loop {
Timer::after_millis(100).await;
Timer::after_millis(10).await;

if robot_state.hw_init_state_valid() {
break;
}

defmt::info!("waiting for hw init state to be valid");
}

loop {
Timer::after_millis(10).await;

if robot_state.get_hw_robot_id() == 0 {
break;
}

defmt::info!("wait for user to select robot id 0");
}

loop {
Timer::after_millis(10).await;

let mut motor_speed_ind = robot_state.get_hw_robot_id();
if motor_speed_ind > 8 {
motor_speed_ind = 16 - motor_speed_ind;
}

let drib_speed = motor_speed_ind as f32 * 75.0;

test_command_publisher
.publish(DataPacket::BasicControl(BasicControl {
Expand All @@ -96,7 +128,7 @@
vel_y_linear: 0.0,
vel_z_angular: 0.0,
kick_vel: 0.0,
dribbler_speed: 50.0,
dribbler_speed: drib_speed,
kick_request: KickRequest::KR_DISABLE,
}))
.await;
Expand Down
7 changes: 5 additions & 2 deletions control-board/src/drivers/kicker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use embassy_stm32::{
};
use embassy_time::{with_timeout, Duration, Timer};

use ateam_common_packets::bindings::{KickerControl, KickerTelemetry};
use ateam_common_packets::bindings::{KickRequest::KR_DISABLE, KickerControl, KickerTelemetry};

use crate::{image_hash, DEBUG_KICKER_UART_QUEUES};

Expand Down Expand Up @@ -49,11 +49,14 @@ impl<
>,
firmware_image: &'a [u8],
) -> Kicker<'a, LEN_RX, LEN_TX, DEPTH_RX, DEPTH_TX> {
let mut command_state: KickerControl = Default::default();
command_state.kick_request = KR_DISABLE;

Self {
stm32_uart_interface: stm32_interface,
firmware_image,

command_state: Default::default(),
command_state: command_state,
telemetry_state: Default::default(),

telemetry_enabled: false,
Expand Down
Loading