Struct StatePropagator::SpFunctions#

Nested Relationships#

This struct is a nested type of Class StatePropagator.

Struct Documentation#

struct SpFunctions#

Struct with optional user-defined functions to be used by the state propagator.

Public Members

kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&> pre_deriv_fns = kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&>()#

Optional function called before evaluating system derivative. Useful for setting gravity accel and other forces on the system.

kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&> post_deriv_fns = kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&>()#

Optional function called after evaluating system derivative. Useful for passing state derivative values to models that needs them, and to perform data logging.

kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&> pre_hop_fns = kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&>()#

Optional function called at the start of a hop step. Useful for propagating discrete states, sanitizing the input state (eg. for changing coordinate chart origin), calling FSM step functions, processing external models to apply force inputs from closed-loop controllers etc.

kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&> post_hop_fns = kc::CallbackRegistry<void, const km::Ktime&, const km::Vec&>()#

Optional function called at the end of a hop step. Useful for processing external models that use the new state to set sensor inputs for closed-loop controllers, data logging, updating visualization, cleaning up the state to null out constraint errors etc.

std::function<bool(const km::Ktime&, const km::Vec&)> step_validate_fn = nullptr#

Optional function called at the end of a integration step to decide whether to accept the new state, or to roll back to the state at the start of the hop. Useful for repeating a the time step when the new state has invalid values.

kc::CallbackRegistry<bool, const km::Vec&, bool> zero_crossing_fns = kc::CallbackRegistry<bool, const km::Vec&, bool>()#

Optional function used for terminating a hop when a zero-crossing condition has been met. Useful for getting a simulation hop to terminate precisely when the implicitly defined zero-crossing condtion occurs instead of continuing till the specified hop end time. See the

Zero-crossings section for more discussion on zero crossing detection.

The zero crossing functions return a bool. This should be true if the zero has been crossed. The second argument to the fucntion is a boolean. This will be true when we have reached the zero, and false otherwise.

kc::CallbackRegistry<bool, const km::Ktime&, const km::Vec&> terminate_advance_to_fns = kc::CallbackRegistry<bool, const km::Ktime&, const km::Vec&>()#

Optional function called to check whether to terminate the state propagation prematurely before the state advancement end time has been reached. Handy when the simulation has already reached an end state (possibly for an FSM) and there is no value in continuing on with the state propagation. This check is only done at the end of a hop, so there may be some timing slop in the check for an end state. This is in contrast with the zero-crossing check which is done within a hop to end the hop precisely when the zero-crossing condition is met.

Friends

friend class StatePropagator