Skip to content

Commit

Permalink
Optionally force the position to be a fixed value
Browse files Browse the repository at this point in the history
  • Loading branch information
jpieper committed Apr 20, 2021
1 parent 980f317 commit d79d7ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fw/bldc_servo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,10 @@ class BldcServo::Impl {
} else {
status_.position = status_.position_unfilt;
}

if (config_.encoder_filter.debug_override >= 0) {
status_.position = config_.encoder_filter.debug_override;
}
}

void ISR_DoPositionCommon(
Expand Down
2 changes: 2 additions & 0 deletions fw/bldc_servo.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,14 @@ class BldcServo {
bool enabled = false;
float kp = 0.0f;
float ki = 0.0f;
int32_t debug_override = -1;

template <typename Archive>
void Serialize(Archive* a) {
a->Visit(MJ_NVP(enabled));
a->Visit(MJ_NVP(kp));
a->Visit(MJ_NVP(ki));
a->Visit(MJ_NVP(debug_override));
}
};
EncoderFilter encoder_filter;
Expand Down

0 comments on commit d79d7ee

Please sign in to comment.