Firmware
tiltrotor.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 
41 #ifndef TILTROTOR_H
42 #define TILTROTOR_H
43 #include "vtol_type.h"
44 #include <parameters/param.h>
45 #include <drivers/drv_hrt.h>
46 
47 class Tiltrotor : public VtolType
48 {
49 
50 public:
51 
52  Tiltrotor(VtolAttitudeControl *_att_controller);
53  ~Tiltrotor() override = default;
54 
55  void update_vtol_state() override;
56  void update_transition_state() override;
57  void fill_actuator_outputs() override;
58  void update_mc_state() override;
59  void update_fw_state() override;
60  void waiting_on_tecs() override;
61 
62 private:
63 
64  struct {
65  float tilt_mc;
67  float tilt_fw;
68  float front_trans_dur_p2;
69  } _params_tiltrotor;
70 
71  struct {
75  param_t front_trans_dur_p2;
76  } _params_handles_tiltrotor;
77 
78  enum vtol_mode {
79  MC_MODE = 0,
80  TRANSITION_FRONT_P1,
81  TRANSITION_FRONT_P2,
82  TRANSITION_BACK,
83  FW_MODE
84  };
85 
93  struct {
94  vtol_mode flight_mode;
96  } _vtol_schedule;
97 
98  float _tilt_control{0.0f};
100  void parameters_update() override;
101 
102 };
103 #endif
vtol_mode flight_mode
vtol flight mode, defined by enum vtol_mode
Definition: tiltrotor.h:94
float tilt_fw
actuator value corresponding to fw tilt
Definition: tiltrotor.h:67
void update_fw_state() override
Update fixed wing state.
Definition: tiltrotor.cpp:209
High-resolution timer with callouts and timekeeping.
Global flash based parameter store.
Definition: vtol_type.h:111
hrt_abstime transition_start
absoulte time at which front transition started
Definition: tiltrotor.h:95
void waiting_on_tecs() override
Special handling opportunity for the time right after transition to FW before TECS is running...
Definition: tiltrotor.cpp:326
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
Definition: drv_hrt.h:58
float tilt_mc
actuator value corresponding to mc tilt
Definition: tiltrotor.h:65
void update_mc_state() override
Update multicopter state.
Definition: tiltrotor.cpp:201
Definition: vtol_att_control_main.h:89
void update_transition_state() override
Update transition state.
Definition: tiltrotor.cpp:217
void update_vtol_state() override
Update vtol state.
Definition: tiltrotor.cpp:87
Definition: tiltrotor.h:47
float tilt_transition
actuator value corresponding to transition tilt (e.g 45 degrees)
Definition: tiltrotor.h:66
void fill_actuator_outputs() override
Write data to actuator output topic.
Definition: tiltrotor.cpp:335
uint32_t param_t
Parameter handle.
Definition: param.h:98