Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily disable LIM-related sensors in FSM #121

Closed
wants to merge 2 commits into from
Closed
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
33 changes: 0 additions & 33 deletions pod-operation/src/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use crate::components::brakes::Brakes;
use crate::components::gyro::Gyroscope;
use crate::components::high_voltage_system::HighVoltageSystem;
use crate::components::lidar::Lidar;
use crate::components::lim_temperature::LimTemperature;
use crate::components::pressure_transducer::PressureTransducer;
use crate::components::signal_light::SignalLight;
use crate::components::wheel_encoder::WheelEncoder;
Expand All @@ -22,7 +21,6 @@ const TICK_INTERVAL: Duration = Duration::from_millis(100);
const STOP_THRESHOLD: f32 = 37.0; // Meters
const MIN_PRESSURE: f32 = 126.0; // PSI
const END_OF_TRACK: f32 = 8.7; // Meters
const LIM_TEMP_THRESHOLD: f32 = 71.0; //°C
const BRAKING_THRESHOLD: f32 = 9.1; // Meters
const BRAKING_DECELERATION: f32 = -15.14; // m/s^2
const ENCODER_SAMPLE_INTERVAL: Duration = Duration::from_micros(100);
Expand All @@ -49,8 +47,6 @@ pub struct StateMachine {
signal_light: SignalLight,
upstream_pressure_transducer: PressureTransducer,
downstream_pressure_transducer: PressureTransducer,
lim_temperature_port: LimTemperature,
lim_temperature_starboard: LimTemperature,
high_voltage_system: HighVoltageSystem,
lidar: Lidar,
wheel_encoder: std::sync::Arc<std::sync::Mutex<WheelEncoder>>,
Expand Down Expand Up @@ -105,10 +101,6 @@ impl StateMachine {
signal_light: SignalLight::new(),
upstream_pressure_transducer: PressureTransducer::upstream(),
downstream_pressure_transducer: PressureTransducer::downstream(),
lim_temperature_port: LimTemperature::new(ads1x1x::SlaveAddr::Default),
lim_temperature_starboard: LimTemperature::new(ads1x1x::SlaveAddr::Alternative(
false, true,
)),
high_voltage_system: HighVoltageSystem::new(),
lidar: Lidar::new(),
gyro: Gyroscope::new(),
Expand Down Expand Up @@ -175,16 +167,11 @@ impl StateMachine {
let gyro_data = self.gyro.read_orientation();
let downstream_pressure_data = self.downstream_pressure_transducer.read_pressure();
let upstream_pressure_data = self.upstream_pressure_transducer.read_pressure();
let lim_temp_port_data = self.lim_temperature_port.read_lim_temps();
let lim_temp_starboard_data = self.lim_temperature_starboard.read_lim_temps();

// Full JSON object
let full_json = json!({
"gyroscope": gyro_data,
"downstream_pressure_transducer": downstream_pressure_data,
"upstream_pressure_transducer": upstream_pressure_data,
"lim_temperature_port": lim_temp_port_data,
"lim_temperature_starboard": lim_temp_starboard_data,
});

self.io
Expand Down Expand Up @@ -294,26 +281,6 @@ impl StateMachine {
return State::Faulted;
}

let default_readings = self.lim_temperature_port.read_lim_temps();
let alternative_readings = self.lim_temperature_starboard.read_lim_temps();
if default_readings
.iter()
.chain(alternative_readings.iter())
.any(|&reading| reading > LIM_TEMP_THRESHOLD)
{
self.io
.of("/control-station")
.unwrap()
.emit(
"fault",
(
"High temperature detected, should be below {} C.",
LIM_TEMP_THRESHOLD,
),
)
.ok();
return State::Faulted;
}
// Last 20% of the track, as indicated by braking
if self.lidar.read_distance() < END_OF_TRACK {
self.io
Expand Down