actuators.cpp
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 #include "actuators.hpp"
20 
21 
22 void Actuators::actuatorsCallback(sensor_msgs::Joy::Ptr msg){
24  lastActuatorsTimestampUsec_ = msg->header.stamp.toNSec() / 1000;
26  if(crntDelayUsec > maxDelayUsec_){
27  maxDelayUsec_ = crntDelayUsec;
28  }
30 
31  for(size_t idx = 0; idx < msg->axes.size(); idx++){
32  _actuators[idx] = msg->axes[idx];
33  }
34 
35  if (_scenarioType == 1) {
36  _actuators[7] = 0.0;
37  }
38 }
39 
40 void Actuators::armCallback(std_msgs::Bool msg){
41  if(armed_ != msg.data){
45  ROS_INFO_STREAM_THROTTLE(1, "cmd: " << (msg.data ? "Arm" : "Disarm"));
46  }
47  armed_ = msg.data;
48 }
#define ROS_INFO_STREAM_THROTTLE(period, args)
uint64_t actuatorsMsgCounter_
Definition: actuators.hpp:38
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
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