pub trait Automaton:
Send
+ Sync
+ Debug {
type State: Clone + Send + Sync + 'static + Debug;
type Action: Debug + Clone + Send + Sync + Default + 'static;
// Required methods
fn step(
&self,
time: Time,
action: &Self::Action,
state: &Self::State,
) -> (Self::State, Option<f64>);
fn initial_state(&self) -> Self::State;
fn name(&self) -> &str;
fn extract_value(&self, state: &Self::State) -> f64;
// Provided method
fn reset(&self) -> Self::State { ... }
}Expand description
Core trait for all automata.
An automaton is a stateful function generator. Each call to step
takes the current time, an action, and the current state, and returns a
new state together with an optional output value. Automata are Send
and run on the control thread (soft RT).
Required Associated Types§
Required Methods§
Sourcefn step(
&self,
time: Time,
action: &Self::Action,
state: &Self::State,
) -> (Self::State, Option<f64>)
fn step( &self, time: Time, action: &Self::Action, state: &Self::State, ) -> (Self::State, Option<f64>)
Advance the automaton by one time step.
§Arguments
time— current timeaction— action to applystate— current state
Returns (new_state, optional_output_value).
Sourcefn initial_state(&self) -> Self::State
fn initial_state(&self) -> Self::State
Return the initial state.
Sourcefn extract_value(&self, state: &Self::State) -> f64
fn extract_value(&self, state: &Self::State) -> f64
Extract the output value from the state.