ros2_canopen  master
C++ ROS CANopen Library
default_homing_mode.hpp
Go to the documentation of this file.
1 #ifndef DEFAULT_HOMING_MODE_HPP
2 #define DEFAULT_HOMING_MODE_HPP
3 #include <mutex>
5 #include "homing_mode.hpp"
6 
7 namespace ros2_canopen
8 {
9 
11 {
12  const uint16_t index = 0x6098;
13  std::shared_ptr<LelyDriverBridge> driver;
14 
15  std::atomic<bool> execute_;
16 
17  std::mutex mutex_;
18  std::condition_variable cond_;
19  uint16_t status_;
20 
21  enum SW_masks
22  {
23  MASK_Reached = (1 << State402::SW_Target_reached),
24  MASK_Attained = (1 << SW_Attained),
25  MASK_Error = (1 << SW_Error),
26  };
27  bool error(const std::string & msg)
28  {
29  execute_ = false;
30  std::cout << msg << std::endl;
31  return false;
32  }
33 
34 public:
35  DefaultHomingMode(std::shared_ptr<LelyDriverBridge> driver) { this->driver = driver; }
36  virtual bool start();
37  virtual bool read(const uint16_t & sw);
38  virtual bool write(OpModeAccesser & cw);
39 
40  virtual bool executeHoming();
41 };
42 } // namespace ros2_canopen
43 #endif // DEFAULT_HOMING_MODE_HPP
Definition: default_homing_mode.hpp:11
virtual bool read(const uint16_t &sw)
DefaultHomingMode(std::shared_ptr< LelyDriverBridge > driver)
Definition: default_homing_mode.hpp:35
virtual bool write(OpModeAccesser &cw)
Definition: homing_mode.hpp:9
@ SW_Error
Definition: homing_mode.hpp:14
@ SW_Attained
Definition: homing_mode.hpp:13
@ SW_Target_reached
Definition: state.hpp:25
Definition: word_accessor.hpp:10
Definition: configuration_manager.hpp:28