Class PowerLimiter

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public rail::chassis::IPowerLimiterSystem

Class Documentation

class PowerLimiter : public rail::chassis::IPowerLimiterSystem

Public Types

using RefSerial = tap::communication::serial::RefSerial

Public Functions

PowerLimiter(const RefSerial &m_refereeSystem, const Config &config)

Constructs a power limiter helper object.

Parameters:

refereeSystem[in]

double getPowerLimitRatio() const override

A function to be called repeatedly (in a subsystem’s refresh function, for example). Checks the voltage through the referee system and the current using the current sensor to calculate current power consumption, which is used to update the energy buffer by integrating power. Once the energy buffer is known, it is used in conjunction with the constants passed in through the constructor to compute a fraction that can be used to perform power limiting.

Note

Must be called immediately after setpoints are configured. This function returns a value between [0, 1] that you should then multiply the desired output of your motor by. See class comment for more details.

Note

Tested with a normal four-wheel mecanum chassis and a two-wheel sentry chassis.

void initialize() override
void update() override
struct Config
Param energyBufferLimitThreshold:

[in] Energy in Joules. The amount of energy left in the energy buffer before power limiting is applied.

Param energyBufferCritThreshold:

[in] Energy in Joules. If the amount of energy in the energy buffer is equal or less than this value, the power limiting fraction will be 0.

Public Members

Joules startingEnergyBuffer
Joules energyBufferLimitThreshold
Joules energyBufferCritThreshold