Skip to content

Commit

Permalink
improve variable names
Browse files Browse the repository at this point in the history
Co-authored-by:ichbinJosi <[email protected]>
  • Loading branch information
schluis committed Oct 11, 2023
1 parent fe0b5d1 commit 4ac91fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/control/src/motion/dispatching_interpolator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use types::{
pub struct DispatchingInterpolator {
interpolator: SplineInterpolator<Joints<f32>>,
stiffnesses: Joints<f32>,
last_currently_active: bool,
was_dispatching: bool,
last_dispatching_motion: MotionType,
}

Expand Down Expand Up @@ -53,29 +53,29 @@ impl DispatchingInterpolator {
Ok(Self {
interpolator: Default::default(),
stiffnesses: Default::default(),
last_currently_active: false,
was_dispatching: false,
last_dispatching_motion: MotionType::Unstiff,
})
}

pub fn cycle(&mut self, mut context: CycleContext) -> Result<MainOutputs> {
context.motion_safe_exits[MotionType::Dispatching] = false;

let currently_active = context.motion_selection.current_motion == MotionType::Dispatching;
if !currently_active {
let dispatching = context.motion_selection.current_motion == MotionType::Dispatching;
if !dispatching {
context.transition_time.fill_if_subscribed(|| None);

self.last_currently_active = currently_active;
self.was_dispatching = false;
return Ok(Default::default());
}
let dispatching_motion = match context.motion_selection.dispatching_motion {
Some(motion) => motion,
None => return Ok(Default::default()),
};
let interpolator_reset_required =
self.last_dispatching_motion != dispatching_motion || !self.last_currently_active;
self.last_dispatching_motion != dispatching_motion || !self.was_dispatching;
self.last_dispatching_motion = dispatching_motion;
self.last_currently_active = currently_active;
self.was_dispatching = dispatching;

if interpolator_reset_required {
let target_position = match dispatching_motion {
Expand Down

0 comments on commit 4ac91fa

Please sign in to comment.