PDO.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 PDO_H
26 #define PDO_H
27 
28 #include <boost/shared_ptr.hpp>
29 #include <vector>
30 #include "helper.h"
31 #include "SDO.h"
32 
33 namespace icl_hardware {
34 namespace canopen_schunk {
35 
36 
44 class PDO
45 {
46 public:
54  {
58  std::string name;
66  MappingConfiguration (const uint16_t index_, const uint8_t subindex_, const uint8_t length_, const std::string& name_) :
67  index(index_), subindex(subindex_), length(length_), name(name_) {}
68  };
70  typedef std::vector<MappingConfiguration> MappingConfigurationList;
71 
84  class Mapping
85  {
86  public:
91  Mapping (const MappingConfiguration& mapping_configuration_) : mapping_configuration ( mapping_configuration_ )
92  {
93  data.resize( mapping_configuration.length / 8, 0);
94  }
95 
97  std::vector<uint8_t> data;
102  MappingConfiguration getConfiguration() const { return mapping_configuration;}
103  private:
105  };
106  typedef std::vector<Mapping> MappingList;
107 
115  {
116  std::string name;
118  };
119  typedef std::vector<PDOStringMatch> PDOStringMatchVec;
120 
128  SYNCHRONOUS_CYCLIC = 1 // Note: There are many many more synchronous cyclic variants but as they are easily calculated we omit having enums for them
129  };
130 
131 
135  typedef std::vector<boost::shared_ptr<PDO> > PtrList;
136 
144  PDO(const uint8_t node_id, const uint8_t pdo_nr, const CanDevPtr& can_device);
145 
172  PDOStringMatchVec remap (SDO& sdo,
173  const MappingConfigurationList& mappings,
174  const eTransmissionType& transmission_type,
175  const uint16_t pdo_cob_id,
176  const uint16_t pdo_communication_parameter,
177  const uint16_t pdo_mapping_parameter,
178  const bool dummy_mapping = false,
179  const uint8_t cyclic_timeout_cycles = 0);
180 
206  PDOStringMatchVec appendMapping(SDO& sdo,
207  const MappingConfigurationList& mappings,
208  const eTransmissionType& transmission_type,
209  const uint16_t pdo_cob_id,
210  const uint16_t pdo_communication_parameter,
211  const uint16_t pdo_mapping_parameter,
212  const bool dummy_mapping = false,
213  const uint8_t cyclic_timeout_cycles = 0);
214 
216  MappingList m_mapping_list;
217 
218 protected:
221 
224 
227 };
228 
229 
230 }}// end of NS
231 #endif // PDO_H
std::vector< Mapping > MappingList
Definition: PDO.h:106
MappingList m_mapping_list
List of all mappings inside this PDO.
Definition: PDO.h:216
std::vector< MappingConfiguration > MappingConfigurationList
The MappingConfigurationList holds multiple Mapping configurations. The Mapping of a single PDO is de...
Definition: PDO.h:70
std::vector< boost::shared_ptr< PDO > > PtrList
Convenience typedef to use PDO lists with shared pointers.
Definition: PDO.h:135
CanDevPtr m_can_device
Can Device handle.
Definition: PDO.h:226
std::vector< uint8_t > data
Actual data of the PDO is stored in this data vector.
Definition: PDO.h:97
Mapping(const MappingConfiguration &mapping_configuration_)
Mapping Creates a new mapping that stores the mapping information and the mapped data.
Definition: PDO.h:91
uint8_t m_node_id
CANOPEN ID of the node this PDO belongs to.
Definition: PDO.h:220
PDOStringMatchVec remap(SDO &sdo, const MappingConfigurationList &mappings, const eTransmissionType &transmission_type, const uint16_t pdo_cob_id, const uint16_t pdo_communication_parameter, const uint16_t pdo_mapping_parameter, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0)
Configure a PDO by sending some SDO packages. This can be either done during NMT state pre-operationa...
Definition: PDO.cpp:45
MappingConfiguration mapping_configuration
Definition: PDO.h:104
PDO(const uint8_t node_id, const uint8_t pdo_nr, const CanDevPtr &can_device)
Construct a new PDO.
Definition: PDO.cpp:36
eTransmissionType
Transmission types of a PDO, needed when mapping PDOs.
Definition: PDO.h:122
uint8_t m_pdo_nr
The PDO number inside the logical device. Theoretically this can be in 0 to 511.
Definition: PDO.h:223
unsigned char uint8_t
Unique index to find a mapped Object dictionary item in a PDO.
Definition: PDO.h:114
std::vector< PDOStringMatch > PDOStringMatchVec
Definition: PDO.h:119
PDOStringMatchVec appendMapping(SDO &sdo, const MappingConfigurationList &mappings, const eTransmissionType &transmission_type, const uint16_t pdo_cob_id, const uint16_t pdo_communication_parameter, const uint16_t pdo_mapping_parameter, const bool dummy_mapping=false, const uint8_t cyclic_timeout_cycles=0)
Appends one or more mapping parameters to the existing mapping. Note that the PDO will be disabled wh...
Definition: PDO.cpp:229
The PDO class provides access to one (of the possible multiple) Process Data Object of a canOpen node...
Definition: PDO.h:44
The SDO class represents Service Data Objects (SDO) that are used for slow access of the canOpen obje...
Definition: SDO.h:40
Holds the mapping parameter plus the actual data.
Definition: PDO.h:84
MappingConfiguration getConfiguration() const
getConfiguration Returns the current mapping configuration of the PDO
Definition: PDO.h:102
unsigned short uint16_t
Mapping of a PDO. This is basically a description that says where to look in the object dictionary an...
Definition: PDO.h:53
boost::shared_ptr< PDO > Ptr
Convenience typedef to use PDOs with shared pointers.
Definition: PDO.h:133
MappingConfiguration(const uint16_t index_, const uint8_t subindex_, const uint8_t length_, const std::string &name_)
MappingConfiguration Create a new mapping configuration entry.
Definition: PDO.h:66


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