octocopter.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 
20 #include "octocopter.hpp"
21 #include <iostream>
22 #include <ros/ros.h>
23 #include <geometry_msgs/TransformStamped.h>
24 
26  Eigen::Isometry3d motorFrame = Eigen::Isometry3d::Identity();
27 
28  motorFrame.translation() = Eigen::Vector3d(momentArm, momentArm, 0.);
29  multicopterSim_->setMotorFrame(motorFrame, 1, 0);
30 
31  motorFrame.translation() = Eigen::Vector3d(-momentArm, momentArm, 0.);
32  multicopterSim_->setMotorFrame(motorFrame, -1, 1);
33 
34  motorFrame.translation() = Eigen::Vector3d(-momentArm, -momentArm, 0.);
35  multicopterSim_->setMotorFrame(motorFrame, 1, 2);
36 
37  motorFrame.translation() = Eigen::Vector3d(momentArm, -momentArm, 0.);
38  multicopterSim_->setMotorFrame(motorFrame, -1, 3);
39 
40  motorFrame.translation() = Eigen::Vector3d(momentArm, momentArm, 0.);
41  multicopterSim_->setMotorFrame(motorFrame, 1, 4);
42 
43  motorFrame.translation() = Eigen::Vector3d(-momentArm, momentArm, 0.);
44  multicopterSim_->setMotorFrame(motorFrame, -1, 5);
45 
46  motorFrame.translation() = Eigen::Vector3d(-momentArm, -momentArm, 0.);
47  multicopterSim_->setMotorFrame(motorFrame, 1, 6);
48 
49  motorFrame.translation() = Eigen::Vector3d(momentArm, -momentArm, 0.);
50  multicopterSim_->setMotorFrame(motorFrame, -1, 7);
51 }
52 
53 std::vector<double> OctocopterDynamics::mapCmdActuator(std::vector<double> initialCmd) const{
54  std::vector<double> mappedCmd;
55  mappedCmd.push_back(initialCmd[1]);
56  mappedCmd.push_back(initialCmd[2]);
57  mappedCmd.push_back(initialCmd[3]);
58  mappedCmd.push_back(initialCmd[0]);
59 
60  mappedCmd.push_back(initialCmd[4]);
61  mappedCmd.push_back(initialCmd[7]);
62  mappedCmd.push_back(initialCmd[6]);
63  mappedCmd.push_back(initialCmd[5]);
64 
65  return mappedCmd;
66 }
ros.h
OctocopterDynamics::mapCmdActuator
std::vector< double > mapCmdActuator(std::vector< double > cmd) const override
Convert actuator indexes from PX4 notation to internal Flightgoggles notation.
Definition: octocopter.cpp:53
octocopter.hpp
OctocopterDynamics::initStaticMotorTransform
void initStaticMotorTransform(double momentArm) override
Set motor frames.
Definition: octocopter.cpp:25
MultirotorDynamics::multicopterSim_
std::unique_ptr< MulticopterDynamicsSim > multicopterSim_
Definition: multirotor.hpp:55


inno_vtol_dynamics
Author(s): Roman Fedorenko, Dmitry Ponomarev, Ezra Tal, Winter Guerra
autogenerated on Mon Dec 9 2024 03:13:35