-
Notifications
You must be signed in to change notification settings - Fork 4
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
One pedal drive #262
One pedal drive #262
Conversation
…nd buffer zone for coasting
@@ -48,20 +51,44 @@ static float prv_get_float(uint32_t u) { | |||
return fu.f; | |||
} | |||
|
|||
static float prv_one_pedal_drive_current(float throttle_percent, float car_velocity, | |||
DriveState *drive_state) { | |||
float threshold = car_velocity <= MAX_OPD_SPEED ? car_velocity * COASTING_THERSHOLD_SCALE |
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.
nitpick, I think these should be if statements instead of ternary
case NEUTRAL: | ||
s_target_current = 0; | ||
case BRAKE: // When braking and regen is off it should be the same as NEUTRAL. regen = 0 | ||
s_target_current = regen < 100 ? regen / 100.0 : throttle_percent; |
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.
same thing with ternary here
@@ -130,9 +156,11 @@ static void motor_controller_rx_all() { | |||
|
|||
case MOTOR_CONTROLLER_BASE_L + VEL_MEASUREMENT: | |||
set_motor_velocity_velocity_l(prv_get_float(msg.data_u32[0]) * VELOCITY_SCALE); | |||
s_car_velocity_l = prv_get_float(msg.data_u32[1]) * CONVERT_VELOCITY_TO_KPH; |
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.
I know this file used this msg struct already but could you link to the doc where the uint32's value is defined? The link up top is dead
|
||
DriveState drive_state = get_drive_output_drive_state(); | ||
bool regen = get_drive_output_regen_braking(); | ||
uint8_t regen = get_drive_output_regen_braking(); |
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.
A comment about what this value is would be useful
No description provided.