Kuon  1.1.3
RoadNarrows Robotics Large Outdoor Mobile Robot Project
kuonStatus.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Kuon
4 //
5 // Library: libkuon
6 //
7 // File: kuonStatus.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2014-04-04 17:05:03 -0600 (Fri, 04 Apr 2014) $
12  * $Rev: 3629 $
13  *
14  * \brief Kuon Robot Status classes implementations.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \copyright
19  * \h_copy 2014-2017. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25 // Unless otherwise noted, all materials contained are copyrighted and may not
26 // be used except as provided in these terms and conditions or in the copyright
27 // notice (documents and software ) or other proprietary notice provided with
28 // the relevant materials.
29 //
30 //
31 // IN NO EVENT SHALL THE AUTHOR, ROADNARROWS, OR ANY MEMBERS/EMPLOYEES/
32 // CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
33 // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
34 // DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
35 // EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
36 // THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // THE AUTHORS AND ROADNARROWS SPECIFICALLY DISCLAIM ANY WARRANTIES,
39 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
40 // FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
41 // "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
42 // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
43 //
44  * @EulaEnd@
45  */
46 ////////////////////////////////////////////////////////////////////////////////
47 
48 
49 #include <stdio.h>
50 
51 #include <string>
52 #include <vector>
53 
54 #include "rnr/rnrconfig.h"
55 #include "rnr/log.h"
56 
57 #include "Kuon/kuon.h"
58 #include "Kuon/kuonStatus.h"
59 
60 using namespace std;
61 using namespace kuon;
62 
63 
64 // -----------------------------------------------------------------------------
65 // Class KuonMotorHealth
66 // -----------------------------------------------------------------------------
67 
68 KuonMotorHealth::KuonMotorHealth()
69 {
70  m_nMotorId = KuonMotorIdNone;
71  m_fTemperature = 0.0;
72  m_fVoltage = 0.0;
73  m_uAlarms = KUON_ALARM_NONE;
74 }
75 
76 KuonMotorHealth::KuonMotorHealth(const KuonMotorHealth &src)
77 {
78  m_strName = src.m_strName;
79  m_nMotorId = src.m_nMotorId;
80  m_fTemperature = src.m_fTemperature;
81  m_fVoltage = src.m_fVoltage;
82  m_uAlarms = src.m_uAlarms;
83 }
84 
85 KuonMotorHealth KuonMotorHealth::operator=(const KuonMotorHealth &rhs)
86 {
87  m_strName = rhs.m_strName;
88  m_nMotorId = rhs.m_nMotorId;
89  m_fTemperature = rhs.m_fTemperature;
90  m_fVoltage = rhs.m_fVoltage;
91  m_uAlarms = rhs.m_uAlarms;
92 
93  return *this;
94 }
95 
96 
97 // -----------------------------------------------------------------------------
98 // Class KuonRobotStatus
99 // -----------------------------------------------------------------------------
100 
101 KuonRobotStatus::KuonRobotStatus(const KuonRobotStatus &src)
102 {
103  m_eRobotMode = src.m_eRobotMode;
104  m_eIsEStopped = src.m_eIsEStopped;
105  m_eAreDrivesPowered = src.m_eAreDrivesPowered;
106  m_eIsMotionPossible = src.m_eIsMotionPossible;
107  m_eIsInMotion = src.m_eIsInMotion;
108  m_eIsInError = src.m_eIsInError;
109  m_nErrorCode = src.m_nErrorCode;
110  m_fGovernor = src.m_fGovernor;
111  m_fBattery = src.m_fBattery;
112  m_vecMotorHealth = src.m_vecMotorHealth;
113 }
114 
115 KuonRobotStatus KuonRobotStatus::operator=(const KuonRobotStatus &rhs)
116 {
117  m_eRobotMode = rhs.m_eRobotMode;
118  m_eIsEStopped = rhs.m_eIsEStopped;
119  m_eAreDrivesPowered = rhs.m_eAreDrivesPowered;
120  m_eIsMotionPossible = rhs.m_eIsMotionPossible;
121  m_eIsInMotion = rhs.m_eIsInMotion;
122  m_eIsInError = rhs.m_eIsInError;
123  m_nErrorCode = rhs.m_nErrorCode;
124  m_fGovernor = rhs.m_fGovernor;
125  m_fBattery = rhs.m_fBattery;
126  m_vecMotorHealth = rhs.m_vecMotorHealth;
127 
128  return *this;
129 }
130 
131 void KuonRobotStatus::clear()
132 {
133  m_eRobotMode = KuonRobotModeUnknown;
134  m_eIsEStopped = KuonTriStateUnknown;
135  m_eAreDrivesPowered = KuonTriStateUnknown;
136  m_eIsMotionPossible = KuonTriStateUnknown;
137  m_eIsInMotion = KuonTriStateUnknown;
138  m_eIsInError = KuonTriStateUnknown;
139  m_nErrorCode = KUON_OK;
140  m_fGovernor = 0.20;
141  m_fBattery = 0.0;
142  m_vecMotorHealth.clear();
143 }
KuonTriState m_eIsMotionPossible
motion is [not] possible
Definition: kuonStatus.h:152
KuonTriState m_eAreDrivesPowered
motor are [not] powered
Definition: kuonStatus.h:151
static const int KUON_ALARM_NONE
no alarms
Definition: kuon.h:120
static const int KUON_OK
not an error, success
Definition: kuon.h:80
uint_t m_uAlarms
motor alarms
Definition: kuonStatus.h:99
float m_fGovernor
speed limiting governor (0-1)
Definition: kuonStatus.h:156
float m_fVoltage
motor voltage (volts)
Definition: kuonStatus.h:98
KuonTriState m_eIsInMotion
robot is [not] moving
Definition: kuonStatus.h:153
int m_nMotorId
motor id
Definition: kuonStatus.h:96
Kuon Robot Status classes interfaces.
The <b><i>Kuon</i></b> namespace encapsulates all <b><i>Kuon</i></b> related constructs.
Definition: kuon.h:66
float m_fTemperature
motor temperature (Celsius)
Definition: kuonStatus.h:97
unknown mode state
Definition: kuon.h:366
int m_nErrorCode
kuon error code
Definition: kuonStatus.h:155
KuonTriState m_eIsEStopped
robot is [not] emergency stopped
Definition: kuonStatus.h:150
RoadNarrows Kuon robot top-level header file.
static const int KuonMotorIdNone
no motor id
Definition: kuon.h:301
float m_fBattery
current battery energy (Wh)
Definition: kuonStatus.h:157
VecHealth m_vecMotorHealth
motors&#39; health
Definition: kuonStatus.h:158
Robot global status.
Definition: kuonStatus.h:110
std::string m_strName
motor name
Definition: kuonStatus.h:95
KuonRobotMode m_eRobotMode
robot operating mode
Definition: kuonStatus.h:149
unknown state
Definition: kuon.h:340
KuonTriState m_eIsInError
robot is [not] in error condition
Definition: kuonStatus.h:154
Robot motor health.
Definition: kuonStatus.h:66