actuators.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2023 RaccoonLab.
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, version 3.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Author: Dmitry Ponomarev <ponomarevda96@gmail.com>
17  */
18 
19 #ifndef SRC_ACTUATORS_HPP
20 #define SRC_ACTUATORS_HPP
21 
22 #include <ros/ros.h>
23 #include <sensor_msgs/Joy.h>
24 #include <std_msgs/Bool.h>
25 
26 struct Actuators {
27  Actuators() : _actuators(8, 0.0) {}
28  void init(ros::NodeHandle& node){
29  actuatorsSub_ = node.subscribe("/uav/actuators", 1, &Actuators::actuatorsCallback, this);
30  armSub_ = node.subscribe("/uav/arm", 1, &Actuators::armCallback, this);
31  }
32 
34  std::vector<double> _actuators;
37  uint64_t maxDelayUsec_;
38  uint64_t actuatorsMsgCounter_{0};
39  void actuatorsCallback(sensor_msgs::Joy::Ptr msg);
40 
41  uint8_t _scenarioType{0};
42 
44  bool armed_ = false;
45  void armCallback(std_msgs::Bool msg);
46 };
47 
48 #endif // SRC_ACTUATORS_HPP
uint64_t actuatorsMsgCounter_
Definition: actuators.hpp:38
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void init(ros::NodeHandle &node)
Definition: actuators.hpp:28
ros::Subscriber actuatorsSub_
Definition: actuators.hpp:33
uint64_t lastActuatorsTimestampUsec_
Definition: actuators.hpp:35
bool armed_
Definition: actuators.hpp:44
std::vector< double > _actuators
Definition: actuators.hpp:34
uint8_t _scenarioType
Definition: actuators.hpp:41
uint64_t prevActuatorsTimestampUsec_
Definition: actuators.hpp:36
void armCallback(std_msgs::Bool msg)
Definition: actuators.cpp:40
void actuatorsCallback(sensor_msgs::Joy::Ptr msg)
Definition: actuators.cpp:22
ros::Subscriber armSub_
Definition: actuators.hpp:43
uint64_t maxDelayUsec_
Definition: actuators.hpp:37


inno_vtol_dynamics
Author(s): Roman Fedorenko, Dmitry Ponomarev, Ezra Tal, Winter Guerra
autogenerated on Sat Jul 1 2023 02:13:44