EMCY.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of the SCHUNK Canopen Driver suite.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 SCHUNK GmbH, Lauffen/Neckar Germany
00012 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00023 //----------------------------------------------------------------------
00024 
00025 #ifndef EMCY_H
00026 #define EMCY_H
00027 
00028 #include <boost/shared_ptr.hpp>
00029 #include "helper.h"
00030 #include "SDO.h"
00031 
00032 namespace icl_hardware {
00033 namespace canopen_schunk {
00034 
00042 class EMCY
00043 {
00044 public:
00045   typedef boost::shared_ptr<EMCY> Ptr;
00046   typedef boost::shared_ptr<const EMCY> ConstPtr;
00047 
00052   enum eEMCY_STATUS
00053   {
00054     EMCY_STATE_ERROR_FREE,
00055     EMCY_STATE_ERROR_OCCURED
00056   };
00057 
00058   static const uint16_t EMCY_ERROR_RESET_NO_ERROR = 0x0000;
00059 
00063   EMCY(const uint8_t node_id);
00064 
00069   virtual void update(const CanMsg& msg);
00070 
00074   eEMCY_STATUS getEmcyStatus() const;
00075 
00084   bool getErrorInformation(uint16_t& eec, uint8_t& error_register, std::vector<uint8_t>& msef);
00085 
00092   static void addEmergencyErrorMap(const std::string& filename, const std::string& block_identifier);
00093 
00100   static void addErrorRegisterMap(const std::string& filename, const std::string& block_identifier);
00101 
00108   void printLastErrors( SDO& sdo );
00109 
00122   void printError (SDO& sdo, const uint8_t error_nr = 1);
00123 
00132   void clearErrorHistory(SDO& sdo);
00133 
00134 
00135 protected:
00136   virtual std::string lookupMSEFString () const;
00137 
00138 private:
00139   static std::string lookupEECString(const uint16_t error_code);
00140   static std::string lookupErrorRegisterString(const uint8_t error_code);
00141 
00142   uint8_t m_node_id;
00143 
00145   std::vector<uint8_t> m_msef;
00146 
00148   uint8_t m_error_register;
00149 
00151   uint16_t m_eec;
00152 
00153   eEMCY_STATUS m_error_state;
00154 
00155   boost::mutex m_data_buffer_mutex;
00156 
00157   static std::map<uint16_t, std::string> m_eec_map;
00158   static std::map<uint8_t, std::string> m_error_register_map;
00159 };
00160 
00161 
00162 }} // end of NS
00163 
00164 #endif // EMCY_H


schunk_canopen_driver
Author(s): Felix Mauch , Georg Heppner
autogenerated on Thu Jun 6 2019 20:17:24