Motion Master
Loading...
Searching...
No Matches
soem_master.h
Go to the documentation of this file.
1#include <map>
2#include <memory>
3#include <string>
4
5#include "ethercat_master.h"
6#include "ethercat_slave.h"
7#include "notifier.h"
8
9class SoemMaster : public EthercatMaster {
10 Notifier& notifier_;
11 const std::string& ifname_;
12 std::atomic_bool running_;
13 bool pdo_communication_possible_ = false;
14
15 public:
34 static std::map<uint16_t, std::unique_ptr<EthercatSlave>> slaveMap;
87 explicit SoemMaster(Notifier& notifier, const std::string& ifname);
88 ~SoemMaster() override;
89 size_t start() override;
90 void stop() override;
91 size_t restart() override;
92 int32_t execute(uint64_t pending_signals) override;
93 bool is_running() override;
94 int get_slaves_responding() override;
95 std::list<VirtualDevice*> get_slaves() override;
96 bool disable_all_slaves() override;
97 static void wait_for_slaves(Notifier& notifier, const std::string& ifname);
98 int roundtrip();
99 void checkstate();
100};
Definition ethercat_master.h:9
Definition notifier.h:9
std::list< VirtualDevice * > get_slaves() override
Get all of the available slaves.
Definition soem_master.cc:247
void checkstate()
Definition soem_master.cc:359
bool disable_all_slaves() override
Switch all slaves to PREOP.
Definition soem_master.cc:255
void stop() override
Stop the EtherCAT master.
Definition soem_master.cc:167
~SoemMaster() override
Definition soem_master.cc:154
static void wait_for_slaves(Notifier &notifier, const std::string &ifname)
Definition soem_master.cc:283
int get_slaves_responding() override
Return the number of slaves actually responding on the bus.
Definition soem_master.cc:245
static std::map< uint16_t, std::unique_ptr< EthercatSlave > > slaveMap
Static map of EtherCAT slave instances.
Definition soem_master.h:16
SoemMaster(Notifier &notifier, const std::string &ifname)
Initializes the SOEM EtherCAT master and brings all discovered slaves to OPERATIONAL state.
Definition soem_master.cc:18
int roundtrip()
Definition soem_master.cc:340
size_t restart() override
Returns the number of EtherCAT slaves during a restart.
Definition soem_master.cc:193
bool is_running() override
Check if the EtherCAT master is currently running.
Definition soem_master.cc:243
size_t start() override
Start the EtherCAT master.
Definition soem_master.cc:156
int32_t execute(uint64_t pending_signals) override
Main EtherCAT master loop function to be executed at one millisecond interval.
Definition soem_master.cc:195