Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // File: laelaps.h
6 //
7 /*! \file
8  *
9  * $LastChangedDate: 2016-01-21 16:50:25 -0700 (Thu, 21 Jan 2016) $
10  * $Rev: 4268 $
11  *
12  * \brief Top-level package include file.
13  *
14  * \author Robin Knight (robin.knight@roadnarrows.com)
15  *
16  * \par Copyright
17  * \h_copy 2015-2017. RoadNarrows LLC.\n
18  * http://www.roadnarrows.com\n
19  * All Rights Reserved
20  */
21 /*
22  * @EulaBegin@
23  *
24  * Unless otherwise stated explicitly, all materials contained are copyrighted
25  * and may not be used without RoadNarrows LLC's written consent,
26  * except as provided in these terms and conditions or in the copyright
27  * notice (documents and software) or other proprietary notice provided with
28  * the relevant materials.
29  *
30  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
31  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
32  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
33  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
34  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
35  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
38  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
39  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
40  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
41  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
42  *
43  * @EulaEnd@
44  */
45 ////////////////////////////////////////////////////////////////////////////////
46 
47 #ifndef _LAELAPS_H
48 #define _LAELAPS_H
49 
50 #undef LAE_DEPRECATED ///< use to delete old code
51 
52 /*!
53  * \brief The \h_laelaps namespace encapsulates all \h_laelaps related
54  * constructs.
55  */
56 #ifndef SWIG
57 namespace laelaps
58 {
59 #endif // SWIG
60 
61  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62 
63  /*!
64  * \ingroup laelaps_h
65  * \defgroup lae_ecodes Laelaps Error Codes
66  *
67  * Laelaps package-wide error codes.
68  *
69  * \{
70  */
71  static const int LAE_OK = 0; ///< not an error, success
72 
73  static const int LAE_ECODE_GEN = 1; ///< general, unspecified error
74  static const int LAE_ECODE_SYS = 2; ///< system (errno) error
75  static const int LAE_ECODE_INTERNAL = 3; ///< internal error (bug)
76  static const int LAE_ECODE_BAD_VAL = 4; ///< bad value general error
77  static const int LAE_ECODE_TOO_BIG = 5; ///< value/list/size too big
78  static const int LAE_ECODE_TOO_SMALL = 6; ///< value/list/size too small
79  static const int LAE_ECODE_RANGE = 7; ///< value out-of-range
80  static const int LAE_ECODE_BAD_OP = 8; ///< invalid operation error
81  static const int LAE_ECODE_TIMEDOUT = 9; ///< operation timed out error
82  static const int LAE_ECODE_NO_DEV = 10; ///< device not found error
83  static const int LAE_ECODE_NO_RSRC = 11; ///< no resource available error
84  static const int LAE_ECODE_BUSY = 12; ///< resource busy error
85  static const int LAE_ECODE_NO_EXEC = 13; ///< cannot execute error
86  static const int LAE_ECODE_PERM = 14; ///< no permissions error
87  static const int LAE_ECODE_DYNA = 15; ///< dynamixel error
88  static const int LAE_ECODE_VIDEO = 16; ///< video error
89  static const int LAE_ECODE_FORMAT = 17; ///< bad format
90  static const int LAE_ECODE_BOTSENSE = 18; ///< botsense error
91  static const int LAE_ECODE_NO_FILE = 19; ///< file not found
92  static const int LAE_ECODE_XML = 20; ///< XML error
93  static const int LAE_ECODE_ALARMED = 21; ///< robot is alarmed
94  static const int LAE_ECODE_INTR = 22; ///< operation interrupted
95  static const int LAE_ECODE_COLLISION = 23; ///< robot link(s) in collision
96  static const int LAE_ECODE_ESTOP = 24; ///< robot emergency stopped
97  static const int LAE_ECODE_MOT_CTLR = 25; ///< motor controller error
98  static const int LAE_ECODE_IO = 26; ///< I/O error
99 
100  static const int LAE_ECODE_BADEC = 27; ///< bad error code
101 
102  static const int LAE_ECODE_NUMOF = 28; ///< number of error codes
103  /*! \} */
104 
105  /*! \} */
106 
107  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
108 
109  /*!
110  *
111  * \ingroup laelaps_h
112  * \defgroup lae_prod Laelaps Product Identifiers
113  *
114  * \h_laelaps product ids, names, and descriptions.
115  *
116  * Products ids are classified by class, family, size, dof, and special
117  * fields.
118  *
119  * \{
120  */
121 
122  //
123  // Product release status
124  //
125  #define LAE_PROD_GA 0x000 ///< product general availability
126  #define LAE_PROD_BETA 0x001 ///< product beta version
127  #define LAE_PROD_ALPHA 0x002 ///< product alpha version
128  #define LAE_PROD_PROTO 0x003 ///< product prototype version
129 
130  //
131  // Product classes
132  //
133  #define LAE_CLASS_MOBILE_BASE 0xBA000000 ///< base
134 
135  //
136  // Product Ids and Names
137  //
138  // product family
139  const char* const LaeProdFamilyUnknown = "?"; ///< unknown product family
140  const char* const LaeProdFamily = "Laelaps"; ///< product family name
141 
142  // product ids
143  static const int LaeProdIdUnknown = 0; ///< unknown/undefined product id
144  static const int LaeProdIdStd = 1; ///< standard Laelaps product id
145  static const int LaeProdIdLarge = 2; ///< large Laelaps product id
146 
147  // product sizes
148  const char* const LaeProdModelStd = "Standard"; ///< standard model
149  const char* const LaeProdModelLarge = "Large"; ///< future large model
150 
151  /*!
152  * \brief Convert version triplet to integer equivalent.
153  *
154  * \param major Major version number.
155  * \param minor Minor version number.
156  * \param revision Revision number.
157  */
158  #define LAE_VERSION(major, minor, revision) \
159  ((((major)&0xff)<<24) | (((minor)&0xff)<<16) | ((revision)&0xffff))
160 
161  /*!
162  * \brief Get version major number from version.
163  *
164  * \param ver Version number.
165  *
166  * \return Major number.
167  */
168  #define LAE_VER_MAJOR(ver) (((ver)>>24) & 0xff)
169 
170  /*!
171  * \brief Get version minor number from version.
172  *
173  * \param ver Version number.
174  *
175  * \return Minor number.
176  */
177  #define LAE_VER_MINOR(ver) (((ver)>>16) & 0xff)
178 
179  /*!
180  * \brief Get revision number from version.
181  *
182  * \param ver Version number.
183  *
184  * \return Revision number.
185  */
186  #define LAE_VER_REV(ver) ((ver) & 0xffff)
187  /*! \} */
188 
189  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
190 
191  /*!
192  *
193  * \ingroup laelaps_h
194  * \defgroup lae_env Laelaps Environment
195  *
196  * Laelaps directories and files.
197  *
198  * \{
199  */
200 
201  //
202  // Images directory.
203  //
204  #ifdef LAE_IMAGE_DIR
205  const char* const LaeImageDir = LAE_IMAGE_DIR; ///< image directory
206  #else
207  const char* const LaeImageDir = "/usr/local/share/Laelaps/images";
208  ///< image directory
209  #endif
210 
211  //
212  // Icons directory.
213  //
214  #ifdef LAE_ICON_DIR
215  const char* const LaeIconDir = LAE_ICON_DIR; ///< icon directory
216  #else
217  const char* const LaeIconDir = "/usr/local/share/Laelaps/images/icons";
218  ///< icon directory
219  #endif
220 
221  //
222  // Paths
223  //
224 
225  /*! \brief System configuration search path. */
226  const char* const LaeSysCfgPath = "/etc/laelaps:/etc";
227 
228  /*! \brief User configuration search path and inheritance order. */
229  const char* const LaeUserCfgPath = "/etc/laelaps:~/.roadnarrows";
230 
231  //
232  // Top-level configuration XML file basename.
233  //
234  #ifdef LAE_ETC_CFG
235  const char* const LaeEtcCfg = LAE_ETC_CFG; ///< xml configuration file
236  #else
237  const char* const LaeEtcCfg = "laelaps.conf";
238  ///< xml configuration file
239  #endif
240 
241  //
242  // Tuning XML file basename.
243  //
244  #ifdef LAE_ETC_TUNE
245  const char* const LaeEtcTune = LAE_ETC_TUNE; ///< xml tune file
246  #else
247  const char* const LaeEtcTune = "laelaps_tune.conf";
248  ///< xml tune file
249  #endif
250 
251  //
252  // Specific Laelaps application configuration file basenames.
253  //
254  const char* const LaePanelXml = "laelaps_panel.xml"; ///< control panel cfg
255  const char* const LaeFrontCamXml = "laelaps_fcam.xml"; ///< front camera cfg
256  const char* const LaeXboxXml = "laelaps_xbox.xml"; ///< xbox teleop cfg
257 
258  //
259  // XML stylesheet URL
260  //
261  #ifdef LAE_XSL_URL
262  const char* const LaeXslUrl = LAE_XSL_URL; ///< xml stylesheet url
263  #else
264  const char* const LaeXslUrl =
265  "http://roadnarrows.com/xml/Laelaps/1.0/laelaps.xsl";
266  ///< xml stylesheet url
267  #endif
268 
269  //
270  // XML schema instance URL
271  //
272  #ifdef LAE_XSI_URL
273  const char* const LaeXsiUrl = LAE_XSI_URL; ///< xml schema instance url
274  #else
275  const char* const LaeXsiUrl =
276  "http://roadnarrows.com/xml/Laelaps/1.0/laelaps.xsd";
277  ///< xml schema instance url
278  #endif
279 
280  /*! \} */
281 
282  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
283 
284  /*!
285  *
286  * \ingroup laelaps_h
287  * \defgroup lae_types Laelaps Common Simple Types
288  *
289  * Common types used to control and report robot information.
290  * fields.
291  *
292  * \{
293  */
294 
295  /*!
296  * \brief \h_laelaps tri-state type.
297  *
298  * Basically, a tri-state value is either unknown, 0, or 1.
299  */
301  {
302  // unknown
303  LaeTriStateUnknown = -1, ///< unknown state
304 
305  // low state synonyms
306  LaeTriStateFalse = 0, ///< false
307  LaeTriStateOff = 0, ///< off
308  LaeTriStateDisabled = 0, ///< disabled
309  LaeTriStateLow = 0, ///< low
310  LaeTriStateOpen = 0, ///< open
311  LaeTriStateDark = 0, ///< dark
312 
313  // high state synonyms
314  LaeTriStateTrue = 1, ///< true
315  LaeTriStateOn = 1, ///< on
316  LaeTriStateEnabled = 1, ///< enabled
317  LaeTriStateHigh = 1, ///< high
318  LaeTriStateClosed = 1, ///< closed
319  LaeTriStateLight = 1 ///< light
320  };
321 
322  /*!
323  * \brief \h_laelaps mode of operation.
324  *
325  * Robot mode of operation.
326  */
328  {
329  LaeRobotModeUnknown = -1, ///< unknown mode state
330  LaeRobotModeManual = 1, ///< can only be operated locally, not remotely
331  LaeRobotModeAuto = 2 ///< fully available
332  };
333 
334  /*!
335  * \brief Robot or joint operational states.
336  */
338  {
339  LaeOpStateUncalibrated = 0, ///< uncalibrated
340  LaeOpStateCalibrating = 1, ///< calibrating
341  LaeOpStateCalibrated = 2 ///< calibrated
342  };
343 
344  /*!
345  * \brief Asynchronous task state.
346  */
348  {
349  LaeAsyncTaskStateIdle = 0, ///< idle, no async task running
350  LaeAsyncTaskStateWorking = 1 ///< async task running
351  };
352 
353  /*!
354  * \brief Length/Distance Norm
355  */
356  enum LaeNorm
357  {
358  LaeNormL1 = 1, ///< L1 norm (taxicab or manhattan norm)
359  LaeNormL2 = 2, ///< L2 norm (Euclidean norm)
360  LaeNormLinf = 3 ///< Linf norm (maximum, infinity, or supremum norm)
361  };
362 
363  /*! \} */
364 
365 #ifndef SWIG
366 } // namespace laelaps
367 #endif // SWIG
368 
369 
370 #endif // _LAELAPS_H
static const int LAE_ECODE_TOO_BIG
value/list/size too big
Definition: laelaps.h:77
static const int LAE_ECODE_NO_EXEC
cannot execute error
Definition: laelaps.h:85
async task running
Definition: laelaps.h:350
static const int LAE_ECODE_NO_FILE
file not found
Definition: laelaps.h:91
L1 norm (taxicab or manhattan norm)
Definition: laelaps.h:358
const char *const LaeXboxXml
xbox teleop cfg
Definition: laelaps.h:256
const char *const LaeEtcTune
xml tune file
Definition: laelaps.h:247
static const int LAE_ECODE_RANGE
value out-of-range
Definition: laelaps.h:79
unknown mode state
Definition: laelaps.h:329
static const int LAE_ECODE_FORMAT
bad format
Definition: laelaps.h:89
LaeAsyncTaskState
Asynchronous task state.
Definition: laelaps.h:347
const char *const LaeImageDir
image directory
Definition: laelaps.h:207
static const int LaeProdIdStd
standard Laelaps product id
Definition: laelaps.h:144
static const int LAE_ECODE_COLLISION
robot link(s) in collision
Definition: laelaps.h:95
static const int LaeProdIdLarge
large Laelaps product id
Definition: laelaps.h:145
static const int LAE_ECODE_IO
I/O error.
Definition: laelaps.h:98
LaeRobotMode
<b><i>Laelaps</i></b> mode of operation.
Definition: laelaps.h:327
fully available
Definition: laelaps.h:331
idle, no async task running
Definition: laelaps.h:349
static const int LAE_ECODE_INTR
operation interrupted
Definition: laelaps.h:94
const char *const LaeFrontCamXml
front camera cfg
Definition: laelaps.h:255
L2 norm (Euclidean norm)
Definition: laelaps.h:359
const char *const LaePanelXml
control panel cfg
Definition: laelaps.h:254
const char *const LaeProdModelLarge
future large model
Definition: laelaps.h:149
static const int LAE_ECODE_GEN
general, unspecified error
Definition: laelaps.h:73
static const int LAE_ECODE_ESTOP
robot emergency stopped
Definition: laelaps.h:96
Linf norm (maximum, infinity, or supremum norm)
Definition: laelaps.h:360
static const int LAE_ECODE_NUMOF
number of error codes
Definition: laelaps.h:102
static const int LAE_ECODE_PERM
no permissions error
Definition: laelaps.h:86
const char *const LaeSysCfgPath
System configuration search path.
Definition: laelaps.h:226
static const int LaeProdIdUnknown
unknown/undefined product id
Definition: laelaps.h:143
static const int LAE_ECODE_MOT_CTLR
motor controller error
Definition: laelaps.h:97
static const int LAE_ECODE_VIDEO
video error
Definition: laelaps.h:88
const char *const LaeEtcCfg
xml configuration file
Definition: laelaps.h:237
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Definition: laeAlarms.h:64
static const int LAE_ECODE_TOO_SMALL
value/list/size too small
Definition: laelaps.h:78
const char *const LaeXsiUrl
xml schema instance url
Definition: laelaps.h:275
static const int LAE_ECODE_NO_DEV
device not found error
Definition: laelaps.h:82
static const int LAE_ECODE_ALARMED
robot is alarmed
Definition: laelaps.h:93
const char *const LaeXslUrl
xml stylesheet url
Definition: laelaps.h:264
const char *const LaeIconDir
icon directory
Definition: laelaps.h:217
static const int LAE_ECODE_BAD_OP
invalid operation error
Definition: laelaps.h:80
LaeOpState
Robot or joint operational states.
Definition: laelaps.h:337
static const int LAE_ECODE_NO_RSRC
no resource available error
Definition: laelaps.h:83
static const int LAE_ECODE_DYNA
dynamixel error
Definition: laelaps.h:87
const char *const LaeProdFamily
product family name
Definition: laelaps.h:140
static const int LAE_ECODE_BAD_VAL
bad value general error
Definition: laelaps.h:76
static const int LAE_ECODE_SYS
system (errno) error
Definition: laelaps.h:74
static const int LAE_ECODE_BADEC
bad error code
Definition: laelaps.h:100
static const int LAE_ECODE_BUSY
resource busy error
Definition: laelaps.h:84
const char *const LaeUserCfgPath
User configuration search path and inheritance order.
Definition: laelaps.h:229
static const int LAE_ECODE_TIMEDOUT
operation timed out error
Definition: laelaps.h:81
static const int LAE_ECODE_INTERNAL
internal error (bug)
Definition: laelaps.h:75
can only be operated locally, not remotely
Definition: laelaps.h:330
static const int LAE_ECODE_XML
XML error.
Definition: laelaps.h:92
LaeTriState
<b><i>Laelaps</i></b> tri-state type.
Definition: laelaps.h:300
LaeNorm
Length/Distance Norm.
Definition: laelaps.h:356
const char *const LaeProdModelStd
standard model
Definition: laelaps.h:148
const char *const LaeProdFamilyUnknown
unknown product family
Definition: laelaps.h:139
static const int LAE_ECODE_BOTSENSE
botsense error
Definition: laelaps.h:90
static const int LAE_OK
not an error, success
Definition: laelaps.h:71