Firmware
standard.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 
46 #ifndef STANDARD_H
47 #define STANDARD_H
48 #include "vtol_type.h"
49 #include <parameters/param.h>
50 #include <drivers/drv_hrt.h>
51 
52 class Standard : public VtolType
53 {
54 
55 public:
56 
57  Standard(VtolAttitudeControl *_att_controller);
58  ~Standard() override = default;
59 
60  void update_vtol_state() override;
61  void update_transition_state() override;
62  void update_fw_state() override;
63  void update_mc_state() override;
64  void fill_actuator_outputs() override;
65  void waiting_on_tecs() override;
66 
67 private:
68 
69  struct {
70  float pusher_ramp_dt;
71  float back_trans_ramp;
72  float down_pitch_max;
73  float forward_thrust_scale;
74  float pitch_setpoint_offset;
75  float reverse_output;
76  float reverse_delay;
77  } _params_standard;
78 
79  struct {
80  param_t pusher_ramp_dt;
81  param_t back_trans_ramp;
82  param_t down_pitch_max;
83  param_t forward_thrust_scale;
84  param_t pitch_setpoint_offset;
85  param_t reverse_output;
86  param_t reverse_delay;
87  } _params_handles_standard;
88 
89  enum vtol_mode {
90  MC_MODE = 0,
91  TRANSITION_TO_FW,
92  TRANSITION_TO_MC,
93  FW_MODE
94  };
95 
96  struct {
97  vtol_mode flight_mode; // indicates in which mode the vehicle is in
98  hrt_abstime transition_start; // at what time did we start a transition (front- or backtransition)
99  } _vtol_schedule;
100 
101  float _pusher_throttle{0.0f};
102  float _reverse_output{0.0f};
103  float _airspeed_trans_blend_margin{0.0f};
104 
105  void parameters_update() override;
106 };
107 #endif
void update_mc_state() override
Update multicopter state.
Definition: standard.cpp:310
Definition: standard.h:52
void update_vtol_state() override
Update vtol state.
Definition: standard.cpp:108
High-resolution timer with callouts and timekeeping.
Global flash based parameter store.
Definition: vtol_type.h:111
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
Definition: drv_hrt.h:58
void update_fw_state() override
Update fixed wing state.
Definition: standard.cpp:386
void waiting_on_tecs() override
Special handling opportunity for the time right after transition to FW before TECS is running...
Definition: standard.cpp:472
Definition: vtol_att_control_main.h:89
void update_transition_state() override
Update transition state.
Definition: standard.cpp:223
uint32_t param_t
Parameter handle.
Definition: param.h:98
void fill_actuator_outputs() override
Prepare message to acutators with data from mc and fw attitude controllers.
Definition: standard.cpp:395