Hekateros  3.4.3
RoadNarrows Robotics Robot Arm Project
hekDescEE.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Hekateros
4 //
5 // Library: libhekateros
6 //
7 // File: hekDescEE.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 HekDescEE - Hekateros end effector tool description class interface.
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 
53 #include <string>
54 #include <vector>
55 
56 #include "rnr/rnrconfig.h"
57 #include "rnr/log.h"
58 
59 #include "Hekateros/hekateros.h"
60 #include "Hekateros/hekUtils.h"
61 #include "Hekateros/hekSpec.h"
62 #include "Hekateros/hekProdEE.h"
63 #include "Hekateros/hekDescEE.h"
64 
65 using namespace std;
66 using namespace hekateros;
67 
68 
69 HekDescEE::HekDescEE()
70 {
71  m_eProdId = HekProdIdUnknown;
72  m_eProdSize = HekProdSizeUnknown;
73  m_uProdHwVer = 0;
74  m_nDoF = 0;
75 }
76 
77 void HekDescEE::setDesc(int eProdId,
78  const string &strProdName,
79  const string &strProdBrief,
80  const string &strHwVer,
81  int nDoF,
82  int eProdSize)
83 {
84  m_eProdId = eProdId;
85  m_strProdName = strProdName.empty()? getProdName(m_eProdId): strProdName;
86  m_strProdBrief = strProdBrief.empty()? getProdBrief(m_eProdId): strProdBrief;
87  m_strProdHwVer = strHwVer;
88  m_uProdHwVer = strToVersion(strHwVer);
89  m_nDoF = nDoF == 0? getDoF(m_eProdId): nDoF;
90  m_eProdSize = eProdSize == HekProdSizeUnknown? getProdSize(m_eProdId):
91  eProdSize;
92 
93  // set end effector specification
94  m_spec.set(m_eProdId, m_uProdHwVer);
95 }
96 
97 void HekDescEE::resetDesc()
98 {
99  m_eProdId = HekProdIdUnknown;
100  m_strProdName.clear();
101  m_strProdBrief.clear();
102  m_strProdHwVer.clear();
103  m_nDoF = 0;
104  m_eProdSize = HekProdSizeUnknown;
105 
106  // clear arm specification
107  m_spec.clear();
108 }
109 
110 const char *HekDescEE::getProdName(int eProdId)
111 {
112  switch( eProdId )
113  {
114  case HekProdEEFixedId:
115  return "Fixed";
116  case HekProdEEGraboidId:
117  return "Graboid";
118  default:
119  return "";
120  }
121 }
122 
123 const char *HekDescEE::getProdBrief(int eProdId)
124 {
125  switch( eProdId )
126  {
127  case HekProdEEFixedId:
128  return "Fixed end effector";
129  case HekProdEEGraboidId:
130  return "RoadNarrows Graboid 1DOF simple end effector";
131  default:
132  return "";
133  }
134 }
135 
136 int HekDescEE::getProdSize(int eProdId)
137 {
138  switch( eProdId )
139  {
140  case HekProdEEFixedId:
141  case HekProdEEGraboidId:
142  return HekProdSizeStd;
143  default:
144  return HekProdSizeUnknown;
145  }
146 }
147 
148 int HekDescEE::getDoF(int eProdId)
149 {
150  switch( eProdId )
151  {
152  case HekProdEEFixedId:
153  return 0;
154  case HekProdEEGraboidId:
155  return 1;
156  default:
157  return 0;
158  }
159 }
Aggregate of supported <b><i>Hekateros</i></b> end effectors static specifications.
Top-level package include file.
HekDescEE - Hekateros end effector tool 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.
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
Definition: hekateros.h:56