bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
fixed_wing_mission.h
Go to the documentation of this file.
1#ifndef BITSIM_CONTROL_FIXED_WING_MISSION_H
2#define BITSIM_CONTROL_FIXED_WING_MISSION_H
3
7
8#include <optional>
9#include <string>
10#include <vector>
11
12namespace bitsim::control
13{
14
18struct Runway
19{
21 real_t east{0.0};
23 real_t length{400.0};
24 real_t width{20.0};
25};
26
36
57
68
69std::string to_string(MissionPhase phase);
70
82
101{
102 public:
103 FixedWingMission(FixedWingAutopilot &autopilot, const Runway &runway,
104 const std::vector<MissionWaypoint> &route,
105 const FixedWingMissionSettings &settings = {});
106
111
112 MissionPhase phase() const noexcept { return phase_; }
116 std::size_t leg() const noexcept { return leg_; }
117 const std::vector<MissionWaypoint> &points() const noexcept { return points_; }
118 real_t cross_track() const noexcept { return cross_track_; }
119 const FixedWingCommands &commands() const noexcept { return commands_; }
120 const std::optional<Touchdown> &touchdown() const noexcept { return touchdown_; }
121
125 std::array<real_t, 2> runway_coordinates(real_t north, real_t east) const;
126
130 real_t wheel_height(const dynamics::FixedWingDynamics &aircraft) const;
131
132 private:
133 FixedWingAutopilot &autopilot_;
134 Runway runway_;
136 std::vector<MissionWaypoint> points_;
138 std::size_t leg_{0};
139 real_t cross_track_{0.0};
140 FixedWingCommands commands_;
141 std::optional<Touchdown> touchdown_;
142 real_t sink_integral_{0.0};
143 real_t flare_pitch_{0.0};
144 real_t flare_throttle_{0.0};
145
146 // The course that follows the line from a to b, and the distance right of it
147 real_t follow_(const MissionWaypoint &a, const MissionWaypoint &b, real_t north, real_t east);
148 // Whether the aircraft has crossed the half plane at the end of the current leg
149 bool past_end_of_leg_(real_t north, real_t east) const;
150 // The rudder that steers along the centre line on the ground
151 real_t steer_(const dynamics::FixedWingDynamics &aircraft);
152};
153
154} // namespace bitsim::control
155
156#endif // BITSIM_CONTROL_FIXED_WING_MISSION_H
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
Holds airspeed, altitude and course with loops closed one inside the other, as in Beard and McLain,...
Definition fixed_wing_autopilot.h:78
std::size_t leg() const noexcept
The line being followed: from points()[leg()] to points()[leg() + 1].
Definition fixed_wing_mission.h:116
real_t wheel_height(const dynamics::FixedWingDynamics &aircraft) const
Definition fixed_wing_mission.cpp:85
real_t cross_track() const noexcept
Definition fixed_wing_mission.h:118
const std::vector< MissionWaypoint > & points() const noexcept
Definition fixed_wing_mission.h:117
FixedWingMission(FixedWingAutopilot &autopilot, const Runway &runway, const std::vector< MissionWaypoint > &route, const FixedWingMissionSettings &settings={})
Definition fixed_wing_mission.cpp:53
MissionPhase phase() const noexcept
Definition fixed_wing_mission.h:112
dynamics::FixedWingControls update(const dynamics::FixedWingDynamics &aircraft, real_t dt)
The controls for the aircraft now, after dt [s].
Definition fixed_wing_mission.cpp:134
const std::optional< Touchdown > & touchdown() const noexcept
Definition fixed_wing_mission.h:120
const FixedWingCommands & commands() const noexcept
Definition fixed_wing_mission.h:119
std::array< real_t, 2 > runway_coordinates(real_t north, real_t east) const
Definition fixed_wing_mission.cpp:76
The 6-DOF flight dynamics of a fixed wing aircraft, with its landing gear on a flat ground at down = ...
Definition fixed_wing_dynamics.h:176
Controllers: PID controllers, line following, a quadrotor flight controller, a fixed wing autopilot,...
Definition control_module.h:18
std::string to_string(MissionPhase phase)
Definition fixed_wing_mission.cpp:31
MissionPhase
Definition fixed_wing_mission.h:59
@ STOPPED
Definition fixed_wing_mission.h:66
@ TAKEOFF_ROLL
Definition fixed_wing_mission.h:60
@ ROLLOUT
Definition fixed_wing_mission.h:65
@ ROTATE
Definition fixed_wing_mission.h:61
@ FLARE
Definition fixed_wing_mission.h:64
@ ENROUTE
Definition fixed_wing_mission.h:62
@ APPROACH
Definition fixed_wing_mission.h:63
double real_t
real_t
Definition bitsim_types.h:20
What the autopilot holds.
Definition fixed_wing_autopilot.h:15
How the mission flies.
Definition fixed_wing_mission.h:41
real_t brake_airspeed
brake below it on the rollout [m/s]
Definition fixed_wing_mission.h:52
real_t rotate_airspeed
lift the nose on the takeoff roll [m/s]
Definition fixed_wing_mission.h:44
real_t cruise_airspeed
[m/s]
Definition fixed_wing_mission.h:42
real_t steering_gain
rudder per rad of heading error on the ground
Definition fixed_wing_mission.h:55
real_t glide_slope
the angle of the approach [rad]
Definition fixed_wing_mission.h:47
real_t clear_height
the height at which the climb out starts [m]
Definition fixed_wing_mission.h:46
real_t path_angle
the course towards a path from far away [rad]
Definition fixed_wing_mission.h:53
real_t final_length
from the final approach fix to the aim point [m]
Definition fixed_wing_mission.h:48
real_t path_gain
how sharply to turn onto a path [1/m]
Definition fixed_wing_mission.h:54
real_t flare_height
of the wheels, to start the flare [m]
Definition fixed_wing_mission.h:50
real_t aim_distance
of the aim point past the threshold [m]
Definition fixed_wing_mission.h:49
real_t approach_airspeed
[m/s]
Definition fixed_wing_mission.h:43
real_t climb_pitch
after rotating, until clear of the ground [rad]
Definition fixed_wing_mission.h:45
real_t flare_sink_rate
at touchdown [m/s]
Definition fixed_wing_mission.h:51
A point of the route, in the world.
Definition fixed_wing_mission.h:31
real_t altitude
[m]
Definition fixed_wing_mission.h:34
real_t east
[m]
Definition fixed_wing_mission.h:33
real_t north
[m]
Definition fixed_wing_mission.h:32
A runway on the ground: it starts at its threshold and runs along its heading.
Definition fixed_wing_mission.h:19
real_t north
of the threshold [m]
Definition fixed_wing_mission.h:20
real_t length
[m]
Definition fixed_wing_mission.h:23
real_t east
of the threshold [m]
Definition fixed_wing_mission.h:21
real_t heading
[rad]
Definition fixed_wing_mission.h:22
real_t width
[m]
Definition fixed_wing_mission.h:24
Where and how the aircraft touched down.
Definition fixed_wing_mission.h:75
real_t along
past the threshold [m]
Definition fixed_wing_mission.h:77
real_t sink_rate
[m/s]
Definition fixed_wing_mission.h:79
real_t airspeed
[m/s]
Definition fixed_wing_mission.h:80
real_t time
[s]
Definition fixed_wing_mission.h:76
real_t across
right of the centre line [m]
Definition fixed_wing_mission.h:78
What the pilot or the autopilot sets.
Definition fixed_wing_dynamics.h:47