PDO.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 PDO_H
00026 #define PDO_H
00027 
00028 #include <boost/shared_ptr.hpp>
00029 #include <vector>
00030 #include "helper.h"
00031 #include "SDO.h"
00032 
00033 namespace icl_hardware {
00034 namespace canopen_schunk {
00035 
00036 
00044 class PDO
00045 {
00046 public:
00053   struct MappingConfiguration
00054   {
00055     uint16_t index;
00056     uint8_t subindex;
00057     uint8_t length;
00058     std::string name;
00066     MappingConfiguration (const uint16_t index_, const uint8_t subindex_, const uint8_t length_, const std::string& name_) :
00067     index(index_), subindex(subindex_), length(length_), name(name_) {}
00068   };
00070   typedef std::vector<MappingConfiguration> MappingConfigurationList;
00071 
00084   class Mapping
00085   {
00086   public:
00091     Mapping (const MappingConfiguration& mapping_configuration_) : mapping_configuration ( mapping_configuration_ )
00092     {
00093       data.resize( mapping_configuration.length / 8, 0);
00094     }
00095 
00097     std::vector<uint8_t> data;
00102     MappingConfiguration getConfiguration() const { return mapping_configuration;}
00103   private:
00104     MappingConfiguration mapping_configuration;
00105   };
00106   typedef std::vector<Mapping> MappingList;
00107 
00114   struct PDOStringMatch
00115   {
00116     std::string name;
00117     uint8_t pdo_mapping_index;
00118   };
00119   typedef std::vector<PDOStringMatch> PDOStringMatchVec;
00120 
00122   enum eTransmissionType {
00123     SYNCHRONOUS_ACYCLIC = 0,
00124     RTR_ONLY_SYNCHRONOUS = 252,
00125     RTR_ONLY_EVENT_DRIVEN = 253,
00126     EVENT_DRIVEN_MANUFACTURER_SPECIFIC = 254,
00127     EVENT_DRIVEN_PROFILE_SPECIFIC = 255,
00128     SYNCHRONOUS_CYCLIC = 1 // Note: There are many many more synchronous cyclic variants but as they are easily calculated we omit having enums for them
00129   };
00130 
00131 
00133   typedef boost::shared_ptr<PDO> Ptr;
00135   typedef std::vector<boost::shared_ptr<PDO> > PtrList;
00136 
00144   PDO(const uint8_t node_id, const uint8_t pdo_nr, const CanDevPtr& can_device);
00145 
00172   PDOStringMatchVec remap (SDO& sdo,
00173                            const MappingConfigurationList& mappings,
00174                            const eTransmissionType& transmission_type,
00175                            const uint16_t pdo_cob_id,
00176                            const uint16_t pdo_communication_parameter,
00177                            const uint16_t pdo_mapping_parameter,
00178                            const bool dummy_mapping = false,
00179                            const uint8_t cyclic_timeout_cycles = 0);
00180 
00206   PDOStringMatchVec appendMapping(SDO& sdo,
00207                                   const MappingConfigurationList& mappings,
00208                                   const eTransmissionType& transmission_type,
00209                                   const uint16_t pdo_cob_id,
00210                                   const uint16_t pdo_communication_parameter,
00211                                   const uint16_t pdo_mapping_parameter,
00212                                   const bool dummy_mapping = false,
00213                                   const uint8_t cyclic_timeout_cycles = 0);
00214 
00216   MappingList m_mapping_list;
00217 
00218 protected:
00220   uint8_t m_node_id;
00221 
00223   uint8_t m_pdo_nr;
00224 
00226   CanDevPtr m_can_device;
00227 };
00228 
00229 
00230 }}// end of NS
00231 #endif // PDO_H


schunk_canopen_driver
Author(s): Felix Mauch , Georg Heppner
autogenerated on Sun May 22 2016 03:30:56