Firmware
tailsitter.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2015 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
42 #ifndef TAILSITTER_H
43 #define TAILSITTER_H
44 
45 #include "vtol_type.h"
46 #include <perf/perf_counter.h>
47 #include <parameters/param.h>
48 #include <drivers/drv_hrt.h>
49 #include <matrix/matrix/math.hpp>
50 
51 class Tailsitter : public VtolType
52 {
53 
54 public:
55  Tailsitter(VtolAttitudeControl *_att_controller);
56  ~Tailsitter() override = default;
57 
58  void update_vtol_state() override;
59  void update_transition_state() override;
60  void update_fw_state() override;
61  void fill_actuator_outputs() override;
62  void waiting_on_tecs() override;
63 
64 private:
65 
66  struct {
67  float front_trans_dur_p2;
68  float fw_pitch_sp_offset;
69  } _params_tailsitter{};
70 
71  struct {
72  param_t front_trans_dur_p2;
73  param_t fw_pitch_sp_offset;
74  } _params_handles_tailsitter{};
75 
76  enum vtol_mode {
77  MC_MODE = 0,
78  TRANSITION_FRONT_P1,
79  TRANSITION_BACK,
80  FW_MODE
81  };
82 
83  struct {
84  vtol_mode flight_mode;
86  } _vtol_schedule;
87 
88  matrix::Quatf _q_trans_start;
89  matrix::Quatf _q_trans_sp;
90  matrix::Vector3f _trans_rot_axis;
91 
92  void parameters_update() override;
93 
94 };
95 #endif
is it necsacery?
Definition: tailsitter.h:51
void fill_actuator_outputs() override
Write data to actuator output topic.
Definition: tailsitter.cpp:275
void update_transition_state() override
Update transition state.
Definition: tailsitter.cpp:177
High-resolution timer with callouts and timekeeping.
Global flash based parameter store.
Definition: vtol_type.h:111
void update_vtol_state() override
Update vtol state.
Definition: tailsitter.cpp:81
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
Definition: drv_hrt.h:58
void waiting_on_tecs() override
Special handling opportunity for the time right after transition to FW before TECS is running...
Definition: tailsitter.cpp:255
void update_fw_state() override
Update fixed wing state.
Definition: tailsitter.cpp:261
Definition: vtol_att_control_main.h:89
hrt_abstime transition_start
absoulte time at which front transition started
Definition: tailsitter.h:85
vtol_mode flight_mode
vtol flight mode, defined by enum vtol_mode
Definition: tailsitter.h:84
uint32_t param_t
Parameter handle.
Definition: param.h:98
Performance measuring tools.