Red Bird Racing VCU v2
 
Loading...
Searching...
No Matches
Pedal.hpp File Reference

Declaration of the Pedal class for handling throttle and brake pedal inputs. More...

#include <stdint.h>
#include "CarState.hpp"
#include "Interp.hpp"
#include "Curves.hpp"
#include "SignalProcessing.hpp"
#include <mcp2515.h>
Include dependency graph for Pedal.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Pedal
 Pedal class for managing throttle and brake pedal inputs. Handles filtering, fault detection, and CAN frame updates. More...
 

Namespaces

namespace  PedalConstants
 Namespace for pedal-related constants, such as thresholds and calculation parameters. This is to avoid polluting the Pedal class with intermediate results.
 

Variables

constexpr bool REGEN_ENABLED = true
 
constexpr bool FLIP_MOTOR_DIR = false
 
constexpr bool BRAKE_RELIABLE = true
 
constexpr uint16_t FAULT_CHECK_HEX = BRAKE_RELIABLE ? 0xFE : 0x3E
 
constexpr uint32_t MAX_MOTOR_READ_MILLIS = 100
 
constexpr uint8_t PedalConstants::MIN_REGEN_KMH = 10
 
constexpr uint8_t PedalConstants::GEAR_RATIO_NUMERATOR = 60
 
constexpr uint8_t PedalConstants::GEAR_RATIO_DENOMINATOR = 13
 
constexpr uint8_t PedalConstants::WHEEL_DIAMETER_INCH = 13
 
constexpr uint16_t PedalConstants::MAX_MOTOR_RPM = 7000
 
constexpr uint16_t PedalConstants::MAX_TORQUE_VAL = 32767
 
constexpr uint16_t PedalConstants::INCH_PER_KM = 39370
 
constexpr uint8_t PedalConstants::MINUTES_PER_HOUR = 60
 
constexpr double PedalConstants::PI_ = 3.1415926535897932384626433832795
 
constexpr int16_t PedalConstants::MIN_REGEN_RPM_VAL
 
constexpr uint8_t ADC_BUFFER_SIZE = 16
 

Detailed Description

Declaration of the Pedal class for handling throttle and brake pedal inputs.

Author
Planeson, Red Bird Racing
Version
1.6
Date
2026-02-12
See also
Pedal.cpp

Definition in file Pedal.hpp.

Variable Documentation

◆ ADC_BUFFER_SIZE

constexpr uint8_t ADC_BUFFER_SIZE = 16
constexpr

Size of the ADC reading buffer for filtering.

Definition at line 61 of file Pedal.hpp.

◆ BRAKE_RELIABLE

constexpr bool BRAKE_RELIABLE = true
constexpr

brake assumed reliable; enable checking of min/max (narrow range); set to false compromises safety!

Definition at line 32 of file Pedal.hpp.

◆ FAULT_CHECK_HEX

constexpr uint16_t FAULT_CHECK_HEX = BRAKE_RELIABLE ? 0xFE : 0x3E
constexpr

Hex mask for fault checking based on brake reliability.

Definition at line 34 of file Pedal.hpp.

Referenced by Pedal::update().

◆ FLIP_MOTOR_DIR

constexpr bool FLIP_MOTOR_DIR = false
constexpr

Boolean toggle to flip motor direction; true inverts torque commands.

Definition at line 30 of file Pedal.hpp.

Referenced by Pedal::sendFrame().

◆ MAX_MOTOR_READ_MILLIS

constexpr uint32_t MAX_MOTOR_READ_MILLIS = 100
constexpr

Maximum time in milliseconds between motor data reads before disabling regen.

Definition at line 36 of file Pedal.hpp.

Referenced by Pedal::readMotor().

◆ REGEN_ENABLED

constexpr bool REGEN_ENABLED = true
constexpr

Boolean toggle for regenerative braking; false disables reverse torque.

Definition at line 28 of file Pedal.hpp.

Referenced by Pedal::pedalTorqueMapping().