Kuon  1.1.3
RoadNarrows Robotics Large Outdoor Mobile Robot Project

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

Classes

class  KuonDesc
 Kuon robotic manipulator full description class. More...
 
class  KuonDescBase
 Kuon robotic mobile base escription class. More...
 
class  KuonJointState
 Joint state class. More...
 
class  KuonJointStatePoint
 Joint state point class. More...
 
class  KuonMotorHealth
 Robot motor health. More...
 
class  KuonRobot
 Kuon robotic manipulator plus accesories class. More...
 
class  KuonRobotJoint
 Operational robotic joint class. More...
 
class  KuonRobotStatus
 Robot global status. More...
 
class  KuonSpec
 Robotic specification. More...
 
struct  KuonSpecMotor_T
 Robotic motor specification. More...
 
class  KuonWheelTraj
 Wheel trajectory class. More...
 
class  KuonWheelTrajectoryFeedback
 Wheel trajectory feedback class. More...
 
class  KuonWheelTrajectoryPoint
 Wheel trajectory point class. More...
 
class  KuonXmlCfg
 KuonXmlCfg Kuon XML configuration class. More...
 

Enumerations

enum  KuonTriState {
  KuonTriStateUnknown = -1,
  KuonTriStateFalse = 0,
  KuonTriStateOff = 0,
  KuonTriStateDisabled = 0,
  KuonTriStateLow = 0,
  KuonTriStateOpen = 0,
  KuonTriStateDark = 0,
  KuonTriStateTrue = 1,
  KuonTriStateOn = 1,
  KuonTriStateEnabled = 1,
  KuonTriStateHigh = 1,
  KuonTriStateClosed = 1,
  KuonTriStateLight = 1
}
  Kuon tri-state type. More...
 
enum  KuonRobotMode {
  KuonRobotModeUnknown = -1,
  KuonRobotModeManual = 1,
  KuonRobotModeAuto = 2
}
  Kuon mode of operation. More...
 
enum  KuonAsyncTaskState {
  KuonAsyncTaskStateIdle = 0,
  KuonAsyncTaskStateWorking = 1
}
 Asynchronous task state. More...
 
enum  KuonJointType {
  KuonJointTypeUnknown = 0,
  KuonJointTypeFixed,
  KuonJointTypeRevolute,
  KuonJointTypeContinuous,
  KuonJointTypeRevMimic,
  KuonJointTypeNumOf = 4
}
 Supported joint/wheel types. Not really used for now. More...
 
enum  KuonLimitType {
  KuonLimitTypeUnknown = 0x00,
  KuonLimitTypeNone = 0x01,
  KuonLimitTypePhys = 0x02,
  KuonLimitTypeElec = 0x04,
  KuonLimitTypeElecTDC = 0x08,
  KuonLimitTypeAbsEnc = 0x10,
  KuonLimitTypeNumOf = 5
}
 Joint/wheel limit detection types. Not really used for now. More...
 

Functions

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 error code. 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 icap (int a, int min, int max)
 Cap value within limits [min, max]. More...
 
const char * boolstr (bool b)
 Boolean to string. More...
 
bool operator< (const struct timeval &lhs, const struct timeval &rhs)
 Compare operator to test if left hand side time is earlier than the right hand side time. More...
 
bool operator== (const struct timeval &lhs, const struct timeval &rhs)
 Compare operator to test if left hand side time equals the right hand side time. More...
 
std::string getRealDeviceName (const std::string &strDevName)
 Get real device name. More...
 

Variables

static const int KUON_OK = 0
 not an error, success
 
static const int KUON_ECODE_GEN = 1
 general, unspecified error
 
static const int KUON_ECODE_SYS = 2
 system (errno) error
 
static const int KUON_ECODE_INTERNAL = 3
 internal error (bug)
 
static const int KUON_ECODE_BAD_VAL = 4
 bad value general error
 
static const int KUON_ECODE_TOO_BIG = 5
 value/list/size too big
 
static const int KUON_ECODE_TOO_SMALL = 6
 value/list/size too small
 
static const int KUON_ECODE_RANGE = 7
 value out-of-range
 
static const int KUON_ECODE_BAD_OP = 8
 invalid operation error
 
static const int KUON_ECODE_TIMEDOUT = 9
 operation timed out error
 
static const int KUON_ECODE_NO_DEV = 10
 device not found error
 
static const int KUON_ECODE_NO_RSRC = 11
 no resource available error
 
static const int KUON_ECODE_BUSY = 12
 resource busy error
 
static const int KUON_ECODE_NO_EXEC = 13
 cannot execute error
 
static const int KUON_ECODE_PERM = 14
 no permissions error
 
static const int KUON_ECODE_MOTOR = 15
 motor error
 
static const int KUON_ECODE_MOT_CTLR = 16
 motor controller error
 
static const int KUON_ECODE_BATT = 17
 battery error
 
static const int KUON_ECODE_FORMAT = 18
 bad format
 
static const int KUON_ECODE_BOTSENSE = 19
 botsense error
 
static const int KUON_ECODE_NO_FILE = 20
 file not found
 
static const int KUON_ECODE_XML = 21
 XML error.
 
static const int KUON_ECODE_ALARMED = 22
 robot is alarmed
 
static const int KUON_ECODE_INTR = 23
 operation interrupted
 
static const int KUON_ECODE_COLLISION = 24
 robot link(s) in collision
 
static const int KUON_ECODE_ESTOP = 25
 robot emergency stopped
 
static const int KUON_ECODE_BADEC = 26
 bad error code
 
static const int KUON_ECODE_NUMOF = 27
 number of error codes
 
static const int KUON_ALARM_NONE = 0x00
 no alarms
 
static const int KUON_ALARM_VOLTAGE = 0x01
 under/over voltage
 
static const int KUON_ALARM_TEMP = 0x02
 under/over temperature
 
static const int KUON_ALARM_COMM = 0x04
 communication
 
const char *const KuonProdFamily = "Kuon"
 product family name
 
static const int KuonProdIdUnknown = 0
 unknown/undefined product id
 
static const int KuonProdIdStd = 1
 standard Kuon product id
 
static const int KuonProdIdNarrow = 2
 narrow Kuon product id
 
const char *const KuonProdModelStd = "Standard"
 standard model
 
const char *const KuonProdModelNarrow = "Narrow"
 narrow model
 
const char *const KuonImageDir = "/usr/local/share/Kuon/images"
 image directory
 
const char *const KuonIconDir = "/usr/local/share/Kuon/images/icons"
 icon directory
 
const char *const KuonEtcCfg = "/etc/kuon/kuon.conf"
 
const char *const KuonXslUrl
 xml configuration file More...
 
const char *const KuonXsiUrl
 xml schema instance url More...
 
const char *const KuonDevMotorCtlr0 = "/dev/kmot0"
 motor controller 0 device name
 
const char *const KuonDevMotorCtlr1 = "/dev/kmot1"
 motor controller 1 device name
 
const int KuonBaudRateMotorCtlr = 38400
 motor controllers baud rate
 
static const int KuonMotorIdNone = -1
 no motor id
 
static const int KuonMotorIdLF = 0
 left front
 
static const int KuonMotorIdRF = 1
 right front
 
static const int KuonMotorIdLR = 2
 left rear
 
static const int KuonMotorIdRR = 3
 right rear
 
static const int KuonMotorCtlrIdNone = -1
 no motor controller id
 
static const int KuonMotorCtlrId0 = 0
 motor controller id 0
 
static const int KuonMotorCtlrId1 = 1
 motor controller id 1
 
static const int KuonMotorDirUnknown = 0
 unknown
 
static const int KuonMotorDirCcw = 1
 counter-clockwise
 
static const int KuonMotorDirCw = -1
 clockwise
 
const int KuonProdBaseStdVersion = KUON_VERSION(1, 0, 0)
 hw version
 
const int KuonProdBaseStdNumMotors = 4
 number of motors
 
const KuonSpecMotor_T KuonProdBaseStdSpecMotors []
 Specification of servos. More...
 

Detailed Description

The Kuon namespace encapsulates all Kuon related constructs.

Enumeration Type Documentation

Supported joint/wheel types. Not really used for now.

Enumerator
KuonJointTypeUnknown 

unknown/undefined joint type

KuonJointTypeFixed 

fixed joint

KuonJointTypeRevolute 

limited rotation

KuonJointTypeContinuous 

continuous rotation

KuonJointTypeRevMimic 

mimic rotation (e.g. fingers)

KuonJointTypeNumOf 

number of supported joint types

Definition at line 75 of file kuonSpec.h.

76  {
77  KuonJointTypeUnknown = 0, ///< unknown/undefined joint type
78  KuonJointTypeFixed, ///< fixed joint
79  KuonJointTypeRevolute, ///< limited rotation
80  KuonJointTypeContinuous, ///< continuous rotation
81  KuonJointTypeRevMimic, ///< mimic rotation (e.g. fingers)
82 
83  KuonJointTypeNumOf = 4 ///< number of supported joint types
84  };
limited rotation
Definition: kuonSpec.h:79
number of supported joint types
Definition: kuonSpec.h:83
unknown/undefined joint type
Definition: kuonSpec.h:77
mimic rotation (e.g. fingers)
Definition: kuonSpec.h:81
continuous rotation
Definition: kuonSpec.h:80

Joint/wheel limit detection types. Not really used for now.

A joint may have more than one type.

Enumerator
KuonLimitTypeUnknown 

unknown/undefined joint type

KuonLimitTypeNone 

no limit detection

KuonLimitTypePhys 

physical

KuonLimitTypeElec 

electronic

KuonLimitTypeElecTDC 

electronic top dead center

KuonLimitTypeAbsEnc 

absolute encoder

KuonLimitTypeNumOf 

number of supported joint types

Definition at line 91 of file kuonSpec.h.

92  {
93  KuonLimitTypeUnknown = 0x00, ///< unknown/undefined joint type
94  KuonLimitTypeNone = 0x01, ///< no limit detection
95  KuonLimitTypePhys = 0x02, ///< physical
96  KuonLimitTypeElec = 0x04, ///< electronic
97  KuonLimitTypeElecTDC = 0x08, ///< electronic top dead center
98  KuonLimitTypeAbsEnc = 0x10, ///< absolute encoder
99 
100  KuonLimitTypeNumOf = 5 ///< number of supported joint types
101  };
electronic top dead center
Definition: kuonSpec.h:97
number of supported joint types
Definition: kuonSpec.h:100
absolute encoder
Definition: kuonSpec.h:98
unknown/undefined joint type
Definition: kuonSpec.h:93
no limit detection
Definition: kuonSpec.h:94

Function Documentation

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

Boolean to string.

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

Definition at line 166 of file kuonUtils.h.

167  {
168  return b? "true": "false";
169  }
double kuon::degToRad ( double  d)
inline

Convert degrees to radians.

Parameters
dDegrees.
Returns
Radians.

Definition at line 102 of file kuonUtils.h.

References M_TAU.

103  {
104  return d / 360.0 * M_TAU;
105  }
#define M_TAU
tau = 2 * pi
Definition: kuonUtils.h:69
double kuon::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 140 of file kuonUtils.h.

Referenced by kuon::KuonRobot::setBrake(), kuon::KuonRobot::setGovernor(), kuon::KuonRobot::setSlew(), and kuon::KuonRobot::velocityToRawSpeed().

141  {
142  return a<min? min: a>max? max: a;
143  }
std::string kuon::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 kuon::KuonRobot::connect(), getStrError(), and operator==().

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

Get the error string describing the 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 HEK_ECODE_BADEC.

Parameters
ecodeInstance of hek_ecodes.
Returns
Returns the appropriate error code string.

Definition at line 126 of file kuonUtils.cxx.

References EcodeStrTbl, getRealDeviceName(), KUON_ECODE_BADEC, KUON_VERSION, and strToVersion().

127 {
128  int ec = ecode >= 0 ? ecode : -ecode;
129 
130  if( ec >= arraysize(EcodeStrTbl) )
131  {
132  ec = KUON_ECODE_BADEC;
133  }
134 
135  return EcodeStrTbl[ec];
136 }
static const int KUON_ECODE_BADEC
bad error code
Definition: kuon.h:108
static const char * EcodeStrTbl[]
<b><i>Kuon</i></b> Error Code String Table.
Definition: kuonUtils.cxx:88
int kuon::iabs ( int  a)
inline

Integer absolute value.

Parameters
aInteger value.
Returns
|a|

Definition at line 126 of file kuonUtils.h.

127  {
128  return a>=0? a: -a;
129  }
int kuon::icap ( 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 154 of file kuonUtils.h.

Referenced by kuon::KuonRobot::setBrake(), kuon::KuonRobot::setSlew(), and kuon::KuonRobot::setSpeed().

155  {
156  return a<min? min: a>max? max: a;
157  }
bool kuon::operator< ( const struct timeval &  lhs,
const struct timeval &  rhs 
)
inline

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

lhs < rhs <==> lhs is an earlier time than rhs.

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.

Definition at line 182 of file kuonUtils.h.

183  {
184  if( lhs.tv_sec < rhs.tv_sec )
185  {
186  return true;
187  }
188  else if( (lhs.tv_sec == rhs.tv_sec) && (lhs.tv_usec < rhs.tv_usec) )
189  {
190  return true;
191  }
192  else
193  {
194  return false;
195  }
196  }
bool kuon::operator== ( const struct timeval &  lhs,
const struct timeval &  rhs 
)
inline

Compare operator to test if left hand side time equals the right hand side time.

lhs == rhs <==> lhs time is the same time as the rhs.

Parameters
lhsLeft hand side time.
rhsRight hand side time.
Returns
Returns true or false.

Definition at line 209 of file kuonUtils.h.

References getRealDeviceName().

210  {
211  return (lhs.tv_sec == rhs.tv_sec) && (lhs.tv_usec == rhs.tv_usec)?
212  true: false;
213  }
double kuon::radToDeg ( double  r)
inline

Convert radians to degrees.

Parameters
rRadians.
Returns
Degrees.

Definition at line 114 of file kuonUtils.h.

References M_TAU.

115  {
116  return r / M_TAU * 360.0;
117  }
#define M_TAU
tau = 2 * pi
Definition: kuonUtils.h:69
uint_t kuon::strToVersion ( const std::string &  str)

Convert version dotted string to integer equivalent.

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

Referenced by getStrError(), kuon::KuonRobot::getVersion(), and kuon::KuonDescBase::KuonDescBase().

Variable Documentation

const KuonSpecMotor_T kuon::KuonProdBaseStdSpecMotors
Initial value:
=
{
{ "left_front",
KuonMotorIdLF, KuonMotorCtlrId0, RS160D_MOTOR_LEFT_ID,
1.0, 200.0, KuonMotorDirCcw
},
{ "right_front",
KuonMotorIdRF, KuonMotorCtlrId0, RS160D_MOTOR_RIGHT_ID,
1.0, 200.0, KuonMotorDirCw
},
{ "left_rear",
KuonMotorIdLR, KuonMotorCtlrId1, RS160D_MOTOR_LEFT_ID,
1.0, 200.0, KuonMotorDirCcw
},
{ "right_rear",
KuonMotorIdRR, KuonMotorCtlrId1, RS160D_MOTOR_RIGHT_ID,
1.0, 200.0, KuonMotorDirCw
},
}
static const int KuonMotorIdLR
left rear
Definition: kuon.h:304
static const int KuonMotorIdLF
left front
Definition: kuon.h:302
static const int KuonMotorIdRR
right rear
Definition: kuon.h:305
static const int KuonMotorCtlrId0
motor controller id 0
Definition: kuon.h:309
static const int KuonMotorIdRF
right front
Definition: kuon.h:303
static const int KuonMotorCtlrId1
motor controller id 1
Definition: kuon.h:310
static const int KuonMotorDirCcw
counter-clockwise
Definition: kuon.h:314
static const int KuonMotorDirCw
clockwise
Definition: kuon.h:315

Specification of servos.

Default specification of motors, wheels, and tires.

Data:
name, motor_id, motor_ctlr_id, motor_index, gear_ratio, tire_radius(mm), dir

Definition at line 70 of file kuonProdBaseStd.cxx.

Referenced by kuon::KuonSpec::set().