Skip to content

Commit 24ce05b

Browse files
committed
Rename VescControl to Motors
1 parent 1bf7ead commit 24ce05b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

pod-operation/src/components/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod inverter_board;
55
pub mod lidar;
66
pub mod lim_current;
77
pub mod lim_temperature;
8+
pub mod motors;
89
pub mod pressure_transducer;
910
pub mod signal_light;
10-
pub mod vesc;
1111
pub mod wheel_encoder;

pod-operation/src/components/vesc.rs renamed to pod-operation/src/components/motors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const WHEEL_DIAMETER: f32 = 1.5; // inches
1010
const MPH_TO_IN_PER_MIN: f32 = 1056.0;
1111
const MPH_TO_RPM: f32 = MPH_TO_IN_PER_MIN / WHEEL_DIAMETER;
1212

13-
pub struct VescControl {
13+
pub struct Motors {
1414
pub vesc: VescConnection<Uart>,
1515
}
1616

17-
impl VescControl {
17+
impl Motors {
1818
pub fn new(serial_path: &str) -> Self {
1919
let uart = Uart::with_path(serial_path, BAUD_RATE, PARITY, DATA_BITS, STOP_BITS).unwrap();
2020
let conn = VescConnection::new(uart);

pod-operation/src/demo.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use crate::components::inverter_board::InverterBoard;
77
use crate::components::lidar::Lidar;
88
use crate::components::lim_current::LimCurrent;
99
use crate::components::lim_temperature::LimTemperature;
10+
use crate::components::motors::Motors;
1011
use crate::components::pressure_transducer::PressureTransducer;
1112
use crate::components::signal_light::SignalLight;
12-
use crate::components::vesc::VescControl;
1313
use crate::components::wheel_encoder::WheelEncoder;
1414

1515
pub async fn blink(mut signal_light: SignalLight) {
@@ -137,12 +137,12 @@ pub async fn read_lidar(mut lidar: Lidar) {
137137
}
138138
}
139139

140-
pub async fn vesc_control(mut vesc: VescControl) {
140+
pub async fn vesc_motors(mut motors: Motors) {
141141
loop {
142-
vesc.set_speed_mph(10.0).unwrap();
142+
motors.set_speed_mph(10.0).unwrap();
143143
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
144-
println!("{:?}", vesc.vesc.get_fw_version().unwrap());
145-
vesc.set_speed_mph(0.0).unwrap();
144+
println!("{:?}", motors.vesc.get_fw_version().unwrap());
145+
motors.set_speed_mph(0.0).unwrap();
146146
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
147147
}
148148
}

pod-operation/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use crate::components::inverter_board::InverterBoard;
1515
use crate::components::lidar::Lidar;
1616
use crate::components::lim_current::LimCurrent;
1717
use crate::components::lim_temperature::LimTemperature;
18+
use crate::components::motors::Motors;
1819
use crate::components::pressure_transducer::PressureTransducer;
1920
use crate::components::signal_light::SignalLight;
20-
use crate::components::vesc::VescControl;
2121
use crate::components::wheel_encoder::WheelEncoder;
2222
use crate::state_machine::StateMachine;
2323

@@ -64,8 +64,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6464
let inverter_board = InverterBoard::new();
6565
tokio::spawn(demo::inverter_control(inverter_board));
6666

67-
let vesc = VescControl::new("/dev/ttyACM0");
68-
tokio::spawn(demo::vesc_control(vesc));
67+
let motors = Motors::new("/dev/ttyACM0");
68+
tokio::spawn(demo::vesc_motors(motors));
6969

7070
let mut state_machine = StateMachine::new(io);
7171
tokio::spawn(async move {

0 commit comments

Comments
 (0)