nyx_space/md/opti/multipleshooting/mod.rs
1/*
2 Nyx, blazing fast astrodynamics
3 Copyright (C) 2018-onwards Christopher Rabotin <christopher.rabotin@gmail.com>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
17*/
18
19use anise::errors::{AlmanacError, PhysicsError};
20use snafu::Snafu;
21
22use crate::md::{trajectory::TrajError, TargetingError};
23
24pub mod altitude_heuristic;
25pub mod ctrlnodes;
26pub mod equidistant_heuristic;
27pub mod multishoot;
28
29/// Built-in cost functions to minimize
30#[derive(Copy, Clone, Debug, PartialEq, Eq)]
31pub enum CostFunction {
32 /// J = ∫ \vec{u}^T\vec{u} dt
33 MinimumEnergy,
34 /// J = ∫ |\vec{u}| dt -- Warning, this may lead to loads to bang-coast-bang solutions
35 MinimumFuel,
36}
37
38#[derive(Debug, Snafu)]
39pub enum MultipleShootingError {
40 #[snafu(display("segment #{segment} encountered {source}"))]
41 TargetingError {
42 segment: usize,
43 source: TargetingError,
44 },
45 #[snafu(display("during a multiple shooting, encountered {source}"))]
46 MultiShootTrajError { source: TrajError },
47 #[snafu(display("duration a multiple shoot, issue due to Almanac: {action} {source}"))]
48 MultiShootAlmanacError {
49 #[snafu(source(from(AlmanacError, Box::new)))]
50 source: Box<AlmanacError>,
51 action: &'static str,
52 },
53 #[snafu(display("duration a multiple shoot, physics issue: {source}"))]
54 MultiShootPhysicsError { source: PhysicsError },
55}