Skip to content

# Class evam::InertiaDecor

template <class Motor, signed short kInertiaMass>

ClassList > evam > InertiaDecor

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

- `#include <evamInertiaDecor.h>`

Inherits the following classes: Heartbeat, Motor

## Public Functions

Type | Name
--- | ---
unsigned short | GetInertiaMass () const
void | Go (int aSpeed)
| InertiaDecor ()
void | SetInertiaMass (unsigned short aValue)

## 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))
- `kInertiaMass` Virtual mass (positive). Larger values = slower deceleration.

## Public Functions Documentation

### function GetInertiaMass

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

### function Go

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

### function InertiaDecor

    inline evam::InertiaDecor::InertiaDecor ()

### function SetInertiaMass

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

## 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`