ros2_canopen master
C++ ROS CANopen Library
Loading...
Searching...
No Matches
mode.hpp
Go to the documentation of this file.
1// Copyright 2023 Christoph Hellmann Santos
2// Copyright 2014-2022 Authors of ros_canopen
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16//
17
18#ifndef CANOPEN_402_DRIVER_MODE_HPP
19#define CANOPEN_402_DRIVER_MODE_HPP
20
21#include <cstdint>
22#include <memory>
23#include "command.hpp"
24#include "state.hpp"
25#include "word_accessor.hpp"
26
27namespace ros2_canopen
28{
29class Mode
30{
31public:
32 const uint16_t mode_id_;
33 Mode(uint16_t id) : mode_id_(id) {}
34 typedef WordAccessor<
39 virtual bool start() = 0;
40 virtual bool read(const uint16_t & sw) = 0;
41 virtual bool write(OpModeAccesser & cw) = 0;
42 virtual bool setTarget(const double & val) { return false; }
43 virtual ~Mode() {}
44};
45typedef std::shared_ptr<Mode> ModeSharedPtr;
46} // namespace ros2_canopen
47
48#endif // CANOPEN_402_DRIVER_MODE_HPP
@ CW_Operation_mode_specific3
Definition command.hpp:69
@ CW_Operation_mode_specific1
Definition command.hpp:65
@ CW_Operation_mode_specific0
Definition command.hpp:64
@ CW_Operation_mode_specific2
Definition command.hpp:66
Definition mode.hpp:30
virtual bool read(const uint16_t &sw)=0
virtual bool setTarget(const double &val)
Definition mode.hpp:42
virtual ~Mode()
Definition mode.hpp:43
Mode(uint16_t id)
Definition mode.hpp:33
virtual bool write(OpModeAccesser &cw)=0
const uint16_t mode_id_
Definition mode.hpp:32
WordAccessor<(1<< Command402::CW_Operation_mode_specific0)|(1<< Command402::CW_Operation_mode_specific1)|(1<< Command402::CW_Operation_mode_specific2)|(1<< Command402::CW_Operation_mode_specific3)> OpModeAccesser
Definition mode.hpp:38
virtual bool start()=0
Definition word_accessor.hpp:27
Definition configuration_manager.hpp:28
std::shared_ptr< Mode > ModeSharedPtr
Definition mode.hpp:45