Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package

Miscellaneous collection of useful utilities. More...

#include "rnr/rnrconfig.h"
#include "rnr/units.h"

Go to the source code of this file.

Functions

INLINE_IN_H int imax (int a, int b)
 Return maximum integer of a and b. More...
 
INLINE_IN_H int imin (int a, int b)
 Return minimum integer of a and b. More...
 
INLINE_IN_H int iabs (int a)
 Return absolute value of a. More...
 
INLINE_IN_H int irange (int a, int m, int M)
 Return value of a within minimum,maximum range. More...
 
INLINE_IN_H int imod (int a, int b)
 a mod b, ≥ 0. More...
 
INLINE_IN_H const char * dynaUnitsSym (units_t u)
 Convert units to short symbol name. More...
 

Detailed Description

Miscellaneous collection of useful utilities.

LastChangedDate
2015-01-12 10:56:06 -0700 (Mon, 12 Jan 2015)
Rev
3845
Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)

Definition in file DynaOlio.h.

Function Documentation

INLINE_IN_H const char* dynaUnitsSym ( units_t  u)

Convert units to short symbol name.

Parameters
uUnits to look up.
Returns
Symbol name string.

Definition at line 132 of file DynaOlio.h.

133 {
134  return u==units_raw? "": units_shortname(u);
135 }
INLINE_IN_H int iabs ( int  a)

Return absolute value of a.

Parameters
aInteger value a.
Returns
Absolute value.

Definition at line 91 of file DynaOlio.h.

Referenced by DynaServoGeneric::AgentWriteGoalSpeed(), DynaServoGeneric::AgentWriteGoalSpeedPos(), DynaPidSpeed::CalcDpDt(), DynaBgThread::execPosCtl(), DynaServoGeneric::PackGoalSpeed(), DynaChain::SyncWriteGoalSpeed(), DynaServo::UpdateOdometer(), and DynaServoGeneric::WriteGoalSpeed().

92 {
93  return a>=0? a: -a;
94 }
INLINE_IN_H int imax ( int  a,
int  b 
)

Return maximum integer of a and b.

Parameters
aInteger value a.
bInteger value b.
Returns
Maximum value.

Definition at line 66 of file DynaOlio.h.

67 {
68  return a>=b? a: b;
69 }
INLINE_IN_H int imin ( int  a,
int  b 
)

Return minimum integer of a and b.

Parameters
aInteger value a.
bInteger value b.
Returns
Minimum value.

Definition at line 79 of file DynaOlio.h.

80 {
81  return a<=b? a: b;
82 }
INLINE_IN_H int imod ( int  a,
int  b 
)

a mod b, ≥ 0.

param a The dividend. param b The divisor.

Returns
The remainder in [0, b-1].

Definition at line 119 of file DynaOlio.h.

Referenced by DynaServo::OdometerToEncoder().

120 {
121  a = a % b;
122  return a >= 0? a: a+b;
123 }
INLINE_IN_H int irange ( int  a,
int  m,
int  M 
)

Return value of a within minimum,maximum range.

Parameters
aInteger value a.
mMinimum value of a.
MMaximum value of a.
Returns
Adjusted value of a in range [m,M].

Definition at line 105 of file DynaOlio.h.

106 {
107  return a<m? m: a>M? M: a;
108 }