Motion Master
Loading...
Searching...
No Matches
soem_master.h
Go to the documentation of this file.
1#include <chrono>
2#include <map>
3#include <memory>
4#include <string>
5
6#include "ethercat_master.h"
7#include "ethercat_slave.h"
8#include "notifier.h"
9
10class SoemMaster : public EthercatMaster {
11 Notifier &notifier_;
12 const std::string &ifname_;
13 std::atomic_bool running_;
14 bool pdo_communication_possible_ = false;
15
16 std::chrono::time_point<std::chrono::steady_clock> start_;
17
18 public:
37 static std::map<uint16_t, std::unique_ptr<EthercatSlave>> slaveMap;
38 explicit SoemMaster(Notifier &notifier, const std::string &ifname);
39 ~SoemMaster() override;
40 size_t start() override;
41 void stop() override;
42 size_t restart() override;
43 int32_t execute(uint64_t pending_signals) override;
44 bool is_running() override;
45 int get_slaves_responding() override;
46 std::list<VirtualDevice *> get_slaves() override;
47 bool disable_all_slaves() override;
48 void abort_all_client_requests() override {};
49 static void wait_for_slaves(Notifier &notifier, const std::string &ifname);
50 int roundtrip();
51 void checkstate();
52};
Definition: ethercat_master.h:9
Definition: notifier.h:10
Definition: soem_master.h:10
std::list< VirtualDevice * > get_slaves() override
Get all of the available slaves.
Definition: soem_master.cc:143
void checkstate()
Definition: soem_master.cc:233
bool disable_all_slaves() override
Switch all slaves to PREOP.
Definition: soem_master.cc:151
void stop() override
Stop the EtherCAT master.
Definition: soem_master.cc:99
~SoemMaster() override
Definition: soem_master.cc:86
static void wait_for_slaves(Notifier &notifier, const std::string &ifname)
Definition: soem_master.cc:161
int get_slaves_responding() override
Return the number of slaves actually responding on the bus.
Definition: soem_master.cc:141
static std::map< uint16_t, std::unique_ptr< EthercatSlave > > slaveMap
Static map of EtherCAT slave instances.
Definition: soem_master.h:37
void abort_all_client_requests() override
Definition: soem_master.h:48
int roundtrip()
Definition: soem_master.cc:207
size_t restart() override
Returns the number of EtherCAT slaves during a restart.
Definition: soem_master.cc:119
bool is_running() override
Check if the EtherCAT master is currently running.
Definition: soem_master.cc:139
size_t start() override
Start the EtherCAT master.
Definition: soem_master.cc:88
int32_t execute(uint64_t pending_signals) override
Main EtherCAT master loop function to be executed at one millisecond interval.
Definition: soem_master.cc:121