Skip to content

Commit 74c5a5e

Browse files
committed
Revert "More orange! (#29)"
This reverts commit 198727e.
1 parent 198727e commit 74c5a5e

File tree

7 files changed

+6
-70
lines changed

7 files changed

+6
-70
lines changed

crates/control/src/led_status.rs

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
33
use color_eyre::Result;
44
use context_attribute::context;
55
use framework::{MainOutput, PerceptionInput};
6-
use types::{Ball, CycleTime, Eye, FilteredWhistle, Leds, PrimaryState, Rgb, SensorData};
6+
use types::{Ball, CycleTime, Eye, FilteredWhistle, Leds, PrimaryState, Rgb};
77

88
pub struct LedStatus {
99
blink_state: bool,
@@ -17,7 +17,6 @@ pub struct CreationContext {}
1717

1818
#[context]
1919
pub struct CycleContext {
20-
pub sensor_data: Input<SensorData, "sensor_data">,
2120
pub primary_state: Input<PrimaryState, "primary_state">,
2221
pub cycle_time: Input<CycleTime, "cycle_time">,
2322
pub filtered_whistle: Input<FilteredWhistle, "filtered_whistle">,
@@ -148,7 +147,6 @@ impl LedStatus {
148147
at_least_one_ball_data_bottom,
149148
last_ball_data_top_too_old,
150149
last_ball_data_bottom_too_old,
151-
context.sensor_data,
152150
);
153151

154152
let ears = if context.filtered_whistle.is_detected {
@@ -162,8 +160,8 @@ impl LedStatus {
162160
left_ear: ears,
163161
right_ear: ears,
164162
chest,
165-
left_foot: Rgb::DNT_ORANGE,
166-
right_foot: Rgb::DNT_ORANGE,
163+
left_foot: Rgb::GREEN,
164+
right_foot: Rgb::GREEN,
167165
left_eye,
168166
right_eye,
169167
};
@@ -178,7 +176,6 @@ impl LedStatus {
178176
at_least_one_ball_data_bottom: bool,
179177
last_ball_data_top_too_old: bool,
180178
last_ball_data_bottom_too_old: bool,
181-
sensor_data: &SensorData,
182179
) -> (Eye, Eye) {
183180
match primary_state {
184181
PrimaryState::Unstiff => {
@@ -202,9 +199,6 @@ impl LedStatus {
202199
} else {
203200
None
204201
};
205-
206-
let battery_charge = sensor_data.battery.charge;
207-
208202
(
209203
Eye {
210204
color_at_0: ball_color_top
@@ -222,7 +216,7 @@ impl LedStatus {
222216
color_at_315: ball_color_top
223217
.unwrap_or_else(|| ball_background_color.unwrap_or(Rgb::BLACK)),
224218
},
225-
get_filled_eye(battery_charge, Rgb::DNT_ORANGE),
219+
Eye::default(),
226220
)
227221
}
228222
}
@@ -286,32 +280,3 @@ impl LedStatus {
286280
}
287281
}
288282
}
289-
290-
fn get_filled_eye(battery_charge: f32, color: Rgb) -> Eye {
291-
let mut eye = Eye::default();
292-
293-
eye.color_at_0 = color;
294-
if battery_charge >= 0.125 {
295-
eye.color_at_45 = color;
296-
}
297-
if battery_charge >= 0.250 {
298-
eye.color_at_90 = color;
299-
}
300-
if battery_charge >= 0.375 {
301-
eye.color_at_135 = color;
302-
}
303-
if battery_charge >= 0.5 {
304-
eye.color_at_180 = color;
305-
}
306-
if battery_charge >= 0.625 {
307-
eye.color_at_225 = color;
308-
}
309-
if battery_charge >= 0.750 {
310-
eye.color_at_270 = color;
311-
}
312-
if battery_charge >= 0.875 {
313-
eye.color_at_315 = color;
314-
}
315-
316-
eye
317-
}

crates/hulk/src/nao/hula.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,6 @@ impl From<TouchSensors> for types::TouchSensors {
145145
}
146146
}
147147

148-
impl From<Battery> for types::Battery {
149-
fn from(from: Battery) -> Self {
150-
types::Battery {
151-
charge: from.charge,
152-
status: from.status,
153-
current: from.current,
154-
temperature: from.temperature,
155-
}
156-
}
157-
}
158-
159148
#[derive(Clone, Copy, Debug, Default)]
160149
#[repr(C)]
161150
pub struct SonarSensors {

crates/hulk/src/nao/hula_wrapper.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ impl HulaWrapper {
5555
let sonar_sensors = state_storage.sonar_sensors.into();
5656
let force_sensitive_resistors = state_storage.force_sensitive_resistors.into();
5757
let touch_sensors = state_storage.touch_sensors.into();
58-
let battery = state_storage.battery.into();
5958

6059
Ok(SensorData {
6160
positions,
6261
inertial_measurement_unit,
6362
sonar_sensors,
6463
force_sensitive_resistors,
6564
touch_sensors,
66-
battery,
6765
})
6866
}
6967

crates/hulk/src/webots/interface.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use types::{
2323
messages::{IncomingMessage, OutgoingMessage},
2424
samples::Samples,
2525
ycbcr422_image::YCbCr422Image,
26-
Battery, CameraPosition, Joints, Leds, SensorData,
26+
CameraPosition, Joints, Leds, SensorData,
2727
};
2828
use webots::Robot;
2929

@@ -180,12 +180,6 @@ impl hardware::Interface for Interface {
180180
sonar_sensors,
181181
force_sensitive_resistors,
182182
touch_sensors,
183-
battery: Battery {
184-
charge: 1.0,
185-
status: 0.0,
186-
current: 0.0,
187-
temperature: 0.0,
188-
},
189183
})
190184
}
191185

crates/types/src/color.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ impl Rgb {
129129
pub const YELLOW: Rgb = Rgb::new(255, 220, 0);
130130
pub const PURPLE: Rgb = Rgb::new(255, 0, 255);
131131
pub const WHITE: Rgb = Rgb::new(255, 255, 255);
132-
pub const DNT_ORANGE: Rgb = Rgb::new(255, 103, 0);
133132

134133
pub const fn new(r: u8, g: u8, b: u8) -> Self {
135134
Self { r, g, b }

crates/types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub use robot_kinematics::RobotKinematics;
122122
pub use robot_masses::RobotMass;
123123
pub use roles::Role;
124124
pub use sensor_data::{
125-
Battery, Foot, ForceSensitiveResistors, InertialMeasurementUnitData, SensorData, SonarSensors,
125+
Foot, ForceSensitiveResistors, InertialMeasurementUnitData, SensorData, SonarSensors,
126126
TouchSensors,
127127
};
128128
pub use sole_pressure::SolePressure;

crates/types/src/sensor_data.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,11 @@ pub struct TouchSensors {
5656
pub right_hand_right: bool,
5757
}
5858

59-
#[derive(Clone, Debug, Default, Deserialize, Serialize, SerializeHierarchy)]
60-
pub struct Battery {
61-
pub charge: f32,
62-
pub status: f32,
63-
pub current: f32,
64-
pub temperature: f32,
65-
}
66-
6759
#[derive(Clone, Debug, Default, Deserialize, Serialize, SerializeHierarchy)]
6860
pub struct SensorData {
6961
pub positions: Joints,
7062
pub inertial_measurement_unit: InertialMeasurementUnitData,
7163
pub sonar_sensors: SonarSensors,
7264
pub force_sensitive_resistors: ForceSensitiveResistors,
7365
pub touch_sensors: TouchSensors,
74-
pub battery: Battery,
7566
}

0 commit comments

Comments
 (0)