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

Definition of throttle and brake mapping tables. More...

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

Go to the source code of this file.

Macros

#define APPS_RATIO   53 / 34
 Ratio between 5V APPS and 3.3V APPS, use integer math to avoid float operations. Expanded to apps_scaled = apps_3v3 * APPS_RATIO.
 

Variables

constexpr uint16_t APPS_5V_MIN = 50
 
constexpr uint16_t APPS_5V_MAX = 950
 
constexpr uint16_t APPS_3V3_MIN = 50
 
constexpr uint16_t APPS_3V3_MAX = 950
 
constexpr TablePoint< uint16_t, int16_t > CURVE_TABLE [5]
 Throttle mapping table.
 
constexpr uint16_t brake_min = 50
 
constexpr uint16_t brake_max = 950
 
constexpr TablePoint< uint16_t, int16_t > BRAKE_TABLE [5]
 Brake mapping table, negative values for regen.
 
constexpr TablePoint< uint16_t, uint16_t > APPS_3V3_SCALE_TABLE [3]
 APPS_3V3 mapping table, maps 3V3 readings to 5V readings.
 
constexpr TablePoint< uint16_t, uint16_t > APPS_5V_PERCENT_TABLE [2]
 APPS_5V to percent mapping table, maps 5V readings to percent throttle (0-60000)
 
constexpr TablePoint< uint16_t, uint16_t > APPS_5V_TABLE_INVERTED [2]
 APPS percent mapping table, maps APPS percentage to 5V readings.
 
constexpr LinearInterp< uint16_t, uint16_t, uint32_t, 2 > APPS_5V_TABLE_INVERTED_MAP {APPS_5V_TABLE_INVERTED}
 LinearInterp for APPS_5V_TABLE_INVERTED, used to get APPS reading from a desired percentage.
 
constexpr TablePoint< uint16_t, int16_t > THROTTLE_TABLE [5]
 Throttle mapping table (calculated), maps APPS_5V readings to torque values.
 

Detailed Description

Definition of throttle and brake mapping tables.

Author
Planeson, Red Bird Racing
Version
1.5
Date
2026-02-09
See also
Interp.hpp, Pedal

Definition in file Curves.hpp.

Macro Definition Documentation

◆ APPS_RATIO

#define APPS_RATIO   53 / 34

Ratio between 5V APPS and 3.3V APPS, use integer math to avoid float operations. Expanded to apps_scaled = apps_3v3 * APPS_RATIO.

Note
max 64 for multiply to prevent overflow

Definition at line 28 of file Curves.hpp.

Variable Documentation

◆ APPS_3V3_MAX

constexpr uint16_t APPS_3V3_MAX = 950
constexpr

value above which apps_3v3 is considered shorted to rail

Definition at line 21 of file Curves.hpp.

Referenced by Pedal::update().

◆ APPS_3V3_MIN

constexpr uint16_t APPS_3V3_MIN = 50
constexpr

value below which apps_3v3 is considered shorted to ground

Definition at line 20 of file Curves.hpp.

Referenced by Pedal::update().

◆ APPS_3V3_SCALE_TABLE

constexpr TablePoint<uint16_t, uint16_t> APPS_3V3_SCALE_TABLE[3]
constexpr
Initial value:
= {
{189, 325},
{327, 506},
{530, 775}}

APPS_3V3 mapping table, maps 3V3 readings to 5V readings.

Definition at line 58 of file Curves.hpp.

◆ APPS_5V_MAX

constexpr uint16_t APPS_5V_MAX = 950
constexpr

value above which apps_5v is considered shorted to rail

Definition at line 18 of file Curves.hpp.

Referenced by Pedal::update().

◆ APPS_5V_MIN

constexpr uint16_t APPS_5V_MIN = 50
constexpr

value below which apps_5v is considered shorted to ground

Definition at line 17 of file Curves.hpp.

Referenced by Pedal::update().

◆ APPS_5V_PERCENT_TABLE

constexpr TablePoint<uint16_t, uint16_t> APPS_5V_PERCENT_TABLE[2]
constexpr
Initial value:
= {
{370, 0},
{740, 60000}}

APPS_5V to percent mapping table, maps 5V readings to percent throttle (0-60000)

Definition at line 66 of file Curves.hpp.

Referenced by Pedal::checkPedalFault().

◆ APPS_5V_TABLE_INVERTED

constexpr TablePoint<uint16_t, uint16_t> APPS_5V_TABLE_INVERTED[2]
constexpr
Initial value:
= {
constexpr TablePoint< uint16_t, uint16_t > APPS_5V_PERCENT_TABLE[2]
APPS_5V to percent mapping table, maps 5V readings to percent throttle (0-60000)
Definition: Curves.hpp:66

APPS percent mapping table, maps APPS percentage to 5V readings.

See also
THROTTLE_TABLE, APPS_5V_TABLE_INVERTED_MAP

Definition at line 75 of file Curves.hpp.

◆ APPS_5V_TABLE_INVERTED_MAP

constexpr LinearInterp<uint16_t, uint16_t, uint32_t, 2> APPS_5V_TABLE_INVERTED_MAP {APPS_5V_TABLE_INVERTED}
constexpr

LinearInterp for APPS_5V_TABLE_INVERTED, used to get APPS reading from a desired percentage.

See also
THROTTLE_TABLE, APPS_5V_TABLE_INVERTED

Definition at line 83 of file Curves.hpp.

◆ brake_max

constexpr uint16_t brake_max = 950
constexpr

value above which brake is considered shorted to rail

Definition at line 43 of file Curves.hpp.

Referenced by Pedal::update().

◆ brake_min

constexpr uint16_t brake_min = 50
constexpr

value below which brake is considered shorted to ground

Definition at line 42 of file Curves.hpp.

Referenced by Pedal::update().

◆ BRAKE_TABLE

constexpr TablePoint<uint16_t, int16_t> BRAKE_TABLE[5]
constexpr
Initial value:
= {
{120, 0},
{150, -15000},
{180, -26000},
{210, -31000},
{240, -32500}}

Brake mapping table, negative values for regen.

Definition at line 48 of file Curves.hpp.

◆ CURVE_TABLE

constexpr TablePoint<uint16_t, int16_t> CURVE_TABLE[5]
constexpr
Initial value:
= {
{0, 0},
{15000, 2000},
{30000, 10000},
{45000, 25000},
{60000, 32500}}

Throttle mapping table.

Definition at line 33 of file Curves.hpp.

◆ THROTTLE_TABLE

constexpr TablePoint<uint16_t, int16_t> THROTTLE_TABLE[5]
constexpr
Initial value:
= {
constexpr TablePoint< uint16_t, int16_t > CURVE_TABLE[5]
Throttle mapping table.
Definition: Curves.hpp:33
constexpr LinearInterp< uint16_t, uint16_t, uint32_t, 2 > APPS_5V_TABLE_INVERTED_MAP
LinearInterp for APPS_5V_TABLE_INVERTED, used to get APPS reading from a desired percentage.
Definition: Curves.hpp:83

Throttle mapping table (calculated), maps APPS_5V readings to torque values.

See also
CURVE_TABLE, APPS_5V_PERCENT_TABLE

Definition at line 89 of file Curves.hpp.

Referenced by loop().