Skip to content
Merged
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
6 changes: 3 additions & 3 deletions crates/code_generation/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ fn generate_cycler_constructors(cyclers: &Cyclers, mode: CyclerMode) -> TokenStr
} else {
Default::default()
};
let error_message = format!("failed to create cycler `{}`", instance);
let error_message = format!("failed to create cycler `{instance}`");

quote! {
#[allow(unused)]
Expand Down Expand Up @@ -567,7 +567,7 @@ fn generate_cycler_starts(cyclers: &Cyclers) -> TokenStream {
format_ident!("{}_cycler", instance.to_case(Case::Snake));
let cycler_handle_identifier =
format_ident!("{}_handle", instance.to_case(Case::Snake));
let error_message = format!("failed to start cycler `{}`", instance);
let error_message = format!("failed to start cycler `{instance}`");
quote! {
let #cycler_handle_identifier = #cycler_variable_identifier
.start(keep_running.clone())
Expand Down Expand Up @@ -644,7 +644,7 @@ fn generate_cycler_replays(cyclers: &Cyclers) -> TokenStream {
.map(|(_cycler, instance)| {
let cycler_variable_identifier =
format_ident!("{}_cycler", instance.to_case(Case::Snake));
let error_message = format!("failed to replay {} cycle", instance);
let error_message = format!("failed to replay {instance} cycle");
quote! {
#instance => self.#cycler_variable_identifier.cycle(timestamp, data).wrap_err(#error_message),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hulk_imagine/src/write_to_mcap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where

outputs.into_iter().try_for_each(|(topic, data)| {
mcap_converter.add_to_mcap(
format!("{}.{}", cycler_name, topic),
format!("{cycler_name}.{topic}"),
&data,
index as u32,
timing.timestamp,
Expand Down
34 changes: 16 additions & 18 deletions crates/kinematics/src/inverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub fn leg_angles(
* Rotation3::new(Vector3::y() * right_foot_pitch_2_in_pelvis))
* Vector3::y());

let left_hip_yaw_pitch = -1.0 * (-1.0 * left_hip_rotation_c1.x).atan2(left_hip_rotation_c1.y);
let right_hip_yaw_pitch = (-1.0 * right_hip_rotation_c1.x).atan2(right_hip_rotation_c1.y);
let left_hip_yaw_pitch = -((-left_hip_rotation_c1.x).atan2(left_hip_rotation_c1.y));
Comment thread
alexschmander marked this conversation as resolved.
let right_hip_yaw_pitch = (-right_hip_rotation_c1.x).atan2(right_hip_rotation_c1.y);
let left_hip_yaw_pitch_combined =
left_hip_yaw_pitch * ratio + right_hip_yaw_pitch * (1.0 - ratio);

Expand All @@ -63,19 +63,17 @@ pub fn leg_angles(
let vector_right_hip_to_right_foot = right_foot_to_right_hip.translation;

let left_hip_roll_in_hip =
-1.0 * (-1.0 * vector_left_hip_to_left_foot.y).atan2(-1.0 * vector_left_hip_to_left_foot.z);
let right_hip_roll_in_hip = -1.0
* (-1.0 * vector_right_hip_to_right_foot.y).atan2(-1.0 * vector_right_hip_to_right_foot.z);
-((-vector_left_hip_to_left_foot.y).atan2(-vector_left_hip_to_left_foot.z));
let right_hip_roll_in_hip =
-((-vector_right_hip_to_right_foot.y).atan2(-vector_right_hip_to_right_foot.z));

let left_hip_pitch_minus_alpha = (-1.0 * vector_left_hip_to_left_foot.x).atan2(
(vector_left_hip_to_left_foot.y.powi(2) + vector_left_hip_to_left_foot.z.powi(2)).sqrt()
* -1.0
let left_hip_pitch_minus_alpha = (-vector_left_hip_to_left_foot.x).atan2(
-((vector_left_hip_to_left_foot.y.powi(2) + vector_left_hip_to_left_foot.z.powi(2)).sqrt())
* vector_left_hip_to_left_foot.z.signum(),
);
let right_hip_pitch_minus_alpha = (-1.0 * vector_right_hip_to_right_foot.x).atan2(
(vector_right_hip_to_right_foot.y.powi(2) + vector_right_hip_to_right_foot.z.powi(2))
.sqrt()
* -1.0
let right_hip_pitch_minus_alpha = (-vector_right_hip_to_right_foot.x).atan2(
-((vector_right_hip_to_right_foot.y.powi(2) + vector_right_hip_to_right_foot.z.powi(2))
.sqrt())
* vector_right_hip_to_right_foot.z.signum(),
);

Expand All @@ -101,26 +99,26 @@ pub fn leg_angles(
/ (2.0 * lower_leg * left_height);
let right_cos_minus_beta = (lower_leg.powi(2) + right_height.powi(2) - upper_leg.powi(2))
/ (2.0 * lower_leg * right_height);
let left_alpha = -1.0 * left_cos_minus_alpha.clamp(-1.0, 1.0).acos();
let right_alpha = -1.0 * right_cos_minus_alpha.clamp(-1.0, 1.0).acos();
let left_beta = -1.0 * left_cos_minus_beta.clamp(-1.0, 1.0).acos();
let right_beta = -1.0 * right_cos_minus_beta.clamp(-1.0, 1.0).acos();
let left_alpha = -(left_cos_minus_alpha.clamp(-1.0, 1.0).acos());
let right_alpha = -(right_cos_minus_alpha.clamp(-1.0, 1.0).acos());
let left_beta = -(left_cos_minus_beta.clamp(-1.0, 1.0).acos());
let right_beta = -(right_cos_minus_beta.clamp(-1.0, 1.0).acos());

let left_leg = LegJoints {
hip_yaw_pitch: left_hip_yaw_pitch_combined,
hip_roll: left_hip_roll_in_hip + PI / 4.0,
hip_pitch: left_hip_pitch_minus_alpha + left_alpha,
knee_pitch: -left_alpha - left_beta,
ankle_pitch: left_foot_rotation_c2.x.atan2(left_foot_rotation_c2.z) + left_beta,
ankle_roll: (-1.0 * left_foot_rotation_c2.y).asin(),
ankle_roll: (-left_foot_rotation_c2.y).asin(),
};
let right_leg = LegJoints {
hip_yaw_pitch: left_hip_yaw_pitch_combined,
hip_roll: right_hip_roll_in_hip - PI / 4.0,
hip_pitch: right_hip_pitch_minus_alpha + right_alpha,
knee_pitch: -right_alpha - right_beta,
ankle_pitch: right_foot_rotation_c2.x.atan2(right_foot_rotation_c2.z) + right_beta,
ankle_roll: (-1.0 * right_foot_rotation_c2.y).asin(),
ankle_roll: (-right_foot_rotation_c2.y).asin(),
};

LowerBodyJoints {
Expand Down
2 changes: 1 addition & 1 deletion crates/parameters/src/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ where
to_value(parameters).map_err(DirectoryError::ParametersNotConvertedToJsonValue)?;
let stored_parameters = to_value(
deserialize::<Parameters>(&parameters_root, hardware_ids, true).map_err(|error| {
println!("{:?}", error);
println!("{error:?}");
error
})?,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/source_analyzer/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait ToWriterPretty {

impl ToWriterPretty for String {
fn to_writer_pretty(&self, writer: &mut impl Write) -> fmt::Result {
write!(writer, "{}", self)
write!(writer, "{self}")
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/vision/src/line_detection/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn get_gradient(
point: Point2<Pixel, u16>,
gradient_sobel_stride: u32,
) -> Vector2<f32> {
#![allow(clippy::neg_multiply)]
if point.x() < gradient_sobel_stride as u16
|| point.y() < gradient_sobel_stride as u16
|| point.x() > image.width() as u16 - 2 * gradient_sobel_stride as u16
Expand Down
2 changes: 1 addition & 1 deletion tools/annotato/src/widgets/class_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Widget for ClassSelector<'_> {
.selected_text(format!("{:?}", self.currently_selected))
.show_ui(ui, |ui| {
Class::list().into_iter().for_each(|class| {
ui.selectable_value(self.currently_selected, class, format!("{:?}", class));
ui.selectable_value(self.currently_selected, class, format!("{class:?}"));
});
})
.response
Expand Down
3 changes: 1 addition & 2 deletions tools/pepsi/src/aliveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ fn print_verbose(states: &AlivenessList) {
.expect("temperature array should not be empty");

format!(
"{}°C / {}°C / {}°C (minimum / maximum / median)",
minimum_temperature, maximum_temperature, median_temperature
"{minimum_temperature}°C / {maximum_temperature}°C / {median_temperature}°C (minimum / maximum / median)"
)
}
None => unknown.clone(),
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/src/gammaray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub async fn gammaray(arguments: Arguments, repository: &Repository) -> Result<(
|nao_address, progress_bar| async move {
let nao = Nao::try_new_with_ping(nao_address.ip).await?;
nao.flash_image(image_path, |msg| {
progress_bar.set_message(format!("Uploading image v{version}: {}", msg))
progress_bar.set_message(format!("Uploading image v{version}: {msg}"))
})
.await
.wrap_err_with(|| format!("failed to flash image to {nao_address}"))?;
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/src/pre_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async fn setup_nao(

progress.set_message("Uploading: ...");
nao.upload(upload_directory, "hulk", !arguments.no_clean, |status| {
progress.set_message(format!("Uploading: {}", status))
progress.set_message(format!("Uploading: {status}"))
})
.await
.wrap_err_with(|| format!("failed to upload binary to {nao_address}"))?;
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/src/recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ where
{
let position = string
.find('=')
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{}`", string))?;
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{string}`"))?;
Ok((string[..position].parse()?, string[position + 1..].parse()?))
}
2 changes: 1 addition & 1 deletion tools/pepsi/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async fn upload_with_progress(

progress.set_message("Uploading: ...");
nao.upload(upload_directory, "hulk", !arguments.no_clean, |status| {
progress.set_message(format!("Uploading: {}", status))
progress.set_message(format!("Uploading: {status}"))
})
.await
.wrap_err_with(|| format!("failed to upload binary to {nao_address}"))?;
Expand Down
8 changes: 3 additions & 5 deletions tools/twix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl egui_dock::TabViewer for TabViewer {
Ok(panel) => panel.ui(ui),

Err((error, value)) => {
ui.label(format!("Error loading panel: {}", error));
ui.label(format!("Error loading panel: {error}"));
ui.collapsing("JSON", |ui| {
let content = match serde_json::to_string_pretty(value) {
Ok(pretty_string) => pretty_string,
Expand All @@ -691,10 +691,8 @@ impl egui_dock::TabViewer for TabViewer {

fn title(&mut self, tab: &mut Self::Tab) -> eframe::egui::WidgetText {
match &mut tab.panel {
Ok(panel) => format!("{}", panel).into(),
Err((error, _value)) => {
WidgetText::from(format!("{}", error)).color(Color32::LIGHT_RED)
}
Ok(panel) => format!("{panel}").into(),
Err((error, _value)) => WidgetText::from(format!("{error}")).color(Color32::LIGHT_RED),
}
}

Expand Down
3 changes: 1 addition & 2 deletions tools/twix/src/panels/automatic_camera_calibration_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ impl Widget for &mut CameraCalibrationExportPanel {
.map(|primary_state| match primary_state {
PrimaryState::Calibration => ui.label("Calibration in progress"),
_ => ui.label(format!(
"Not yet calibrated, primary state: {:?}",
primary_state
"Not yet calibrated, primary state: {primary_state:?}"
)),
});
}
Expand Down
4 changes: 2 additions & 2 deletions tools/twix/src/panels/look_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Widget for &mut LookAtPanel {
let current_motion_command = match self.motion_command_buffer.get_last_value() {
Ok(Some(value)) => {
status_text_job.append(
format!("Current Motion: {:?}.", value).as_str(),
format!("Current Motion: {value:?}.").as_str(),
0.0,
TextFormat {
font_id: FontId::monospace(14.0),
Expand Down Expand Up @@ -139,7 +139,7 @@ impl Widget for &mut LookAtPanel {
}
Err(error) => {
status_text_job.append(
format!("Field dimensions are not available: {}", error).as_str(),
format!("Field dimensions are not available: {error}").as_str(),
leading_space,
error_format,
);
Expand Down