Qualcomm Navigator Flight Control Interface  2.0
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
waypoint.hpp
1 /****************************************************************************
2  * Copyright (c) 2018 John A. Dougherty. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in
12  * the documentation and/or other materials provided with the
13  * distribution.
14  * 3. Neither the name ATLFlight nor the names of its contributors may be
15  * used to endorse or promote products derived from this software
16  * without specific prior written permission.
17  *
18  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
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  * In addition Supplemental Terms apply. See the SUPPLEMENTAL file.
33  ****************************************************************************/
34 
35 #ifndef SNAV_FCI_WAYPOINT_HPP_
36 #define SNAV_FCI_WAYPOINT_HPP_
37 
38 #include <Eigen/Dense>
39 
40 #include "snav/waypoint.hpp"
41 
42 #include "api/config/waypoint_config.hpp"
43 #include "api/state_vector.hpp"
44 
45 namespace snav_fci
46 {
47 
52 class Waypoint : public StateVector
53 {
54 public:
55 
56  enum class Status
57  {
58  COMPLETE,
59  ENROUTE,
60  INACTIVE,
61  };
62 
63  enum Constraint
64  {
65  FIX_POS=1,
66  FIX_VEL=2,
67  FIX_ACC=4,
68  FIX_JERK=8,
69  };
70 
74  Waypoint();
75 
81  Waypoint(Eigen::Vector3f position);
82 
88  Waypoint(Eigen::Vector3f position, WaypointConfig conf);
89 
95  Waypoint(StateVector state);
96 
100  Waypoint(StateVector state, WaypointConfig conf);
101 
102  Waypoint(const snav_traj_gen::Waypoint& waypoint);
103 
104  void set_deriv_constraints(int mask);
105 
109  void fix_all();
110 
114  void fix_none();
115 
121  void set_config(WaypointConfig config);
122 
132  inline bool is_configured() const
133  {
134  return configured_;
135  }
136 
140  inline WaypointConfig get_config() const
141  {
142  return config_;
143  }
144 
145  Eigen::Matrix<bool,4,1> constrained;
147  Status status;
148 
149  float time;
151  friend std::ostream& operator<<(std::ostream &strm, const Waypoint &wp);
152 
153  snav_traj_gen::Waypoint get_traj_gen_waypoint() const;
154 
155  static std::string get_status_string(const Status& status);
156 
157 private:
158  WaypointConfig config_;
159  bool configured_;
160 
161 };
162 
163 } // namespace snav_fci
164 
165 #endif // SNAV_FCI_WAYPOINT_HPP_
166 
void fix_none()
Set all constraints to be free.
Structure containing waypoint options.
Definition: waypoint_config.hpp:46
Waypoint()
Construct a waypoint with default state (set to zeros) and options.
float time
Definition: waypoint.hpp:149
Eigen::Vector3f position
Definition: displacement_derivs.hpp:61
void fix_all()
Set all constraints to be fixed.
WaypointConfig get_config() const
Get the waypoint configuration.
Definition: waypoint.hpp:140
void set_config(WaypointConfig config)
Set the waypoint configuration.
Structure containing position and yaw along with their derivatives and some metadata.
Definition: waypoint.hpp:52
Structure containing position and yaw along with their derivatives.
Definition: state_vector.hpp:50
Eigen::Matrix< bool, 4, 1 > constrained
Definition: waypoint.hpp:145
bool is_configured() const
Verify whether or not an instance of Waypoint has had its configuration changed from the default...
Definition: waypoint.hpp:132