NXPCUP-libary
Library for car's control board on NXPCUP competition based on the Mbed framework.
Classes | List of all members
nxpcup::MotorControl Class Reference

#include <MotorControl.h>

Classes

struct  Config
 
 MotorControl (Motor &motor, Encoder &encoder, Config config)
 
void setSpeed (float desiredSpeed)
 
float desiredSpeed () const
 
float actualSpeed () const
 
void regulate (uint16_t timeSinceLastCallUs)
 
Config config () const
 
void setConfig (Config &config)
 
void reset ()
 

Constructor & Destructor Documentation

nxpcup::MotorControl::MotorControl ( Motor motor,
Encoder encoder,
Config  config 
)
inline

Constructor of class MotorControl.

Parameters
motorwhich will be regulated
encoderwith information about the motor movements
configstructConfig}

Member Function Documentation

float nxpcup::MotorControl::actualSpeed ( ) const
inline

Get actual speed.

Returns
internal state of variable actual speed in [m/s]
Config nxpcup::MotorControl::config ( ) const
inline

Get the actual configuration of theMotorControl}.

float nxpcup::MotorControl::desiredSpeed ( ) const
inline

Get desire speed.

Returns
internal state of variable desire speed in [m/s]
void nxpcup::MotorControl::regulate ( uint16_t  timeSinceLastCallUs)
inline

Calculate and set new power for motor.

Take actual speed from encoder and required speed -> calculate error -> update power.

Parameters
timeSinceLastCallUstime in microseconds from last call this function (NOT USED)
void nxpcup::MotorControl::reset ( )
inline

Reset the whole regulator.

void nxpcup::MotorControl::setConfig ( Config config)
inline

Set new configuration forMotorControl}.

Parameters
configstructConfig}
void nxpcup::MotorControl::setSpeed ( float  desiredSpeed)
inline

Set desired speed.

Parameters
desireSpeedin [m/s]

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