62 #include "rnr/rnrconfig.h" 102 LaeDescBase::LaeDescBase() :
103 m_strKey(
LaeDesc::KeyRobotBase),
174 printf(
"%*sPlatform Description =\n", indent,
"");
175 printf(
"%*s{\n", indent,
"");
177 printf(
"%*sKey = %s\n", indent+2,
"",
m_strKey.c_str());
179 printf(
"%*sOuter Dimensions =\n", indent+2,
"");
180 printf(
"%*s{\n", indent+2,
"");
184 printf(
"%*s}\n", indent+2,
"");
186 printf(
"%*sBody Dimensions =\n", indent+2,
"");
187 printf(
"%*s{\n", indent+2,
"");
191 printf(
"%*s}\n", indent+2,
"");
193 printf(
"%*sWheelbase = %.3lf\n", indent+2,
"",
m_fWheelbase);
194 printf(
"%*sWheeltrack = %.3lf\n", indent+2,
"",
m_fWheeltrack);
196 printf(
"%*sNumber of Motors = %d\n", indent+2,
"",
m_nNumMotors);
198 printf(
"%*s}\n", indent,
"");
244 LOGWARN(
"Powertrain %s: Unknown.", strKey.c_str());
283 printf(
"%*sPowertrain[%s] Description =\n", indent,
"",
m_strKey.c_str());
284 printf(
"%*s{\n", indent,
"");
285 printf(
"%*sKey = %s\n", indent+2,
"",
m_strKey.c_str());
286 printf(
"%*sMotor Id = %d\n", indent+2,
"", m_nMotorId);
287 printf(
"%*sMotor Ctlr Id = %d\n", indent+2,
"", m_nMotorCtlrId);
288 printf(
"%*sMotor Index = %d\n", indent+2,
"", m_nMotorIndex);
289 printf(
"%*sJoint Type = %d\n", indent+2,
"", m_eJointType);
290 printf(
"%*sEncoder Type = 0x%02x\n", indent+2,
"", m_eEncType);
291 printf(
"%*sDirection = %d\n", indent+2,
"", m_nDir);
292 printf(
"%*s}\n", indent,
"");
344 printf(
"%*sBattery Description =\n", indent,
"");
345 printf(
"%*s{\n", indent,
"");
346 printf(
"%*sKey = %s\n", indent+2,
"",
m_strKey.c_str());
347 printf(
"%*sType = %s\n", indent+2,
"",
m_strType.c_str());
348 printf(
"%*sChemistry = %s\n", indent+2,
"",
m_strChemistry.c_str());
349 printf(
"%*sCapacity Ah = %.2lf\n", indent+2,
"",
m_fCapacity);
350 printf(
"%*sCells = %d\n", indent+2,
"",
m_nNumCells);
351 printf(
"%*sMax V = %.2lf\n", indent+2,
"",
m_fMaxV);
352 printf(
"%*sNominal V = %.2lf\n", indent+2,
"",
m_fNomV);
353 printf(
"%*sMin V = %.2lf\n", indent+2,
"",
m_fMinV);
354 printf(
"%*s}\n", indent,
"");
369 if( strKey ==
"front" )
375 else if( strKey ==
"left_front" )
381 else if( strKey ==
"left" )
387 else if( strKey ==
"left_rear" )
393 else if( strKey ==
"rear" )
399 else if( strKey ==
"right_rear" )
405 else if( strKey ==
"right" )
411 else if( strKey ==
"right_front" )
419 LOGWARN(
"Range Sensor %s: Unknown.", strKey.c_str());
452 printf(
"%*sRange Sensor[%s] Description =\n", indent,
"",
m_strKey.c_str());
453 printf(
"%*s{\n", indent,
"");
454 printf(
"%*sKey = %s\n", indent+2,
"",
m_strKey.c_str());
455 printf(
"%*sChannel Number = %d\n", indent+2,
"", m_nChan);
456 printf(
"%*sDirection = %.1lf\n", indent+2,
"",
radToDeg(m_fDir));
457 printf(
"%*sDeadZone = %.3lf\n", indent+2,
"", m_fDeadzone);
458 printf(
"%*s}\n", indent,
"");
467 m_strDesc =
"Unknown sensor";
471 ss <<
"Range sensor at " 475 m_strDesc = ss.str();
486 m_strFw(
"CleanFlight")
512 printf(
"%*sIMU Description =\n", indent,
"");
513 printf(
"%*s{\n", indent,
"");
514 printf(
"%*sKey = %s\n", indent+2,
"",
m_strKey.c_str());
515 printf(
"%*sHardware = %s\n", indent+2,
"",
m_strHw.c_str());
516 printf(
"%*sFirmware = %s\n", indent+2,
"",
m_strFw.c_str());
517 printf(
"%*s}\n", indent,
"");
554 printf(
"%*sPackage Options =\n", indent,
"");
555 printf(
"%*s{\n", indent,
"");
556 printf(
"%*sTime-of-Flight Package = %s\n", indent+2,
"",
m_strPkgToF.c_str());
557 printf(
"%*sFront Camera Package = %s\n", indent+2,
"",
m_strPkgFCam.c_str());
558 printf(
"%*s}\n", indent,
"");
585 "front",
"left_front",
"left",
"left_rear",
586 "rear",
"right_rear",
"right",
"right_front" 591 "front",
"left_front",
"right_front" 599 std::stringstream ss;
605 str[0] = std::toupper(str[0], loc);
613 std::stringstream ss;
617 << std::hex << std::setfill(
'0') << std::setw(2) << (unsigned)addr
621 str[0] = std::toupper(str[0], loc);
629 std::stringstream ss;
636 str[0] = std::toupper(str[0], loc);
637 if( (n = str.find_first_of(
'_')) != str.npos )
639 str.replace(n, 1,
" ");
647 std::stringstream ss;
724 LOGERROR(
"Version %s: Laelaps robot version unsupported.",
731 LOGERROR(
"Laelaps robot description is undefined.");
735 LOGERROR(
"ProdId %d: Unknown Laelaps robot product id.",
m_eProdId);
800 return "Laelaps-Standard";
802 return "Laelaps-Large";
813 return "RoadNarrows Laelaps Standard robotic mobile platform";
815 return "RoadNarrows Laelaps Large robotic mobile platform";
823 printf(
"%*sRobot Description =\n", indent,
"");
824 printf(
"%*s{\n", indent,
"");
826 printf(
"%*sProduct Id = %d\n", indent+2,
"",
m_eProdId);
827 printf(
"%*sProduct Family = %s\n", indent+2,
"",
m_strProdFamily.c_str());
828 printf(
"%*sProduct Model = %s\n", indent+2,
"",
m_strProdModel.c_str());
829 printf(
"%*sProduct Full Name = %s\n", indent+2,
"",
m_strProdName.c_str());
830 printf(
"%*sProduct Brief = %s\n", indent+2,
"",
m_strProdBrief.c_str());
831 printf(
"%*sHardware Version = %s\n", indent+2,
"",
m_strProdHwVer.c_str());
832 printf(
"%*sHardware Version = 0x%08x\n", indent+2,
"",
m_uProdHwVer);
848 iter->second->print(indent+2);
855 iter->second->print(indent+2);
863 printf(
"%*s}\n", indent,
"");
static const int LaeMotorIdRR
right rear
const double ToFSensor6Deadzone
sensor 6 8mm deadzone
LaeDescBattery operator=(const LaeDescBattery &rhs)
Assignment operator.
const char *const LaeTuneBattType
Fixed battery type.
double m_fWheelbase
wheelbase(m)
const double ToFSensor6Dir
sensor 6 direction
int m_eProdId
base product id
const double ToFSensor4Deadzone
sensor 4 8mm deadzone
LaeDescPowertrain operator=(const LaeDescPowertrain &rhs)
Assignment operator.
virtual ~LaeDescOptions()
Destructor.
static const int LaeMotorCtlrIdRear
rear motor controller
LaeDescRangeSensor operator=(const LaeDescRangeSensor &rhs)
Assignment operator.
LaeDescOptions operator=(const LaeDescOptions &rhs)
Assignment operator.
LaeDescBase * m_pDescBase
base description
Laelaps robotic mobile platform full description class.
LaeDbProduct m_product
product data
void clear()
Clear description.
double m_fDir
sensor direction (radians)
static std::string prettyMotorName(int nMotorId)
Create pretty motor/powertrain identifier string.
const double ToFSensor7Dir
sensor 7 direction
static const int LaeMotorDirNormal
normal
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
int m_nNumMotors
number of motors
LaeDescImu * m_pDescImu
built-in imu description
double m_fDeadzone
deadzone (meters)
static const int LaeProdIdStd
standard Laelaps product id
std::string m_strProdBrief
product brief
static const int LaeProdIdLarge
large Laelaps product id
uint_t m_uProdHwVer
product hardware version number
std::string m_strChemistry
battery chemistry
double m_fCapacity
battery capacity(Ah)
std::string m_strKey
range sensor key
const double ToFSensor0Deadzone
sensor 0 8mm deadzone
LaeDescBase operator=(const LaeDescBase &rhs)
Assignment operator.
void clear()
Clear description.
virtual void print(int indent=0)
Print out description to stdout.
const int ToFSensorStdNumOf
max num of ToF sensors for std option
const int ToFSensor7Chan
sensor 7 channel (bit) number
static const int LaeMotorsNumOf
number of motors
const double ToFSensor4Dir
sensor 4 direction
const double LaeTuneTireRadiusDft
Default tire radius (meters).
static const int LaeMotorIdNone
no motor id
double m_length
object length (meters)
Object width x height x length dimensions class.
static const char *const LaeKeyLeftRear
left rear
static const char *const LaeKeyRightFront
right front
const double LaeTuneBattNominalV
Fixed nominal operating voltage.
virtual void print(int indent=0)
Print out description to stdout.
double m_fMinV
battery minimum low at cutoff (V)
void clear()
Clear description.
static const char *const LaeKeyRear
rear
std::string m_strKey
base name
const double LaeTuneBattMinVDft
static const char *const PkgOptDeluxe
deluxe package option
void clear()
Clear description to the "unitialized" values.
static const char *const LaeKeyFront
front
LaeEncType m_eEncType
encoder type
const double ToFSensor5Deadzone
sensor 5 14.5mm deadzone
const double ToFSensor1Deadzone
sensor 1 14.5mm deadzone
std::string m_strHw
hardware
const int ToFSensorMaxNumOf
maximum number of ToF sensors
LaeDb RtDb
The real-time database.
const double ToFSensor0Dir
sensor 0 direction
void setVersion()
Set version number from parsed version string.
std::string getProdBrief() const
Get this base description's brief.
static const int LaeMotorLeft
left motors
std::string m_strPkgToF
range time-of-flight package
std::string m_strFw
firmware
LaeDescImu()
Default constructor.
const int ToFSensor1Chan
sensor 1 channel (bit) number
const int ToFSensor2Chan
sensor 2 channel (bit) number
double radToDeg(double r)
Convert radians to degrees.
LaeDescOptions()
Default constructor.
virtual void print(int indent=0)
Print out description to stdout.
static const int LaeProdIdUnknown
unknown/undefined product id
const double ToFSensor2Deadzone
sensor 2 8mm deadzone
LaeJointType m_eJointType
powertrain joint type
static const int LaeMotorIdRF
right front
Robotic built-in IMU description.
LaeDescPowertrain()
Default constructor.
static const int LaeMotorIdLR
left rear
int m_nNumMotorCtlrs
number of motor controllers
int m_nDir
normalize cw/ccw direction.
std::string m_strProdModel
product model
virtual ~LaeDescImu()
Destructor.
static const char *const LaeKeyRightRear
right rear
Robotic powertrain description.
const int ToFSensor6Chan
sensor 6 channel (bit) number
virtual ~LaeDescPowertrain()
Destructor.
double m_fMaxV
battery maximum high charge (V)
virtual void print(int indent=0)
Print out description to stdout.
MapDescPowertrain m_mapDescPowertrain
powertrain descriptions
LaeDescBattery()
Default constructor.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Laelaps robotic base mobile platform description class interface.
const int ToFSensor0Chan
sensor 0 channel (bit) number
const double ToFSensor3Deadzone
sensor 3 14.5mm deadzone
const int ToFSensor5Chan
sensor 5 channel (bit) number
LaeDescBattery * m_pDescBattery
internal battery description
static const Dim LaeDimFrontBumper(0.025, 0.038, 0.190)
Front bumper dimensions (W x H x L).
std::string m_strProdHwVer
product hardware version string
void clear()
Clear description.
virtual ~LaeDescBattery()
Destructor.
Laelaps common utilities.
std::string m_strProdFamily
product family
uint_t m_uProdHwVer
product hardware version number
void clear()
Clear description.
const double LaeTuneTireWidthDft
Default tire width (meters).
double m_height
object height (meters)
int markAsDescribed()
Mark <b><i>Laelaps</i></b> hardware as fully described.
int m_nMotorId
unique robot motor id
int m_eProdId
base product id
Dim m_dimBody
body dimensions(m)
static const Dim LaeDimBody(0.250, 0.080, 0.350)
Laelaps body dimensions (W x H x L).
std::string m_strPkgFCam
front camera package
static const char *const KeyFCam
front camera keys
static const int LaeMotorIdLF
left front
static const int LAE_ECODE_BAD_OP
invalid operation error
static const Dim LaeDimWheelShaftOffset(0.005,-0.015,-0.015)
Center of wheel shaft offset from body (dW x dH x dL).
const double ToFSensor2Dir
sensor 2 direction
int m_nNumCells
number of cells
const int LaeTuneBattCells
Fixed battery cell count.
virtual void print(int indent=0)
Print out description to stdout.
std::string m_strType
battery type
double m_fGearRatio
motor gear ratio
virtual ~LaeDescBase()
Destructor.
static const int LaeMotorCtlrIdNone
no motor controller id
const char *const LaeProdFamily
product family name
Robotic base platform description.
int m_nMotorCtlrId
unique motor controller id
virtual void makeDesc()
Make sensor description string from description.
static const double LaeMotorGearRatio
gear ratio
static const char *const KeyBattery
internal battery key
std::string m_strKey
base key
Dim m_dimRobot
robot full dimensions(m)
const double LaeTuneBattMaxVDft
const double ToFSensor7Deadzone
sensor 7 14.5mm deadzone
std::string m_strKey
powertrain key
static const int LaeNumMotorCtlrs
number of motor controllers
static const char *const KeyImu
built-in IMU keys
static const char *const KeyPowertrain[]
powertrain keys
virtual ~LaeDescRangeSensor()
Destructor.
static const char *const KeyMotorCtlr[]
motor controller keys
const double ToFSensor1Dir
sensor 1 direction
#define LAE_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
static const char *const PkgOptStd
standard package option
static const char *const KeyRangeSensorStd[]
std range sensor keys
static std::string prettyMotorCtlrName(int nCtlrId)
Create pretty motor controller identifier string.
const double ToFSensor5Dir
sensor 5 direction
unknown/undefined encoder type
int m_nChan
channel number
static const int LaeMotorCtlrIdFront
front motor controller
bool m_bIsDescribed
<b><i>Laelaps</i></b> is [not] fully described
static const int LaeMotorRight
right motors
double m_fWheeltrack
wheeltrack(m)
const char *const LaeTuneBattChem
Fixed battery chemistry.
Range sensor description.
static const char *const KeyRangeSensorMax[]
max range sensor keys
void clear()
Clear description.
int m_nMotorIndex
motor controller unique motor index
std::string getProdName() const
Get this base description's name.
LaeDescImu operator=(const LaeDescImu &rhs)
Assignment operator.
const int ToFSensor3Chan
sensor 3 channel (bit) number
void print(int indent=0)
Print out description to stdout.
std::string m_strKey
battery key
const double LaeTuneBattCapAh
Fixed battery capacity (Amp-hours).
static const char *const KeyRobotBase
robot base key
Laelaps real-time "database".
double m_fNomV
battery nominal voltage (V)
const int ToFSensor4Chan
sensor 4 channel (bit) number
double m_width
object width (meters)
LaeDescRangeSensor()
Default constructor.
static const char *const LaeKeyLeftFront
left front
virtual void print(int indent=0)
Print out description to stdout.
void calcDimensions(double fTireRadius, double fTireWidth)
Calculate robot dimensions.
Top-level package include file.
std::string m_strProdName
product name
static const int LAE_OK
not an error, success
MapDescRangeSensor m_mapDescRangeSensor
range sensor descriptions
const double ToFSensor3Dir
sensor 3 direction