pyDynaMapp.identification package

Submodules

pyDynaMapp.identification.CVA module

class pyDynaMapp.identification.CVA.CVA(num_vars: int = 1)[source]

Bases: object

Canonical Variate Analysis:

This technique maximizes the correlation between past and future data, leading to a state-space model that captures the system dynamics effectively.

fit(X: numpy.ndarray) None[source]

Fit the CVA model to the data X.

transform(X: numpy.ndarray) numpy.ndarray[source]

Transform the data X into the canonical variates.

pyDynaMapp.identification.IDIM module

class pyDynaMapp.identification.IDIM.IDIM[source]

Bases: object

opt(method: str)[source]
optimize(x0: numpy.ndarray)[source]
save(folder_path: str)[source]
set_lower_bounds()[source]
set_maxeval()[source]
set_set_min_objective(f: Callable[[numpy.ndarray], numpy.ndarray])[source]
set_upper_bounds()[source]
vizulizeOuput()[source]
class pyDynaMapp.identification.IDIM.IDIMMLE[source]

Bases: IDIM

Inverse dynamics identification with maximum likelihood estimation. Ref:

Fourier-based optimal excitation trajectories for the dynamic identification of robots Kyung.Jo Park - Robotica - 2006.

set_lower_bounds(lb)[source]
set_maxeval(niter)[source]
set_set_min_objective(f: Callable[[numpy.ndarray], numpy.ndarray])[source]
set_upper_bounds(ub)[source]
class pyDynaMapp.identification.IDIM.IDIMNLS(nVars, output, identificationModel: Callable[[numpy.ndarray], numpy.ndarray], upperBound=2, lowerBound=-2, time_step=0.001)[source]

Bases: object

Inverse Dynamics Identification Methods with Non Linear Least Square Alogrithms. The identification problem is formulated in a non linear optimisation problem :

Xopt = argmin(X) ||IDM(q, qdot, qddot, X)- tau||

Args:
  • nVars : number of optimization variables in the X vector.

  • output : desired output vector ( Nsamples * ndof )

  • identificationModelfunction that return the model computed torques.

    of shape : ( Nsamples * ndof )

computeLsCostFunction(x: numpy.ndarray)[source]

The object function to be minimized with least squares. Returns:

  • cost : (float)

computeRelativeError(x: numpy.ndarray = None)[source]
evaluate() None[source]

Evaluate the model's performance using the current parameters.

optimize(x0: numpy.ndarray = None, method='least_square', tol=0.0001)[source]

Optimize the cost function with NLS alorithms to mimize it value. Args:

  • x0 : numpy-ndarry : initial paramters values estimation.

  • method : optimisation algorithm

  • tol : optimization alorithm error stop tolerence.

visualizeCostFunction(points_number: int = 1500) None[source]

Plot the cost function scalar variation with respect to ||x||

visualizeError(title=None, ylabel=None) None[source]

Plot the root squred error between simulated and inputs

visualizeRelativeError(x: numpy.ndarray = None)[source]

Plot the bar diagram of each joint relative error

visualizeResults(title=None, y_label=None) None[source]

Plot the simulated and real signals in one figure.

class pyDynaMapp.identification.IDIM.IDIMOLS(robot)[source]

Bases: object

Inverse Dynamics Identification Method Ordiany Least Square. this class valid only when the friction Args:

computeLsCostFunction()[source]
class pyDynaMapp.identification.IDIM.IDIMWLS[source]

Bases: object

pyDynaMapp.identification.Kalman module

class pyDynaMapp.identification.Kalman.Kalman(F, H, Q, R, P, x0, alpha=0.2, beta=1)[source]

Bases: object

Classical Kalman filter identification algorithms base class.

Args:

F (np.ndarray): State transition model. H (np.ndarray): Observation model. Q (np.ndarray): Covariance of the process noise. R (np.ndarray): Covariance of the observation noise. P (np.ndarray): Initial error covariance. x0 (np.ndarray): Initial state estimate.

Ref:

An Introduction to the Kalman Filter - Greg Welch and Gary Bishop.

adaptNoiseCovariance(y)[source]

Adaptively update the process and observation noise covariances.

Args:

y (np.ndarray): Innovation or measurement residual.

evaluate(true_states, estimated_states)[source]

Evaluate the performance of the Kalman filter.

Args:

true_states (np.ndarray): True states. estimated_states (np.ndarray): Estimated states from the filter.

Returns:

performance (dict): Dictionary containing evaluation metrics.

filter(observations)[source]

Apply the Kalman filter to a sequence of observations.

Args:

observations (np.ndarray): Sequence of observations.

Returns:

states (np.ndarray): Sequence of state estimates.

predict()[source]

Predict the state and error covariance for the next time step.

update(z)[source]

Update the state estimate and error covariance using the observation.

Args:

z (np.ndarray): Observation at the current time step.

visualizeEstimates(title=None, ylabel=None)[source]

Visualize the estimated states over time.

class pyDynaMapp.identification.Kalman.RobustKalman(A, B, H, Q, R, P0, x0)[source]

Bases: object

Robust Kalman Filter Base Model Class

predict(u, k)[source]

Prediction step

step(u, z, k)[source]

One step of prediction and update

update(z, k)[source]

Update step

pyDynaMapp.identification.LMI module

pyDynaMapp.identification.MOESP_VAR module

class pyDynaMapp.identification.MOESP_VAR.MOESP[source]

Bases: object

https://people.duke.edu/~hpgavin/SystemID/References/Verhaegen-IJC-1992a.pdf http://www.diag.uniroma1.it/~batti/papers_ifsd/8.pdf https://people.duke.edu/~hpgavin/SystemID/References/DeCock-SubspaceID-EOLLS-2003.pdf https://people.duke.edu/~hpgavin/SystemID/References/DeCock-SubspaceID-EOLLS-2003.pdf

pyDynaMapp.identification.N4SID_VAR module

class pyDynaMapp.identification.N4SID_VAR.N4SID[source]

Bases: object

Numerical Subspace State Space System Identification This method uses input-output data to construct a state-space model by minimizing a prediction error criterion.

Ref:

"N4SID: Subspace algorithms for the identification of combined deterministic-stochastic systems." Van Overschee, Peter, and Bart De Moor - Automatica 30.1 (1994): 75-93

pyDynaMapp.identification.ORT module

pyDynaMapp.identification.PF module

Module contents