Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps Namespace Reference

The Laelaps namespace encapsulates all Laelaps related constructs. More...

Classes

class  Dim
 Object width x height x length dimensions class. More...
 
struct  LaeAlarmInfo
 Alarm information state structure. More...
 
class  LaeAlarms
 Alarm class. More...
 
class  LaeAsyncJob
 Asynchronous job base class. More...
 
class  LaeAux5VOutEnable
 Laelaps top deck auxilliary regulated 5V power out enable class. More...
 
class  LaeAuxBattOutEnable
 Laelaps top deck auxilliary battery power out enable class. More...
 
class  LaeBattery
 Battery Management and System Energy Monitoring (BMSEM) Class. More...
 
struct  LaeDb
 Simple real-time database structure. More...
 
struct  LaeDbAlarms
 System and subsystem alarms and warnings data tree. More...
 
struct  LaeDbConfig
 Robot configuration parameters. More...
 
struct  LaeDbEnable
 Enabled subsytems. More...
 
struct  LaeDbEnergy
 Energy monitoring data. More...
 
struct  LaeDbImu
 IMU sensor data. More...
 
struct  LaeDbKin
 Kinodynamics data. More...
 
struct  LaeDbKinPowertrain
 Powertrain kinodynamics data. More...
 
struct  LaeDbKinRobot
 Robot platform kinodynamics data. More...
 
struct  LaeDbMotorCtlr
 Motor controller data. More...
 
struct  LaeDbProduct
 Product data. More...
 
struct  LaeDbRange
 Range sensor data. More...
 
struct  LaeDbRobotStatus
 Robot top-level status. More...
 
class  LaeDesc
 Laelaps robotic mobile platform full description class. More...
 
class  LaeDescBase
 Robotic base platform description. More...
 
class  LaeDescBattery
 Battery description. More...
 
class  LaeDescImu
 Robotic built-in IMU description. More...
 
class  LaeDescOptions
 Package options class. More...
 
class  LaeDescPowertrain
 Robotic powertrain description. More...
 
class  LaeDescRangeSensor
 Range sensor description. More...
 
class  LaeGpio
 Laelaps Odroid GPIO base class. More...
 
class  LaeI2C
 
class  LaeI2CMux
 control register mask More...
 
class  LaeI2CMuxReset
 Laelaps I2C multiplexer reset class. More...
 
class  LaeKinAction
 Laelaps kinematics base action class. More...
 
class  LaeKinActionDutyCycle
 Laelaps kinematics duty cycle action class. More...
 
class  LaeKinActionTwist
 Laelaps kinematics velocity action class. More...
 
class  LaeKinActionVelocity
 Laelaps kinematics velocity action class. More...
 
class  LaeKinematics
 Laelaps kinematics class. More...
 
class  LaeMotorCtlrChipSelect
 RoboClaw motor controller chip select class. More...
 
class  LaeMotorCtlrEnable
 Laelaps motor controller power enable class. More...
 
class  LaeMotorCtlrState
 Robot base motor controller board state. More...
 
class  LaePath
 Robot path class. More...
 
class  LaePathFeedback
 Simple path feedback class. More...
 
class  LaePlatform
 Robot platform control and state data class. More...
 
class  LaePoint
 Laelaps 2D point class. More...
 
class  LaePose
 Laelaps 2D pose class. More...
 
class  LaePowertrain
 Powertrain data class. More...
 
class  LaePowertrainAttr
 Powertrain attributes class. More...
 
class  LaePowertrainState
 Powertrain state data class. More...
 
class  LaeRobot
 Laelaps robotic manipulator plus accesories class. More...
 
class  LaeRptDynamics
 Laelaps dynamics report. More...
 
class  LaeRptDynPowertrain
 Powertrain dynamics subreport. More...
 
class  LaeRptMotorCtlrHealth
 Robot motor health. More...
 
class  LaeRptMotorHealth
 Robot motor health. More...
 
class  LaeRptRobotStatus
 Robot global status report. More...
 
class  LaeSimplePath
 Robot simple path class. More...
 
class  LaeSimplePathFeedback
 Simple path feedback class. More...
 
class  LaeSimpleWaypoint
 Robot simple path waypoint. More...
 
class  LaeThread
 
class  LaeThreadAsync
 
class  LaeThreadImu
 
class  LaeThreadKin
 
class  LaeThreadRange
 
class  LaeThreadWd
 
class  LaeTunes
 Laelaps tuning data class. More...
 
class  LaeTunesBattery
 Laelaps battery tuning data class. More...
 
class  LaeTunesPowertrain
 Laelaps powertrain tuning data class. More...
 
class  LaeTunesVL6180
 Laelaps powertrain tuning data class. More...
 
class  LaeWatchDogReset
 Laelaps watchdog sub-processor reset class. More...
 
class  LaeWaypoint
 Robot fully-defined waypoint. More...
 
class  LaeWd
 
class  LaeXmlCfg
 LaeXmlCfg Laelaps XML configuration class. More...
 
class  LaeXmlTune
 LaeXmlTune Laelaps XML tuning class. More...
 

Functions

int i2cTryOpen (LaeI2C &i2cBus, uint_t addr)
 Try to open a series of I2C devices to fine the required endpoint. More...
 
uint_t strToVersion (const std::string &str)
 Convert version dotted string to integer equivalent. More...
 
const char * getStrError (const int ecode)
 Get the error string describing the Laelaps error code. More...
 
const char * boolstr (bool b)
 Boolean to string. More...
 
double degToRad (double d)
 Convert degrees to radians. More...
 
double radToDeg (double r)
 Convert radians to degrees. More...
 
int iabs (int a)
 Integer absolute value. More...
 
double fcap (double a, double min, double max)
 Cap value within limits [min, max]. More...
 
int cap (int a, int min, int max)
 Cap value within limits [min, max]. More...
 
uint_t cap (uint_t a, uint_t min, uint_t max)
 Cap value within limits [min, max]. More...
 
double signof (double a)
 Sign of a. More...
 
int signof (int a)
 Sign of a. More...
 
bool operator< (const struct timeval &lhs, const struct timeval &rhs)
 Less than compare operator. More...
 
bool operator== (const struct timeval &lhs, const struct timeval &rhs)
 Equality compare operator. More...
 
bool operator> (const struct timeval &lhs, const struct timeval &rhs)
 Greater than compare operator. More...
 
bool operator<= (const struct timeval &lhs, const struct timeval &rhs)
 Less than or equal to compare operator. More...
 
bool operator>= (const struct timeval &lhs, const struct timeval &rhs)
 Greater than or equal to compare operator. More...
 
struct timeval operator+ (const struct timeval &op1, const struct timeval &op2)
 Addition operator. More...
 
struct timeval operator- (const struct timeval &op1, const struct timeval &op2)
 Subtraction operator. More...
 
long dt_usec (struct timeval &t1, struct timeval &t0)
 Calculate delta time in microseconds. More...
 
double dt (struct timeval &t1, struct timeval &t0)
 Calculate delta time. More...
 
bool operator< (const struct timespec &lhs, const struct timespec &rhs)
 Less than compare operator. More...
 
bool operator== (const struct timespec &lhs, const struct timespec &rhs)
 Equality compare operator. More...
 
bool operator> (const struct timespec &lhs, const struct timespec &rhs)
 Greater than compare operator. More...
 
bool operator<= (const struct timespec &lhs, const struct timespec &rhs)
 Less than or equal to compare operator. More...
 
bool operator>= (const struct timespec &lhs, const struct timespec &rhs)
 Greater than or equal to compare operator. More...
 
struct timespec operator+ (const struct timespec &op1, const struct timespec &op2)
 Addition operator. More...
 
struct timespec operator- (const struct timespec &op1, const struct timespec &op2)
 Subtraction operator. More...
 
long long dt_nsec (struct timespec &t1, struct timespec &t0)
 Calculate delta time in nanoseconds. More...
 
double dt (struct timespec &t1, struct timespec &t0)
 Calculate delta time. More...
 
std::string getRealDeviceName (const std::string &strDevName)
 Get real device name. More...
 
std::vector< std::string > & split (const std::string &s, char delim, std::vector< std::string > &elems)
 Split string at the delimiter character. More...
 
std::vector< std::string > split (const std::string &s, char delim)
 Split string at the delimiter character. More...
 

Detailed Description

The Laelaps namespace encapsulates all Laelaps related constructs.

< use to delete old code

The Laelaps namespace encapsulates all Laelaps related constructs.

Function Documentation

const char* laelaps::boolstr ( bool  b)
inline

Boolean to string.

Parameters
bBoolean value.
Returns
Pointer to null-terminated constant character string.

Definition at line 107 of file laeUtils.h.

108  {
109  return b? "true": "false";
110  }
int laelaps::cap ( int  a,
int  min,
int  max 
)
inline

Cap value within limits [min, max].

Parameters
aValue.
minMinimum.
maxMaximum.
Returns
a: min ≤ a ≤ max

Definition at line 176 of file laeUtils.h.

Referenced by motor::roboclaw::RoboClaw::cmdQDriveWithProfileToPos(), sensor::vl6180::LaeRangeMuxSubproc::cmdTuneAls(), sensor::vl6180::LaeRangeMuxSubproc::cmdTuneToFSensor(), laelaps::LaeThread::createThread(), and sensor::vl6180::LaeVL6180Mux::tune().

177  {
178  return a<min? min: a>max? max: a;
179  }
uint_t laelaps::cap ( uint_t  a,
uint_t  min,
uint_t  max 
)
inline

Cap value within limits [min, max].

Parameters
aValue.
minMinimum.
maxMaximum.
Returns
a: min ≤ a ≤ max

Definition at line 190 of file laeUtils.h.

191  {
192  return a<min? min: a>max? max: a;
193  }
double laelaps::degToRad ( double  d)
inline

Convert degrees to radians.

Parameters
dDegrees.
Returns
Radians.

Definition at line 124 of file laeUtils.h.

References M_TAU.

Referenced by sensor::imu::LaeImuCleanFlight::convertRawToSI(), sensor::vl6180::LaeVL6180Mux::getFoV(), sensor::vl6180::LaeVL6180SensorInfo::getProps(), laelaps::LaeTunes::LaeTunes(), and laelaps::LaeXmlTune::setGlobalTrajTunes().

125  {
126  return d / 360.0 * M_TAU;
127  }
#define M_TAU
tau = 2 * pi
Definition: laeUtils.h:66
double laelaps::dt ( struct timeval &  t1,
struct timeval &  t0 
)

Calculate delta time.

t1 - t0

Parameters
t1Time 1.
t0Time 0.
Returns
Returns dt as a double. May be negative.
double laelaps::dt ( struct timespec &  t1,
struct timespec &  t0 
)

Calculate delta time.

t1 - t0

Parameters
t1Time 1.
t0Time 0.
Returns
Returns dt as a double. May be negative.
long long laelaps::dt_nsec ( struct timespec &  t1,
struct timespec &  t0 
)

Calculate delta time in nanoseconds.

t1 - t0, t1 ≥ t0

Parameters
t1Later time.
t0Earlier time.
Returns
Returns dt in nanoseconds.
long laelaps::dt_usec ( struct timeval &  t1,
struct timeval &  t0 
)

Calculate delta time in microseconds.

t1 - t0, t1 ≥ t0

Parameters
t1Later time.
t0Earlier time.
Returns
Returns dt in microseconds.
double laelaps::fcap ( double  a,
double  min,
double  max 
)
inline

Cap value within limits [min, max].

Parameters
aValue.
minMinimum.
maxMaximum.
Returns
a: min ≤ a ≤ max

Definition at line 162 of file laeUtils.h.

Referenced by motor::roboclaw::RoboClaw::cmdReadLogicCutoffs(), motor::roboclaw::RoboClaw::cmdReadMainBattCutoffs(), laelaps::LaeRobot::setGovernor(), laelaps::LaeThread::setHz(), and laelaps::LaePowertrain::updateStateDynamics().

163  {
164  return a<min? min: a>max? max: a;
165  }
std::string laelaps::getRealDeviceName ( const std::string &  strDevName)

Get real device name.

If the given device name is a symbolic link, then the real device the link references is returned. Otherwise the given device name is returned.

Parameters
strDevNameGiven device name.
Returns
String.

Referenced by laelaps::LaeI2C::open(), laelaps::LaeKinematics::open(), and sensor::imu::LaeImu::open().

const char* laelaps::getStrError ( const int  ecode)

Get the error string describing the Laelaps error code.

The absolute value of the error code is taken prior retrieving the string. An unknown or out-of-range error code will be mapped to LAE_ECODE_BADEC.

Parameters
ecodeInstance of Laelaps Error Codes.
Returns
Returns the appropriate error code string.
int laelaps::i2cTryOpen ( LaeI2C i2cBus,
uint_t  addr 
)

Try to open a series of I2C devices to fine the required endpoint.

If the enpoint does not exist, the device is closed and the next device is tried.

On success, the device bus is left open.

Parameters
i2cBusThe I2C bus.
addrEndpoint I2C device's 7/10-bit address.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 67 of file laeI2C.cxx.

References laelaps::LaeI2C::check(), laelaps::LaeI2C::close(), and laelaps::LaeI2C::open().

Referenced by laelaps::LaeRobot::connect(), and laelaps::LaeI2C::unlock().

68 {
69  const char *devNames[] = { LaeDevI2C_0, LaeDevI2C_1, LaeDevI2C_2, NULL };
70 
71  int rc;
72 
73  for(int i = 0; devNames[i] != NULL; ++i)
74  {
75  LOGDIAG2("Try I2C device %s.", devNames[i]);
76 
77  if( (rc = i2cBus.open(devNames[i])) == LAE_OK )
78  {
79  if( i2cBus.check(addr) )
80  {
81  LOGDIAG2("Address 0x%02x found on I2C device %s.", addr, devNames[i]);
82  return LAE_OK;
83  }
84  else
85  {
86  LOGDIAG2("No address 0x%02x found on I2C device %s.",
87  addr, devNames[i]);
88  i2cBus.close();
89  }
90  }
91  }
92  rc = -LAE_ECODE_NO_DEV;
93 }
virtual int open(const std::string &strDevName)
Open I2C bus device.
Definition: laeI2C.cxx:114
virtual int close()
Close I2C bus device.
Definition: laeI2C.cxx:144
virtual bool check(uint_t addr)
Check if an I2C slave endpoint exists.
Definition: laeI2C.cxx:162
int laelaps::iabs ( int  a)
inline

Integer absolute value.

Parameters
aInteger value.
Returns
|a|

Definition at line 148 of file laeUtils.h.

149  {
150  return a>=0? a: -a;
151  }
struct timeval laelaps::operator+ ( const struct timeval &  op1,
const struct timeval &  op2 
)

Addition operator.

op1 + op2

Parameters
op1Left hand side time.
op2Right hand side time.
Returns
Sum of times.
struct timespec laelaps::operator+ ( const struct timespec &  op1,
const struct timespec &  op2 
)

Addition operator.

op1 + op2

Parameters
op1Left hand side time.
op2Right hand side time.
Returns
Sum of times.
struct timeval laelaps::operator- ( const struct timeval &  op1,
const struct timeval &  op2 
)

Subtraction operator.

op1 - op2, op1 ≥ op2.

Parameters
op1Left hand side time.
op2Right hand side time.
Returns
Difference of times.
struct timespec laelaps::operator- ( const struct timespec &  op1,
const struct timespec &  op2 
)

Subtraction operator.

op1 - op2, op1 ≥ op2.

Parameters
op1Left hand side time.
op2Right hand side time.
Returns
Difference of times.
bool laelaps::operator< ( const struct timeval &  lhs,
const struct timeval &  rhs 
)

Less than compare operator.

Compare if the left hand side time is earlier than the right hand side time.

lhs < rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator< ( const struct timespec &  lhs,
const struct timespec &  rhs 
)

Less than compare operator.

Compare if the left hand side time is earlier than the right hand side time.

lhs < rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator<= ( const struct timeval &  lhs,
const struct timeval &  rhs 
)

Less than or equal to compare operator.

Compare if the left hand side time is equal or earlier than the right hand side time.

lhs ≤ rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator<= ( const struct timespec &  lhs,
const struct timespec &  rhs 
)

Less than or equal to compare operator.

Compare if the left hand side time is equal or earlier than the right hand side time.

lhs ≤ rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator== ( const struct timeval &  lhs,
const struct timeval &  rhs 
)

Equality compare operator.

Compare if the two times are equal.

lhs == rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator== ( const struct timespec &  lhs,
const struct timespec &  rhs 
)

Equality compare operator.

Compare if the two times are equal.

lhs == rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator> ( const struct timeval &  lhs,
const struct timeval &  rhs 
)

Greater than compare operator.

Compare if the left hand side time is later than the right hand side time.

lhs > rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator> ( const struct timespec &  lhs,
const struct timespec &  rhs 
)

Greater than compare operator.

Compare if the left hand side time is later than the right hand side time.

lhs > rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator>= ( const struct timeval &  lhs,
const struct timeval &  rhs 
)

Greater than or equal to compare operator.

Compare if the left hand side time is equal or later than the right hand side time.

lhs ≥ rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
bool laelaps::operator>= ( const struct timespec &  lhs,
const struct timespec &  rhs 
)

Greater than or equal to compare operator.

Compare if the left hand side time is equal or later than the right hand side time.

lhs ≥ rhs

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.
double laelaps::radToDeg ( double  r)
inline

Convert radians to degrees.

Parameters
rRadians.
Returns
Degrees.

Definition at line 136 of file laeUtils.h.

References M_TAU.

Referenced by sensor::vl6180::LaeRangeMuxSubproc::configure(), laelaps::LaeDescRangeSensor::makeDesc(), laelaps::LaeDescRangeSensor::print(), laelaps::LaeTunes::print(), and laelaps::LaeKinActionTwist::update().

137  {
138  return r / M_TAU * 360.0;
139  }
#define M_TAU
tau = 2 * pi
Definition: laeUtils.h:66
double laelaps::signof ( double  a)
inline

Sign of a.

Returns
Return 1.0 or -1.0.

Definition at line 200 of file laeUtils.h.

201  {
202  return a<0? -1.0: 1.0;
203  }
int laelaps::signof ( int  a)
inline

Sign of a.

Returns
Return 1 or -1.

Definition at line 210 of file laeUtils.h.

211  {
212  return a<0? -1: 1;
213  }
std::vector<std::string>& laelaps::split ( const std::string &  s,
char  delim,
std::vector< std::string > &  elems 
)

Split string at the delimiter character.

Parameters
sString to split.
delemDelimiter character.
[out]elemsVector of split strings.
Returns
Reference to vector of split strings.

Referenced by laelaps::LaeXmlCfg::load(), and laelaps::LaeXmlTune::load().

std::vector<std::string> laelaps::split ( const std::string &  s,
char  delim 
)

Split string at the delimiter character.

Parameters
sString to split.
delemDelimiter character.
Returns
Vector of split strings.
uint_t laelaps::strToVersion ( const std::string &  str)

Convert version dotted string to integer equivalent.

Parameters
strDotted version string "M[.m[.R]]".
Returns
Version number.

Referenced by laelaps::LaeXmlCfg::setBaseDesc(), and laelaps::LaeDesc::setVersion().