MIRA
PersistentError.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 MetraLabs GmbH (MLAB), GERMANY.
3  * All rights reserved.
4  * Contact: info@MetraLabs.com
5  *
6  * Commercial Usage:
7  * Licensees holding valid commercial licenses may use this file in
8  * accordance with the commercial license agreement provided with the
9  * software or, alternatively, in accordance with the terms contained in
10  * a written agreement between you and MetraLabs.
11  *
12  * GNU General Public License Usage:
13  * Alternatively, this file may be used under the terms of the GNU
14  * General Public License version 3.0 as published by the Free Software
15  * Foundation and appearing in the file LICENSE.GPL3 included in the
16  * packaging of this file. Please review the following information to
17  * ensure the GNU General Public License version 3.0 requirements will be
18  * met: http://www.gnu.org/copyleft/gpl.html.
19  * Alternatively you may (at your option) use any later version of the GNU
20  * General Public License if such license has been publicly approved by
21  * MetraLabs (or its successors, if any).
22  *
23  * IN NO EVENT SHALL "MLAB" BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
24  * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
25  * OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLABS" HAS BEEN
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * "MLAB" SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
31  * "AS IS" BASIS, AND "MLAB" HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
32  * SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
33  */
34 
43 #ifndef _MLAB_PERSISTENTERROR_H_
44 #define _MLAB_PERSISTENTERROR_H_
45 
46 namespace mira { namespace robot {
47 
49 
52 {
53 public:
54  enum Type
55  {
56  WARNING = 0x00,
57  ERROR = 0x01
58  };
59 
62  powerupCounter(0),
63  unixTime(Time::unixEpoch()),
64  nodeID(0),
65  type(WARNING),
66  emergencyCode(0),
67  errorRegister(0),
68  code(0),
69  globalCounter(0),
70  accu24VVoltage(0),
71  accuMinVoltage(0),
72  accuCurrent(0),
73  accuMaxCurrent(0),
74  accuLoadVoltage(0),
79  accuStatus(0),
83  {
84  memset(cellVoltage, 0, 8 * sizeof(uint16));
85  }
86 
88  template <typename Reflector>
89  void reflect(Reflector& r)
90  {
91  r.member("PowerupCounter", powerupCounter, "");
92  r.member("UnixTime", unixTime, "");
93  r.member("NodeID", nodeID, "");
94  r.member("Type", type, "");
95  r.member("EmergencyCode", emergencyCode, "");
96  r.member("ErrorRegister", errorRegister, "");
97  r.member("Code", code, "");
98  r.member("GlobalCounter", globalCounter, "");
99  r.member("Accu24VVoltage", accu24VVoltage, "");
100  r.member("AccuMinVoltage", accuMinVoltage, "");
101  r.member("AccuCurrent", accuCurrent, "");
102  r.member("AccuMaxCurrent", accuMaxCurrent, "");
103  r.member("AccuMaxCurrent", accuMaxCurrent, "");
104  r.member("AccuLoadVoltage", accuLoadVoltage, "");
105  r.member("AccuVoltageExternalCharger", accuVoltageExtCh, "");
106  r.member("AccuCurrentExternalCharger", accuCurrentExtCh, "");
107  r.member("AccuVoltageInternalCharger", accuVoltageIntCh, "");
108  r.member("AccuCurrentInternalCharger", accuCurrentIntCh, "");
109  r.member("AccuStatus", accuStatus, "");
110  r.member("EmbeddedPCStatus", embeddedPCStatus, "");
111  r.member("RequestedVelocity", requestedVelocity, "");
112  r.member("RequestedVelocityTime", requestedVelocityTime, "");
113  r.member("CurrentVelocity", currentVelocity, "");
114  r.member("CurrentVelocityTime", currentVelocityTime, "");
115  r.member("CellVoltage", cellVoltage, "");
116  r.member("Message", message, "");
117  }
118 
119  uint16 powerupCounter;
121  uint8 nodeID;
123  uint16 emergencyCode;
125  uint32 code;
126  uint32 globalCounter;
129  float accuCurrent;
136  uint8 accuStatus;
142  float cellVoltage[8];
143  std::string message;
144 };
145 
147 
148 }}
149 
150 #endif
Definition: PersistentError.h:56
Velocity2 requestedVelocity
Requested velocity at time of error.
Definition: PersistentError.h:138
uint16 requestedVelocityTime
Timestamp of requested velocity at time of the error.
Definition: PersistentError.h:139
Velocity2 currentVelocity
Current velocity at time of error.
Definition: PersistentError.h:140
float accuLoadVoltage
Output voltage of the charger at time of error.
Definition: PersistentError.h:131
uint8 accuStatus
Flags of charger at time of the error.
Definition: PersistentError.h:136
uint16 powerupCounter
The Power-Up counter at time of the error.
Definition: PersistentError.h:119
void reflect(Reflector &r)
The reflect method.
Definition: PersistentError.h:89
float accuCurrentExtCh
Input current from external charger at time of the error.
Definition: PersistentError.h:133
float accuVoltageIntCh
Input voltage from internal charger at time of the error.
Definition: PersistentError.h:134
uint32 code
The error code.
Definition: PersistentError.h:125
std::string message
The error message.
Definition: PersistentError.h:143
uint8 embeddedPCStatus
Flags of embedded PC at time of the error.
Definition: PersistentError.h:137
Time unixTime
The Unix time of the error.
Definition: PersistentError.h:120
Type type
The error type.
Definition: PersistentError.h:122
float accu24VVoltage
Voltage of the battery at time of the error.
Definition: PersistentError.h:127
float accuMaxCurrent
Maximum current during the last seconds.
Definition: PersistentError.h:130
float accuCurrent
Current of the battery at time of the error.
Definition: PersistentError.h:129
float accuVoltageExtCh
Input voltage from external charger at time of the error.
Definition: PersistentError.h:132
A persistent stored (hardware) error.
Definition: PersistentError.h:51
float accuMinVoltage
Minimum voltage of battery during the last seconds.
Definition: PersistentError.h:128
Definition: PersistentError.h:57
float accuCurrentIntCh
Input current from internal charger at time of the error.
Definition: PersistentError.h:135
uint8 errorRegister
The error register.
Definition: PersistentError.h:124
uint16 emergencyCode
The emergency code.
Definition: PersistentError.h:123
uint32 globalCounter
The 10ms counter at time of the error.
Definition: PersistentError.h:126
uint16 currentVelocityTime
Timestamp of current velocity at time of the error.
Definition: PersistentError.h:141
uint8 nodeID
The node ID of the error source.
Definition: PersistentError.h:121
PersistentError()
The default constructor.
Definition: PersistentError.h:61
float cellVoltage[8]
Cell voltage of cell 0..7.
Definition: PersistentError.h:142
Type
Definition: PersistentError.h:54