dymoesco.dynamics.dynamic_models.ContinuousDynamicModel¶
-
class
dymoesco.dynamics.dynamic_models.ContinuousDynamicModel(u_std=0, y_std=0)¶ Bases:
abc.ABCThe main abstract class in dymoesco which all continuous models need to subclass.
ContinuousDynamicModeldefines the main API through which all models implemented in dymoesco will interface. Estimation and Control algorithms will most likely only work on objects whose class inherits from ContinuousDynamicModel. The subclasses need to implement_f(), the dynamics function which implements a system \(\dot{x} = _f(x,u) + \epsilon\). They can also overwrite_g(), the observation function \(y = _g(x) + \epsilon\), which by default is the identity function. Note that _f and _g should be deterministic functions. Noise is added inf()andg(), which will be called by the object instances. The main method available to ContinuousDynamicModel instances is thensimulate()which calls scipy’s solve_ivp and returns adymoesco.types.Trajectoryobject.- Parameters
u_std (float or list of floats) – Standard deviation of dynamics noise.
y_std (float or list of floats) – Standard deviation of observation noise.
Notes
We have decided to use a time-invariant API, since most systems of interest to robotics are time-invariant. Users that need to implement a time-varying system will need to write their own class, which will be similar to this class.
-
__init__(u_std=0, y_std=0)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__([u_std, y_std])Initialize self.
discretize(dt)f(x, u)General dynamics function which is called in code.
g(x)General observation function which is called in code.
plot(traj[, attr, ax])traj needs to be a Trajectory object (or a dictionary with t and the requested attribute (x,y or u)).
plotu(traj[, ax])plotx(traj[, ax])ploty(traj[, ax])simulate(u, t_span, x0[, t_eval])simulate calls solve_ivp and returns a Trajectory object.
-
f(x, u)¶ General dynamics function which is called in code.
f adds some boiletplate around
_f(), such as adding the noise to make the dynamical system stochastic: \(\dot{x} = f(x,u) = _f(x,u) + \epsilon\). In most cases only f will not need to be overridden.
-
g(x)¶ General observation function which is called in code.
f adds some boiletplate around
_f(), such as adding the noise to make the dynamical system stochastic: \(\dot{x} = f(x,u) = _f(x,u) + \epsilon\). In most cases only f will not need to be overridden. In some special cases an observation model implementation might be complicated enough to warranty overriding g. Seedymoesco.dynamics.diffdrive.DiffDrive.g()for an example.
-
plot(traj, attr='x', ax=None)¶ traj needs to be a Trajectory object (or a dictionary with t and the requested attribute (x,y or u)).
-
simulate(u, t_span, x0, t_eval=None)¶ simulate calls solve_ivp and returns a Trajectory object. u in the returned trajectory is the underlying noiseless trajectory. TODO: find a way to return the noisy trajectory? (get the u_noisy out of f).