Kuon  1.1.3
RoadNarrows Robotics Large Outdoor Mobile Robot Project
kuonDesc.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Kuon
4 //
5 // Library: libkuon
6 //
7 // File: kuonDesc.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2014-04-04 17:05:03 -0600 (Fri, 04 Apr 2014) $
12  * $Rev: 3629 $
13  *
14  * \brief Kuon full robotic mobile platform descripition class interface.
15  *
16  * The description includes the base platform plus any supported sensor and
17  * robotic payloads.
18  *
19  * Descriptions are a mash-up of factory fixed specificiations plus run-time
20  * XML configuration.
21  *
22  * \author Robin Knight (robin.knight@roadnarrows.com)
23  *
24  * \copyright
25  * \h_copy 2014-2017. RoadNarrows LLC.\n
26  * http://www.roadnarrows.com\n
27  * All Rights Reserved
28  */
29 /*
30  * @EulaBegin@
31  *
32  * Permission is hereby granted, without written agreement and without
33  * license or royalty fees, to use, copy, modify, and distribute this
34  * software and its documentation for any purpose, provided that
35  * (1) The above copyright notice and the following two paragraphs
36  * appear in all copies of the source code and (2) redistributions
37  * including binaries reproduces these notices in the supporting
38  * documentation. Substantial modifications to this software may be
39  * copyrighted by their authors and need not follow the licensing terms
40  * described here, provided that the new terms are clearly indicated in
41  * all files where they apply.
42  *
43  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
44  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
45  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
46  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
47  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
48  * THE POSSIBILITY OF SUCH DAMAGE.
49  *
50  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
51  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
52  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
53  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
54  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
55  *
56  * @EulaEnd@
57  */
58 ////////////////////////////////////////////////////////////////////////////////
59 
60 #ifndef _KUON_DESC_H
61 #define _KUON_DESC_H
62 
63 #include <math.h>
64 #include <vector>
65 
66 #include "Kuon/kuon.h"
67 #include "Kuon/kuonDescBase.h"
68 
69 
70 namespace kuon
71 {
72  //
73  // Forward declaraions.
74  //
75  class KuonRobot;
76 
77  /*!
78  * \brief Kuon robotic manipulator full description class.
79  *
80  * The description is determined from the XML etc configuration file. From
81  * those description components, the compiled specifications are assigned.
82  */
83  class KuonDesc
84  {
85  public:
86 
87  /*!
88  * \breif Default constructor.
89  */
91  {
92  }
93 
94  /*!
95  * \breif Destructor.
96  */
98  {
99  }
100 
101  /*
102  * Set \h_kuon's robotic mobile base description.
103  *
104  * \param eProdId \h_kuon base product id. See \ref KuonProdId.
105  * \param strProdName Product name. If string is empty, then the
106  * default name from product id is used.
107  * \param strProdBrief Product brief. If string is empty, then the
108  * default brief from product id is used.
109  * \param strHwVer Hardware version.
110  * \param fFrontTireRadius Radius of front tires (mm). If zero, then
111  * factory defaults are used.
112  * \param fRearTireRadius Radius of rear tires (mm). If zero, then
113  * factory defaults are used.
114  */
115  void setDesc(int eProdId,
116  const std::string &strProdName="",
117  const std::string &strProdBrief="",
118  const std::string &strHwVer="1.0.0",
119  double fFrontTireRadius=0.0,
120  double fRearTireRadius=0.0)
121  {
122  m_descBase.setDesc(eProdId, strProdName, strProdBrief, strHwVer,
123  fFrontTireRadius, fRearTireRadius);
124  }
125 
126  /*!
127  * \brief Reset \h_kuon description to the "unitialized" values.
128  */
129  void resetDesc();
130 
131  /*!
132  * \brief Mark \h_kuon hardware as fully described.
133  *
134  * The calling application context determines this state.
135  *
136  * \copydoc doc_return_std
137  */
138  int markAsDescribed();
139 
140  /*!
141  * \brief Test if required descriptions are described.
142  *
143  * \return Returns true or false.
144  */
145  bool isDescribed()
146  {
148  true: false;
149  }
150 
151  /*!
152  * \brief Get the \h_kuon base product description.
153  *
154  * \return Returns pointer to robotic base description.
155  */
157  {
158  return &m_descBase;
159  }
160 
161  /*!
162  * \brief Convenience function to get this \h_kuon description's base
163  * product id.
164  *
165  * \return Returns product id. See \ref KuonProdId.
166  */
167  int getProdId()
168  {
169  return m_descBase.getProdId();
170  }
171 
172  /*!
173  * \brief Get the \h_kuon full brief descirption.
174  *
175  * \return Returns string.
176  */
177  std::string getFullProdBrief()
178  {
179  return m_strFullBrief;
180  }
181 
182  /*!
183  * \brief Get the number of expected and required motors.
184  *
185  * \return Returns number of motors.
186  */
188  {
189  return m_descBase.getNumMotors();
190  }
191 
192  /*!
193  * \brief Test if motor id is in the list of motors.
194  *
195  * \return Returns true or false.
196  */
197  bool hasMotor(int nMotorId)
198  {
199  return m_descBase.m_spec.hasMotor(nMotorId);
200  }
201 
202  protected:
203  bool m_bIsDescribed; ///< \h_kuon is [not] fully described
204  KuonDescBase m_descBase; ///< \h_kuon robotic arm
205  std::string m_strFullBrief; ///< product with payload full brief
206 
207  friend class KuonRobot;
208  };
209 
210 } // namespace kuon
211 
212 #endif // _KUON_DESC_H
int getProdId()
Convenience function to get this <b><i>Kuon</i></b> description&#39;s base product id.
Definition: kuonDesc.h:167
KuonSpec m_spec
fixed specification
Definition: kuonDescBase.h:221
int getNumMotors()
Get the number of expected and required motors.
Definition: kuonDescBase.h:176
int getProdId()
Get this base description&#39;s base product id.
Definition: kuonDescBase.h:136
Kuon robotic mobile base escription class.
Definition: kuonDescBase.h:79
Kuon robotic manipulator plus accesories class.
Definition: kuonRobot.h:83
int getNumMotors()
Get the number of expected and required motors.
Definition: kuonDesc.h:187
static const int KuonProdIdUnknown
unknown/undefined product id
Definition: kuon.h:144
std::string m_strFullBrief
product with payload full brief
Definition: kuonDesc.h:205
Kuon robotic base mobile platform description class interface.
int markAsDescribed()
Mark <b><i>Kuon</i></b> hardware as fully described.
Definition: kuonDesc.cxx:76
The <b><i>Kuon</i></b> namespace encapsulates all <b><i>Kuon</i></b> related constructs.
Definition: kuon.h:66
bool hasMotor(int nMotorId)
Test if motor id is in the list of motors.
Definition: kuonDesc.h:197
bool hasMotor(int nMotorId)
Test if motor id is in the motor specifications.
Definition: kuonSpec.h:249
RoadNarrows Kuon robot top-level header file.
void resetDesc()
Reset <b><i>Kuon</i></b> description to the "unitialized" values.
Definition: kuonDesc.cxx:69
std::string getFullProdBrief()
Get the <b><i>Kuon</i></b> full brief descirption.
Definition: kuonDesc.h:177
KuonDescBase m_descBase
<b><i>Kuon</i></b> robotic arm
Definition: kuonDesc.h:204
Kuon robotic manipulator full description class.
Definition: kuonDesc.h:83
bool isDescribed()
Test if required descriptions are described.
Definition: kuonDesc.h:145
KuonDescBase * getBaseDesc()
Get the <b><i>Kuon</i></b> base product description.
Definition: kuonDesc.h:156
bool m_bIsDescribed
<b><i>Kuon</i></b> is [not] fully described
Definition: kuonDesc.h:203