19#include "front_controller.h"
27typedef enum { STATE_DRIVING, STATE_BRAKING } OnePedalDriveState;
30 OnePedalDriveState drive_state;
35typedef enum { PTS_TYPE_LINEAR, PTS_TYPE_EXPONENTIAL, PTS_TYPE_QUADRATIC } PtsRelationType;
37typedef enum { CURVE_TYPE_LINEAR, CURVE_TYPE_EXPONENTIAL, CURVE_TYPE_QUADRATIC } CurveType;
StatusCode opd_run()
Reads the pedal percentage from AccelPedalStorage and saves an adjusted acceleration percentage to fr...
Definition: opd.c:108
StatusCode opd_linear_calculate(float pedal_percentage, PtsRelationType relation_type, float *calculated_reading)
Perform linear OPD calculation.
Definition: opd.c:57
StatusCode opd_init(FrontControllerStorage *storage)
Initializes the opd, loads front controller storage.
Definition: opd.c:127
StatusCode opd_calculate_handler(float pedal_percentage, PtsRelationType relation_type, float *calculated_reading, CurveType curve_type)
handler for opd_calculate command, runs either linear or quadratic calculation based on CurveType enu...
Definition: opd.c:92
StatusCode opd_quadratic_calculate(float pedal_percentage, PtsRelationType relation_type, float *calculated_reading)
Perform quadratic OPD calculation.
Definition: opd.c:75
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Front Controller storage.
Definition: front_controller.h:66
uint32_t max_vehicle_speed_kph
Definition: opd.h:32
float max_braking_percentage
Definition: opd.h:31