Skip to content

Class evam::InertiaDecor

template <class TMotor, unsigned short tInertiaMass>

ClassList > evam > InertiaDecor

Decorator that simulates mechanical inertia (flywheel effect). More...

  • #include <evamInertiaDecor.h>

Inherits the following classes: Heartbeat, TMotor

Public Functions

Type Name
unsigned short GetInertiaMass () const
Get the current inertia mass value.
void Go (int aSpeed)
Apply the control value with inertia simulation.
InertiaDecor ()
InertiaDecor (InertiaConfig config, Args... args)
void SetInertiaMass (unsigned short aValue)
Set the inertia mass value.

Protected Functions

Type Name
void onHeartbeat () override

Detailed Description

When decelerating or stopping, speed decreases gradually over time, simulating the effect of mass and inertia. Acceleration and direction changes are applied immediately.

Template parameters:

  • Motor Base motor class (must implement Go(signed short))
  • tInertiaMass Virtual mass (positive). Larger values = slower deceleration.

Public Functions Documentation

function GetInertiaMass

Get the current inertia mass value.

inline unsigned short evam::InertiaDecor::GetInertiaMass () const

Returns:

Current inertia mass value


function Go

Apply the control value with inertia simulation.

inline void evam::InertiaDecor::Go (
    int aSpeed
) 

Parameters:

  • aSpeed Desired speed, range -1000..1000

function InertiaDecor [1/2]

inline evam::InertiaDecor::InertiaDecor () 

function InertiaDecor [2/2]

template<typename... Args>
inline evam::InertiaDecor::InertiaDecor (
    InertiaConfig config,
    Args... args
) 

function SetInertiaMass

Set the inertia mass value.

inline void evam::InertiaDecor::SetInertiaMass (
    unsigned short aValue
) 

Parameters:

  • aValue Virtual mass, clamped to 1..200

Protected Functions Documentation

function onHeartbeat

inline void evam::InertiaDecor::onHeartbeat () override


The documentation for this class was generated from the following file src/evamInertiaDecor.h