Hekateros  3.4.3
RoadNarrows Robotics Robot Arm Project
hekDescArm.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Hekateros
4 //
5 // Library: libhekateros
6 //
7 // File: hekDescArm.cxx
8 //
9 //
10 /*! \file
11  *
12  * $LastChangedDate: 2014-09-18 16:53:49 -0600 (Thu, 18 Sep 2014) $
13  * $Rev: 3748 $
14  *
15  * \brief HekDescArm - Hekateros robotic arm description class implementation.
16  *
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  *
20  * \copyright
21  * \h_copy 2012-2017. RoadNarrows LLC.\n
22  * http://www.roadnarrows.com\n
23  * All Rights Reserved
24  */
25 /*
26  * @EulaBegin@
27  *
28  * Unless otherwise stated explicitly, all materials contained are copyrighted
29  * and may not be used without RoadNarrows LLC's written consent,
30  * except as provided in these terms and conditions or in the copyright
31  * notice (documents and software) or other proprietary notice provided with
32  * the relevant materials.
33  *
34  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
35  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
36  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
37  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
38  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
39  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
42  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
43  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
44  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
45  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
46  *
47  * @EulaEnd@
48  */
49 ////////////////////////////////////////////////////////////////////////////////
50 
51 #include <stdio.h>
52 #include <math.h>
53 
54 #include <string>
55 #include <vector>
56 
57 #include "rnr/rnrconfig.h"
58 #include "rnr/log.h"
59 
60 #include "Hekateros/hekateros.h"
61 #include "Hekateros/hekUtils.h"
62 #include "Hekateros/hekSpec.h"
63 #include "Hekateros/hekProdArm.h"
64 #include "Hekateros/hekDescArm.h"
65 
66 using namespace std;
67 using namespace hekateros;
68 
69 
70 HekDescArm::HekDescArm()
71 {
72  m_eProdId = HekProdIdUnknown;
73  m_eProdSize = HekProdSizeUnknown;
74  m_uProdHwVer = 0;
75  m_nDoF = 0;
76 }
77 
78 void HekDescArm::setDesc(int eProdId,
79  const string &strProdName,
80  const string &strProdBrief,
81  const string &strHwVer,
82  int nDoF,
83  int eProdSize)
84 {
85  m_eProdId = eProdId;
86  m_strProdName = strProdName.empty()? getProdName(m_eProdId): strProdName;
87  m_strProdBrief = strProdBrief.empty()? getProdBrief(m_eProdId): strProdBrief;
88  m_strProdHwVer = strHwVer;
89  m_uProdHwVer = strToVersion(strHwVer);
90  m_nDoF = nDoF == 0? getDoF(m_eProdId): nDoF;
91  m_eProdSize = eProdSize == HekProdSizeUnknown? getProdSize(m_eProdId):
92  eProdSize;
93 
94  // set arm specification
95  m_spec.set(m_eProdId, m_uProdHwVer);
96 }
97 
98 void HekDescArm::resetDesc()
99 {
100  m_eProdId = HekProdIdUnknown;
101  m_strProdName.clear();
102  m_strProdBrief.clear();
103  m_strProdHwVer.clear();
104  m_nDoF = 0;
105  m_eProdSize = HekProdSizeUnknown;
106 
107  // clear arm specification
108  m_spec.clear();
109 }
110 
111 const char *HekDescArm::getProdName(int eProdId)
112 {
113  switch( eProdId )
114  {
115  case HekProdArm4SId:
116  return "Hekateros-4S";
117  case HekProdArm4LId:
118  return "Hekateros-4L";
119  case HekProdArm5SId:
120  return "Hekateros-5S";
121  case HekProdArm5LBetaId:
122  return "Hekateros-5LBeta";
123  case HekProdArm5LId:
124  return "Hekateros-5L";
125  default:
126  return "";
127  }
128 }
129 
130 const char *HekDescArm::getProdBrief(int eProdId)
131 {
132  switch( eProdId )
133  {
134  case HekProdArm4SId:
135  return "RoadNarrows Hekateros 4DOF short robotic manipulator";
136  case HekProdArm4LId:
137  return "RoadNarrows Hekateros 4DOF long robotic manipulator";
138  case HekProdArm5SId:
139  return "RoadNarrows Hekateros 5DOF short robotic manipulator";
140  case HekProdArm5LBetaId:
141  return "RoadNarrows Hekateros 5DOF long beta robotic manipulator";
142  case HekProdArm5LId:
143  return "RoadNarrows Hekateros 5DOF long robotic manipulator";
144  default:
145  return "";
146  }
147 }
148 
149 int HekDescArm::getProdSize(int eProdId)
150 {
151  switch( eProdId )
152  {
153  case HekProdArm4SId:
154  case HekProdArm5SId:
155  return HekProdSizeShort;
156  case HekProdArm4LId:
157  case HekProdArm5LBetaId:
158  case HekProdArm5LId:
159  return HekProdSizeLong;
160  default:
161  return HekProdSizeUnknown;
162  }
163 }
164 
165 int HekDescArm::getDoF(int eProdId)
166 {
167  switch( eProdId )
168  {
169  case HekProdArm4SId:
170  case HekProdArm4LId:
171  return 4;
172  case HekProdArm5LBetaId:
173  case HekProdArm5SId:
174  case HekProdArm5LId:
175  return 5;
176  default:
177  return 0;
178  }
179 }
Top-level package include file.
HekDescArm - Hekateros robotic arm description class interface.
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
<b><i>Hekateros</i></b> product specification base classes.
Hekateros common utilities.
Aggregagte of supported Hekateros robotic arms static specifications.
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
Definition: hekateros.h:56