EMCY.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of the SCHUNK Canopen Driver suite.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 SCHUNK GmbH, Lauffen/Neckar Germany
12 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
23 //----------------------------------------------------------------------
24 
25 #ifndef EMCY_H
26 #define EMCY_H
27 
28 #include <boost/shared_ptr.hpp>
29 #include "helper.h"
30 #include "SDO.h"
31 
32 namespace icl_hardware {
33 namespace canopen_schunk {
34 
42 class EMCY
43 {
44 public:
47 
53  {
56  };
57 
58  static const uint16_t EMCY_ERROR_RESET_NO_ERROR = 0x0000;
59 
63  EMCY(const uint8_t node_id);
64 
69  virtual void update(const CanMsg& msg);
70 
75 
84  bool getErrorInformation(uint16_t& eec, uint8_t& error_register, std::vector<uint8_t>& msef);
85 
92  static void addEmergencyErrorMap(const std::string& filename, const std::string& block_identifier);
93 
100  static void addErrorRegisterMap(const std::string& filename, const std::string& block_identifier);
101 
108  void printLastErrors( SDO& sdo );
109 
122  void printError (SDO& sdo, const uint8_t error_nr = 1);
123 
132  void clearErrorHistory(SDO& sdo);
133 
134 
135 protected:
136  virtual std::string lookupMSEFString () const;
137 
138 private:
139  static std::string lookupEECString(const uint16_t error_code);
140  static std::string lookupErrorRegisterString(const uint8_t error_code);
141 
143 
145  std::vector<uint8_t> m_msef;
146 
149 
152 
154 
155  boost::mutex m_data_buffer_mutex;
156 
157  static std::map<uint16_t, std::string> m_eec_map;
158  static std::map<uint8_t, std::string> m_error_register_map;
159 };
160 
161 
162 }} // end of NS
163 
164 #endif // EMCY_H
static std::string lookupEECString(const uint16_t error_code)
Definition: EMCY.cpp:115
void printLastErrors(SDO &sdo)
Print all errors present in error register 0x1003.
Definition: EMCY.cpp:258
static void addEmergencyErrorMap(const std::string &filename, const std::string &block_identifier)
Adds new information from an ini file to the emergency error map.
Definition: EMCY.cpp:213
void clearErrorHistory(SDO &sdo)
Clear the error register 0x1003.
Definition: EMCY.cpp:274
virtual void update(const CanMsg &msg)
update Updates the EMCY object with a received EMCY Message
Definition: EMCY.cpp:43
uint16_t m_eec
emergency_error_code;
Definition: EMCY.h:151
eEMCY_STATUS getEmcyStatus() const
Returns the state of the EMCY state machine.
Definition: EMCY.cpp:93
static std::map< uint16_t, std::string > m_eec_map
Definition: EMCY.h:157
unsigned char uint8_t
bool getErrorInformation(uint16_t &eec, uint8_t &error_register, std::vector< uint8_t > &msef)
Returns the full error information.
Definition: EMCY.cpp:99
The EMCY class handles the spontaneously occurring Emergency (EMCY) messages, keeps track of a nodes ...
Definition: EMCY.h:42
void printError(SDO &sdo, const uint8_t error_nr=1)
Prints a specific error from the error register 0x1003.
Definition: EMCY.cpp:237
EMCY(const uint8_t node_id)
EMCY Constructs a new EMCY object. The error map will be filled separately.
Definition: EMCY.cpp:38
static const uint16_t EMCY_ERROR_RESET_NO_ERROR
Definition: EMCY.h:58
static std::string lookupErrorRegisterString(const uint8_t error_code)
Definition: EMCY.cpp:178
static std::map< uint8_t, std::string > m_error_register_map
Definition: EMCY.h:158
eEMCY_STATUS
DS301 requests state error_free and error_occurred. This could be mapped into a bool, but maybe some other implementation needs more states, so we use an enum.
Definition: EMCY.h:52
boost::shared_ptr< const EMCY > ConstPtr
Definition: EMCY.h:46
The SDO class represents Service Data Objects (SDO) that are used for slow access of the canOpen obje...
Definition: SDO.h:40
boost::shared_ptr< EMCY > Ptr
Definition: EMCY.h:45
uint8_t m_error_register
register in which the error occured
Definition: EMCY.h:148
boost::mutex m_data_buffer_mutex
Definition: EMCY.h:155
std::vector< uint8_t > m_msef
manufacturer-specific error code
Definition: EMCY.h:145
static void addErrorRegisterMap(const std::string &filename, const std::string &block_identifier)
Adds new information from an ini file to the error_register map.
Definition: EMCY.cpp:225
unsigned short uint16_t
virtual std::string lookupMSEFString() const
Definition: EMCY.cpp:208


schunk_canopen_driver
Author(s): Felix Mauch , Georg Heppner
autogenerated on Mon Jun 10 2019 15:07:49