PX4 Firmware
PX4 Autopilot Software http://px4.io
rcloss.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Copyright (c) 2013-2014 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 /**
34  * @file rcloss.h
35  * Helper class for RC Loss Mode acording to the OBC rules
36  *
37  * @author Thomas Gubler <thomasgubler@gmail.com>
38  */
39 
40 #pragma once
41 
42 #include <px4_platform_common/module_params.h>
43 
44 #include "navigator_mode.h"
45 #include "mission_block.h"
46 
47 class Navigator;
48 
49 class RCLoss : public MissionBlock, public ModuleParams
50 {
51 public:
53  ~RCLoss() = default;
54 
55  void on_inactive() override;
56  void on_activation() override;
57  void on_active() override;
58 
59 private:
61  (ParamFloat<px4::params::NAV_RCL_LT>) _param_nav_gpsf_lt
62  )
63 
64  enum RCLState {
65  RCL_STATE_NONE = 0,
66  RCL_STATE_LOITER = 1,
67  RCL_STATE_TERMINATE = 2,
68  RCL_STATE_END = 3
69  } _rcl_state{RCL_STATE_NONE};
70 
71  /**
72  * Set the RCL item
73  */
74  void set_rcl_item();
75 
76  /**
77  * Move to next RCL item
78  */
79  void advance_rcl();
80 
81 };
_rcl_state
Definition: rcloss.h:69
Helper class to use mission items.
void advance_rcl()
Move to next RCL item.
Definition: rcloss.cpp:141
void set_rcl_item()
Set the RCL item.
Definition: rcloss.cpp:90
RCLoss(Navigator *navigator)
Definition: rcloss.cpp:56
~RCLoss()=default
void on_active() override
This function is called while the mode is active.
Definition: rcloss.cpp:81
void on_inactive() override
This function is called while the mode is inactive.
Definition: rcloss.cpp:64
DEFINE_PARAMETERS((ParamFloat< px4::params::NAV_RCL_LT >) _param_nav_gpsf_lt) enum RCLState
Definition: rcloss.h:60
Definition: rcloss.h:49
void on_activation() override
This function is called one time when mode becomes active, pos_sp_triplet must be initialized here...
Definition: rcloss.cpp:73