Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
trap::control::chassis::PowerLimiter Class Reference

#include <power_limiter.hpp>

Inheritance diagram for trap::control::chassis::PowerLimiter:
Collaboration diagram for trap::control::chassis::PowerLimiter:

Classes

struct  Config
 

Public Types

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

Public Member Functions

 PowerLimiter (const RefSerial &m_refereeSystem, const Config &config)
 
double getPowerLimitRatio () const override
 
void initialize () override
 
void update () override
 

Member Typedef Documentation

◆ RefSerial

Constructor & Destructor Documentation

◆ PowerLimiter()

trap::control::chassis::PowerLimiter::PowerLimiter ( const RefSerial m_refereeSystem,
const Config config 
)

Constructs a power limiter helper object.

Parameters
[in]refereeSystem

Member Function Documentation

◆ getPowerLimitRatio()

double trap::control::chassis::PowerLimiter::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.
Tested with a normal four-wheel mecanum chassis and a two-wheel sentry chassis.

◆ initialize()

void trap::control::chassis::PowerLimiter::initialize ( )
override

◆ update()

void trap::control::chassis::PowerLimiter::update ( )
override

The documentation for this class was generated from the following files: