17 return !(*
this == other);
31 std::lock_guard<std::recursive_mutex> lock(
mutex_);
39 std::lock_guard<std::recursive_mutex> lock(
mutex_);
45 std::lock_guard<std::recursive_mutex> lock(
mutex_);
52 std::lock_guard<std::recursive_mutex> lock(
mutex_);
58 std::lock_guard<std::recursive_mutex> lock(
mutex_);
59 stamp_ = std::chrono::system_clock::now();
65 std::lock_guard<std::recursive_mutex> lock(
mutex_);
83 std::vector<std::string>& errors, std::vector<std::string>& fatals)
const 86 return getMessagesDiff(previous_statusword, infos, warnings, errors, fatals);
90 std::vector<std::string>& warnings, std::vector<std::string>& errors,
91 std::vector<std::string>& fatals)
const 96 warnings.emplace_back(
"High temperature in Rokubimini Sensor");
100 infos.emplace_back(
"Temperature in Rokubimini Sensor is normal again");
106 errors.emplace_back(
"Force/Torque is invalid. ADC saturation");
110 infos.emplace_back(
"Force/Torque is valid again. ADC is not saturated");
114 errors.emplace_back(
"Acceleration has saturated.");
118 infos.emplace_back(
"Acceleration is not saturated anymore.");
122 errors.emplace_back(
"Angular rates have saturated.");
126 infos.emplace_back(
"Angular rates are not saturated anymore.");
130 errors.emplace_back(
"Force/Torque is invalid. ADCs are not synced");
134 infos.emplace_back(
"Force/Torque is valid again. ADCs are synced");
138 errors.emplace_back(
"Sensing range exceeded.");
142 infos.emplace_back(
"Sensing range is not exceeded.");
148 fatals.emplace_back(
"Supply voltage exceeds limits.");
152 infos.emplace_back(
"Supply voltage is normal.");
158 std::lock_guard<std::recursive_mutex> lock(
mutex_);
164 std::lock_guard<std::recursive_mutex> lock(
mutex_);
170 std::lock_guard<std::recursive_mutex> lock(
mutex_);
176 std::lock_guard<std::recursive_mutex> lock(
mutex_);
182 std::lock_guard<std::recursive_mutex> lock(
mutex_);
188 std::lock_guard<std::recursive_mutex> lock(
mutex_);
194 std::lock_guard<std::recursive_mutex> lock(
mutex_);
200 for (uint32_t i = 8 *
sizeof(uint32_t); i > uint32_t(0); i--)
202 os << ((statusword.
getData() & (uint32_t(1) << (i - uint32_t(1)))) ?
"1" :
"0");
uint32_t errorSensingRangeExceeded_
bool hasErrorAccSaturated() const
Checks if the statusword has error ACC saturated.
Data()=default
Default constructor.
std::recursive_mutex mutex_
Mutex enabling synchronization.
void getMessages(std::vector< std::string > &infos, std::vector< std::string > &warnings, std::vector< std::string > &errors, std::vector< std::string > &fatals) const
Gets all the messages relevant to statuswords.
double getAge() const
Gets the age variable.
std::ostream & operator<<(std::ostream &os, const Statusword &statusword)
Outputs the statusword data to an output stream.
bool hasErrorSensingRangeExceeded() const
Checks if the statusword has error sensing range exceeded.
bool operator!=(const Data &other)
Checks if two Data are not equal.
void setData(const uint32_t data)
Sets the data variable.
std::chrono::system_clock::time_point TimePoint
Class representing the different states the communication or the sensors can be in.
uint32_t all_
All the bits in a "raw" uint32_t format.
bool isEmpty() const
Checks whether the statusword is empty.
bool operator==(const Data &other)
Checks if two Data are equal.
uint32_t errorAdcOutOfSync_
uint32_t errorAdcSaturated_
uint32_t getData() const
Gets the data variable.
void getMessagesDiff(Statusword &previousStatusword, std::vector< std::string > &infos, std::vector< std::string > &warnings, std::vector< std::string > &errors, std::vector< std::string > &fatals) const
Gets the different messages form the previous statusword.
Data data_
The data variable.
Statusword & operator=(const Statusword &statusword)
Assignment operator.
bool hasErrorGyroSaturated() const
Checks if the statusword has error gyro saturated.
bool hasErrorAdcOutOfSync() const
Checks if the statusword has error ADC out-of-sync.
TimePoint stamp_
Timestamp associated with the Data.
bool hasFatalSupplyVoltage() const
Checks if the statusword has fatal supply voltage.
TimePoint getStamp() const
Gets the stamp variable.
Data associated with a Status Word.
std::chrono::duration< double > Duration
uint32_t errorGyroSaturated_
uint32_t errorAccSaturated_
bool hasWarningOvertemperature() const
Checks if the statusword has warning over temperature.
bool hasErrorAdcSaturated() const
Checks if the statusword has error ADC saturated.
uint32_t warningOvertemperature_
uint32_t fatalSupplyVoltage_
Statusword()=default
Default constructor.
DataBits bits_
The bits of the data.