multi_copter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Fadri Furrer, ASL, ETH Zurich, Switzerland
3  * Copyright 2015 Michael Burri, ASL, ETH Zurich, Switzerland
4  * Copyright 2015 Mina Kamel, ASL, ETH Zurich, Switzerland
5  * Copyright 2015 Janosch Nikolic, ASL, ETH Zurich, Switzerland
6  * Copyright 2015 Markus Achtelik, ASL, ETH Zurich, Switzerland
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 
22 #ifndef ROTORS_GAZEBO_PLUGINS_MULTI_COPTER_H
23 #define ROTORS_GAZEBO_PLUGINS_MULTI_COPTER_H
24 
25 #include <Eigen/Eigen>
26 
29 
31 {
32  public:
33  MultiCopter(int amount_rotors) :
34  position_(Eigen::Vector3d::Zero()),
35  velocity_(Eigen::Vector3d::Zero()),
36  attitude_(Eigen::Quaterniond::Identity()),
37  rotor_rot_vels_(Eigen::VectorXd::Zero(amount_rotors))
38  {}
39  MultiCopter(int amount_rotors,
40  MotorController& motor_controller) :
41  MultiCopter(amount_rotors)
42  {
43  setMotorController(motor_controller);
44  }
45  ~MultiCopter();
46 
48  MotorController& motor_controller) {
49  motor_controller_ = motor_controller;
50  }
51 
52  Eigen::VectorXd getRefMotorVelocities(double dt) {
53  return motor_controller_.getMotorVelocities(dt);
54  }
55 
56  Eigen::VectorXd getMotorVelocities() {
57  return rotor_rot_vels_;
58  }
59 
60  virtual Eigen::Vector4d simulateMAV(double dt,
61  Eigen::VectorXd ref_rotor_rot_vels) = 0;
62  virtual void initializeParams() = 0;
63  virtual void publish() = 0;
64 
66  return motor_controller_;
67  }
68  const Eigen::Vector3d position() {return position_;}
69  const Eigen::Vector3d velocity() {return velocity_;}
70  const Eigen::Quaterniond attitude() {return attitude_;}
71 
72  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
73  protected:
75  Eigen::Vector3d position_;
76  Eigen::Vector3d velocity_;
77  Eigen::Quaterniond attitude_;
78  Eigen::Vector3d angular_rate_;
79  Eigen::VectorXd rotor_rot_vels_;
80 };
81 
82 #endif // ROTORS_GAZEBO_PLUGINS_MULTI_COPTER_H
Eigen::Vector3d position_
Eigen::Vector3d angular_rate_
Eigen::Vector3d velocity_
MultiCopter(int amount_rotors, MotorController &motor_controller)
MotorController motor_controller_
virtual void initializeParams()=0
const MotorController motorController()
Eigen::Quaterniond attitude_
const Eigen::Vector3d position()
Eigen::VectorXd getRefMotorVelocities(double dt)
Identity
Eigen::VectorXd rotor_rot_vels_
Eigen::VectorXd getMotorVelocities()
MultiCopter(int amount_rotors)
void setMotorController(MotorController &motor_controller)
virtual Eigen::Vector4d simulateMAV(double dt, Eigen::VectorXd ref_rotor_rot_vels)=0
const Eigen::Vector3d velocity()
const Eigen::Quaterniond attitude()
virtual void publish()=0


rotors_gazebo_plugins
Author(s): Fadri Furrer, Michael Burri, Mina Kamel, Janosch Nikolic, Markus Achtelik
autogenerated on Mon Feb 28 2022 23:39:04