Hekateros  3.4.3
RoadNarrows Robotics Robot Arm Project
hekState.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Hekateros
4 //
5 // Library: libhekateros
6 //
7 // File: hekState.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2014-09-18 16:53:49 -0600 (Thu, 18 Sep 2014) $
12  * $Rev: 3748 $
13  *
14  * \brief Hekateros Robot State classes implementations.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  *
19  * \copyright
20  * \h_copy 2012-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Unless otherwise stated explicitly, all materials contained are copyrighted
28  * and may not be used without RoadNarrows LLC's written consent,
29  * except as provided in these terms and conditions or in the copyright
30  * notice (documents and software) or other proprietary notice provided with
31  * the relevant materials.
32  *
33  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
34  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
35  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
36  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
37  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
38  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
41  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
42  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
43  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
44  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
45  *
46  * @EulaEnd@
47  */
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 "Dynamixel/Dynamixel.h"
60 #include "Dynamixel/DynaComm.h"
61 
62 #include "Hekateros/hekateros.h"
63 #include "Hekateros/hekState.h"
64 
65 using namespace std;
66 using namespace hekateros;
67 
68 
69 // -----------------------------------------------------------------------------
70 // Class HekServoHealth
71 // -----------------------------------------------------------------------------
72 
73 HekServoHealth::HekServoHealth()
74 {
75  m_nServoId = DYNA_ID_NONE;
76  m_fTemperature = 0.0;
77  m_fVoltage = 0.0;
78  m_uAlarms = DYNA_ALARM_NONE;
79 }
80 
81 HekServoHealth::HekServoHealth(const HekServoHealth &src)
82 {
83  m_nServoId = src.m_nServoId;
84  m_fTemperature = src.m_fTemperature;
85  m_fVoltage = src.m_fVoltage;
86  m_uAlarms = src.m_uAlarms;
87 }
88 
89 HekServoHealth HekServoHealth::operator=(const HekServoHealth &rhs)
90 {
91  m_nServoId = rhs.m_nServoId;
92  m_fTemperature = rhs.m_fTemperature;
93  m_fVoltage = rhs.m_fVoltage;
94  m_uAlarms = rhs.m_uAlarms;
95 
96  return *this;
97 }
98 
99 
100 // -----------------------------------------------------------------------------
101 // Class HekRobotState
102 // -----------------------------------------------------------------------------
103 
104 HekRobotState::HekRobotState(const HekRobotState &src)
105 {
106  m_eRobotMode = src.m_eRobotMode;
107  m_eIsCalibrated = src.m_eIsCalibrated;
108  m_eIsEStopped = src.m_eIsEStopped;
109  m_eAreDrivesPowered = src.m_eAreDrivesPowered;
110  m_eIsMotionPossible = src.m_eIsMotionPossible;
111  m_eIsInMotion = src.m_eIsInMotion;
112  m_eIsInError = src.m_eIsInError;
113  m_nErrorCode = src.m_nErrorCode;
114  m_vecServoHealth = src.m_vecServoHealth;
115 }
116 
117 HekRobotState HekRobotState::operator=(const HekRobotState &rhs)
118 {
119  m_eRobotMode = rhs.m_eRobotMode;
120  m_eIsCalibrated = rhs.m_eIsCalibrated;
121  m_eIsEStopped = rhs.m_eIsEStopped;
122  m_eAreDrivesPowered = rhs.m_eAreDrivesPowered;
123  m_eIsMotionPossible = rhs.m_eIsMotionPossible;
124  m_eIsInMotion = rhs.m_eIsInMotion;
125  m_eIsInError = rhs.m_eIsInError;
126  m_nErrorCode = rhs.m_nErrorCode;
127  m_vecServoHealth = rhs.m_vecServoHealth;
128 
129  return *this;
130 }
131 
132 void HekRobotState::clear()
133 {
134  m_eRobotMode = HekRobotModeUnknown;
135  m_eIsCalibrated = HekTriStateUnknown;
136  m_eIsEStopped = HekTriStateUnknown;
137  m_eAreDrivesPowered = HekTriStateUnknown;
138  m_eIsMotionPossible = HekTriStateUnknown;
139  m_eIsInMotion = HekTriStateUnknown;
140  m_eIsInError = HekTriStateUnknown;
141  m_nErrorCode = HEK_OK;
142 }
Robot overall state.
Definition: hekState.h:114
int m_nServoId
servo id
Definition: hekState.h:100
int m_nErrorCode
hekateros error code
Definition: hekState.h:160
VecHealth m_vecServoHealth
servos&#39; health
Definition: hekState.h:161
HekTriState m_eIsInError
robot is [not] in error condition
Definition: hekState.h:159
HekTriState m_eIsEStopped
robot is [not] emergency stopped
Definition: hekState.h:155
float m_fTemperature
servo temperature (Celsius)
Definition: hekState.h:101
Hekateros Robot State classes interface.
uint_t m_uAlarms
servo alarms
Definition: hekState.h:103
float m_fVoltage
servo voltage (volts)
Definition: hekState.h:102
HekRobotMode m_eRobotMode
robot operating mode
Definition: hekState.h:153
Top-level package include file.
HekTriState m_eIsInMotion
robot is [not] moving
Definition: hekState.h:158
Robot servo health.
Definition: hekState.h:71
HekTriState m_eIsMotionPossible
motion is [not] possible
Definition: hekState.h:157
HekTriState m_eAreDrivesPowered
servos are [not] powered
Definition: hekState.h:156
HekTriState m_eIsCalibrated
robot is [not] calibrated
Definition: hekState.h:154
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
Definition: hekateros.h:56