EEEN21000
GROUP 30 Line Following Buggy
Loading...
Searching...
No Matches
helper.h File Reference
#include "encoder.h"
#include "mbed.h"
#include <functional>
Include dependency graph for helper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T >
constexpr const T & clamp (const T &v, const T &lo, const T &hi)
 Clamp the value between [lo,high]. More...
 
template<class T >
constexpr const T speed_to_pps (const T &speed)
 Convert m/s to pulse per sec(PPS). More...
 
template<class T >
constexpr const T radiansToDegrees (const T &angle)
 Convert radians to degree. More...
 

Function Documentation

◆ clamp()

template<class T >
constexpr const T & clamp ( const T &  v,
const T &  lo,
const T &  hi 
)
constexpr

Clamp the value between [lo,high].

Template Parameters
TType to work with. This project use mostly float.
Parameters
vOriginal value.
loLower bound.
hiUpper bound.
Returns
constexpr const T& Clamped value.

◆ speed_to_pps()

template<class T >
constexpr const T speed_to_pps ( const T &  speed)
constexpr

Convert m/s to pulse per sec(PPS).

Template Parameters
TType to work with. This project use mostly double.
Parameters
speedoriginal speed.
Returns
constexpr const T converted pps.

◆ radiansToDegrees()

template<class T >
constexpr const T radiansToDegrees ( const T &  angle)
constexpr

Convert radians to degree.

Template Parameters
TType to work with. This project use mostly double.
Parameters
angleangle in radians
Returns
constexpr const T angle in degrees