ExampleSlave.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #define RX_PDO_ID 0x6000
7 #define TX_PDO_ID 0x7000
8 
10 {
11 struct TxPdo
12 {
14  float data1 = 0.0;
15  float data2 = 0.0;
16 } __attribute__((packed));
17 
18 struct RxPdo
19 {
20  float command1 = 0.0;
21  float command2 = 0.0;
22 } __attribute__((packed));
23 
25 {
26 public:
27  ExampleSlave(const std::string& name, rokubimini::soem_interface::EthercatBusBase* bus, const uint32_t address);
28  ~ExampleSlave() override = default;
29 
30  std::string getName() const override
31  {
32  return name_;
33  }
34 
35  bool startup() override;
36  void updateRead() override;
37  void updateWrite() override;
38  void shutdown() override;
39 
40  PdoInfo getCurrentPdoInfo() const override
41  {
42  return pdoInfo_;
43  }
44 
45 private:
46  const std::string name_;
47  PdoInfo pdoInfo_;
50 };
51 } // namespace soem_interface_examples
Base class for generic ethercat slaves using soem.
std::string getName() const override
Returns the name of the slave.
unsigned char uint8_t
float command1
unsigned int uint32_t
ROSCONSOLE_DECL void shutdown()
Class for managing an ethercat bus containing one or multiple slaves.
float command2
PdoInfo getCurrentPdoInfo() const override
Gets the current pdo information.
soem_interface_examples::ExampleSlave __attribute__


rokubimini_ethercat
Author(s):
autogenerated on Wed Mar 3 2021 03:09:16