-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix type error in state processor #48
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,7 +124,7 @@ void StateProcessor::accelerate() | |
int32_t act_current = calcMaxCurrent(); | ||
int32_t act_temp = calcMaxTemp(controllers); | ||
|
||
int32_t rpm = regulator.calculateRPM(velocity, act_rpm, act_current, act_temp); | ||
float rpm = regulator.calculateRPM(velocity, act_rpm, act_current, act_temp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue here is not the return type. RPM is a quantity that is being measured in integer values. However, the member field |
||
|
||
log_.INFO("MOTOR", "Sending %d rpm as target", rpm); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not quite where the problem is. We use
std::round
to obtain an integer, so the return type ofint32_t
makes sense! However, we are passing in anint32_t
which is problematic because it should be a floating-point number (as you have correctly identified). However, all our floating-point numbers are of typedata::nav_t
(which is just an alias fordouble
) so you should replacefloat
with this. Further, I'd say you should fix this issue in #44.