Kuon  1.1.3
RoadNarrows Robotics Large Outdoor Mobile Robot Project
kuonDescBase.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Kuon
4 //
5 // Library: libkuon
6 //
7 // File: kuonDescBase.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2014-04-07 08:16:52 -0600 (Mon, 07 Apr 2014) $
12  * $Rev: 3631 $
13  *
14  * \brief Kuon robotic base mobile platform description class implementation.
15  *
16  * The base description does not include any payload descriptions.
17  *
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  *
20  * \copyright
21  * \h_copy 2014-2017. RoadNarrows LLC.\n
22  * http://www.roadnarrows.com\n
23  * All Rights Reserved
24  */
25 /*
26  * @EulaBegin@
27  *
28  * Permission is hereby granted, without written agreement and without
29  * license or royalty fees, to use, copy, modify, and distribute this
30  * software and its documentation for any purpose, provided that
31  * (1) The above copyright notice and the following two paragraphs
32  * appear in all copies of the source code and (2) redistributions
33  * including binaries reproduces these notices in the supporting
34  * documentation. Substantial modifications to this software may be
35  * copyrighted by their authors and need not follow the licensing terms
36  * described here, provided that the new terms are clearly indicated in
37  * all files where they apply.
38  *
39  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
40  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
41  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
42  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
43  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
44  * THE POSSIBILITY OF SUCH DAMAGE.
45  *
46  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
47  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
48  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
49  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
50  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
51  *
52  * @EulaEnd@
53  */
54 ////////////////////////////////////////////////////////////////////////////////
55 
56 #include <stdio.h>
57 #include <math.h>
58 
59 #include <string>
60 #include <vector>
61 
62 #include "rnr/rnrconfig.h"
63 #include "rnr/log.h"
64 
65 #include "Kuon/kuon.h"
66 #include "Kuon/kuonUtils.h"
67 #include "Kuon/kuonSpec.h"
68 #include "Kuon/kuonProdBase.h"
69 #include "Kuon/kuonDescBase.h"
70 
71 using namespace std;
72 using namespace kuon;
73 
74 
75 KuonDescBase::KuonDescBase() :
76  m_strProdFamily(KuonProdFamily)
77 {
79  m_uProdHwVer = 0;
80 }
81 
82 void KuonDescBase::setDesc(int eProdId,
83  const string &strProdName,
84  const string &strProdBrief,
85  const string &strHwVer,
86  double fFrontTireRadius,
87  double fRearTireRadius)
88 {
89  m_eProdId = eProdId;
90  m_strProdName = strProdName.empty()? getProdName(m_eProdId): strProdName;
91  m_strProdBrief = strProdBrief.empty()? getProdBrief(m_eProdId): strProdBrief;
92  m_strProdHwVer = strHwVer;
93  m_uProdHwVer = strToVersion(strHwVer);
94 
95  // set arm specification
96  m_spec.set(m_eProdId, m_uProdHwVer, fFrontTireRadius, fRearTireRadius);
97 }
98 
100 {
102  m_strProdName.clear();
103  m_strProdBrief.clear();
104  m_strProdHwVer.clear();
105 
106  // clear arm specification
107  m_spec.clear();
108 }
109 
110 const char *KuonDescBase::getProdName(int eProdId)
111 {
112  switch( eProdId )
113  {
114  case KuonProdIdStd:
115  return "Kuon-Standard";
116  case KuonProdIdNarrow:
117  return "Kuon-Narrow";
118  default:
119  return "";
120  }
121 }
122 
123 const char *KuonDescBase::getProdBrief(int eProdId)
124 {
125  switch( eProdId )
126  {
127  case KuonProdIdStd:
128  return "RoadNarrows Kuon Standard robotic mobile platform";
129  case KuonProdIdNarrow:
130  return "RoadNarrows Kuon Narrow robotic mobile platform";
131  default:
132  return "";
133  }
134 }
std::string m_strProdHwVer
product hardware version string
Definition: kuonDescBase.h:219
std::string getProdName()
Get this base description&#39;s name.
Definition: kuonDescBase.h:146
KuonSpec m_spec
fixed specification
Definition: kuonDescBase.h:221
Kuon common utilities.
Aggregagte of supported Kuon robotic mobile bases static specifications.
static const int KuonProdIdUnknown
unknown/undefined product id
Definition: kuon.h:144
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
Kuon robotic base mobile platform description class interface.
The <b><i>Kuon</i></b> namespace encapsulates all <b><i>Kuon</i></b> related constructs.
Definition: kuon.h:66
<b><i>Kuon</i></b> product specification base classes.
RoadNarrows Kuon robot top-level header file.
std::string m_strProdName
product name
Definition: kuonDescBase.h:217
static const int KuonProdIdNarrow
narrow Kuon product id
Definition: kuon.h:146
void resetDesc()
Reset base description to the "unitialized" values.
uint_t m_uProdHwVer
product hardware version number
Definition: kuonDescBase.h:220
void clear()
Clear product fixed specification.
Definition: kuonSpec.cxx:144
int m_eProdId
base product id
Definition: kuonDescBase.h:215
std::string m_strProdBrief
product brief
Definition: kuonDescBase.h:218
std::string getProdBrief()
Get this base description&#39;s brief.
Definition: kuonDescBase.h:156
static const int KuonProdIdStd
standard Kuon product id
Definition: kuon.h:145
const char *const KuonProdFamily
product family name
Definition: kuon.h:142
int set(int eProdId, uint_t uHwVer, double fFrontTireRadius, double fRearTireRadius)
Set product fixed specification.
Definition: kuonSpec.cxx:80