1use crate::Spacecraft;
20use crate::cosmic::AstroError;
21use crate::dynamics::guidance::GuidanceError;
22use crate::propagators::PropagationError;
23use snafu::prelude::*;
24
25pub mod prelude {
26 pub use super::{
27 StateParameter, Trajectory,
28 targeter::*,
29 trajectory::{ExportCfg, Interpolatable, Traj},
30 };
31 pub use crate::Spacecraft;
32 pub use crate::cosmic::{BPlane, BPlaneTarget, GuidanceMode, try_achieve_b_plane};
33 pub use crate::dynamics::{
34 Drag, GravityField, OrbitalDynamics, PointMasses, SolarPressure, SpacecraftDynamics,
35 };
36 pub use crate::dynamics::{Dynamics, NyxError};
37 pub use crate::io::gravity::GravityFieldData;
38 pub use crate::md::objective::Objective;
39 pub use crate::propagators::{IntegratorOptions, Propagator};
40 pub use crate::time::{Duration, Epoch, TimeUnits, Unit};
41 pub use crate::{State, TimeTagged};
42
43 pub use anise::analysis::event::Event;
44 pub use anise::analysis::prelude::OrbitalElement;
45 pub use anise::prelude::*;
46 pub use std::sync::Arc;
47}
48
49pub mod trajectory;
50
51pub mod objective;
52pub mod opti;
53pub use opti::targeter;
54pub type Trajectory = trajectory::Traj<Spacecraft>;
55
56mod param;
57pub use param::StateParameter;
58
59pub use opti::target_variable::{Variable, Vary};
60
61use self::trajectory::TrajError;
62
63#[allow(clippy::result_large_err)]
64#[derive(Debug, Snafu)]
65#[snafu(visibility(pub(crate)))]
66pub enum TargetingError {
67 #[snafu(display(
68 "The variables to be adjusted lead to an under-determined of the problem for the targeter"
69 ))]
70 UnderdeterminedProblem,
71 #[snafu(display("Incorrectly configured variable: {msg}"))]
73 VariableError { msg: String },
74 #[snafu(display("Frame error in targeter: {msg}"))]
76 FrameError { msg: String },
77 #[snafu(display("Unsupported variable in problem: {var}"))]
79 UnsupportedVariable { var: String },
80 #[snafu(display("Verification of targeting solution failed: {msg}"))]
81 Verification { msg: String },
82 #[snafu(display("astro error during targeting: {source}"))]
83 Astro { source: AstroError },
84 #[snafu(display("targeting aborted, too many iterations"))]
85 TooManyIterations,
86 #[snafu(display(
87 "correction is ineffective at {action}: value at previous iteration {prev_val}, current value: {cur_val}"
88 ))]
89 CorrectionIneffective {
90 prev_val: f64,
91 cur_val: f64,
92 action: &'static str,
93 },
94 #[snafu(display("encountered a guidance error: {source}"))]
95 GuidanceError { source: GuidanceError },
96 #[snafu(display("not a finite burn"))]
97 NotFinite,
98 #[snafu(display("Jacobian is signular"))]
99 SingularJacobian,
100 #[snafu(display("propagation error during targeting: {source}"))]
101 PropError {
102 #[snafu(source(from(PropagationError, Box::new)))]
103 source: Box<PropagationError>,
104 },
105 #[snafu(display("during an optimization, encountered {source}"))]
106 TargetingTrajError { source: TrajError },
107 #[snafu(display("during an optimization targets are too close"))]
108 TargetsTooClose,
109}