pyDynaMapp.utils package
Submodules
pyDynaMapp.utils.math module
- pyDynaMapp.utils.math.MAE(array: numpy.ndarray, window_size: int) numpy.ndarray [source]
Implement a simple moving average estimator.
- Args:
array (np.ndarray): Array of values at each timestep. window_size (int): Number of previous values to consider.
- Returns:
np.ndarray: expected values.
- pyDynaMapp.utils.math.RMSE(array1: numpy.ndarray, array2: numpy.ndarray = None, axis=0) numpy.ndarray [source]
Compute the RMSE between 2 arrays across all samples.
- Args:
array1 (Nsamples, ndof). array2 (Nsamples, ndof).
- Returns:
np.ndarray: (Nsamples, ndof)
- pyDynaMapp.utils.math.computeCorrelation(array: numpy.ndarray) numpy.ndarray [source]
Compute the correlation factor between the columns of a numpy array.
- Args:
array (Nsamples, ndof).
- Returns:
np.ndarray: (ndof, ndof).
- pyDynaMapp.utils.math.computeCumulativeCorrelation(array: numpy.ndarray) numpy.ndarray [source]
Compute the correlation matrix. Args:
array : (Nsamples, ndof).
- Returns:
numpy-ndarry: (Nsamples,ndof, ndof)
- pyDynaMapp.utils.math.conditionNumber(M, threshold=1e-05)[source]
Computes the condition number of a matrix with a check for SVD convergence. Args:
M : The input matrix.
threshold : The condition number threshold to check against.
- pyDynaMapp.utils.math.cumulativeRMSE(array1: numpy.ndarray, array2: numpy.ndarray) numpy.ndarray [source]
Compute the RMSE between columns of two arrays, considering the error committed for each joint at the previous time step.
- Args:
array1 (Nsamples, ndof). array2 (Nsamples, ndof).
- Returns:
np.ndarray: (Nsamples, ndof)
- pyDynaMapp.utils.math.discreteTimeIntegral(vector, time_step)[source]
Compute the discrete-time integral of a sampled vector with a given time step.
- Args:
vector (array-like): 1-D input vector. time_step (float) : Sampling frequency with which this vector was recorded.
- Returns:
int_vector (numpy.ndarray): 1-D integrated vector.
pyDynaMapp.utils.robot_data module
- class pyDynaMapp.utils.robot_data.RobotData(data_file_path, ndof=7, time_step=0.001, intIndex=None, stepIndex=1, fnlIndex=None)[source]
Bases:
object
Initialize the RobotData object by loading and processing data from a CSV file.
- Args:
data_file_path (str): Path to the CSV data file.
ndof (int) : number of freedom degree of the manipulator.
time_step (float) : step time beteewn tow conscutive sample of data
intIndex (int): Initial index for data slicing.
stepIndex (int): Step index for periodic data selection.
fnlIndex (int): Final index for data slicing.
- computePositionNoise(method='std') tuple [source]
Estimates the Noise level in torque sensor mesurements. The noise model is assumed to be a white gaussian noise.
- computeTorqueNoise(variable='torque', method='std') float [source]
Estimates the Noise level in torque sensor mesurements. The noise model is assumed to be a white gaussian noise.
pyDynaMapp.utils.solver module
- pyDynaMapp.utils.solver.luenbergerObserver(A, B, C, desired_poles)[source]
Computes the Luenberger Observer gain matrix L.
- Args::
A (np.ndarray): System matrix. B (np.ndarray): Input matrix. C (np.ndarray): Output matrix. desired_poles (list): Desired poles for the observer.
- Returns:
L (np.ndarray): Observer gain matrix.
pyDynaMapp.utils.tools module
- pyDynaMapp.utils.tools.checkSkewSymmetric(matrix)[source]
Check if the input matrix is skew-symmetric.
- pyDynaMapp.utils.tools.deg2rad(angle_degrees)[source]
Converts an angle given in degrees to radians.
- pyDynaMapp.utils.tools.matrix2Text(matrix, filename)[source]
Write the values of a matrix to a text file.
- pyDynaMapp.utils.tools.plot2Arrays(array1: numpy.ndarray, array2: numpy.ndarray, legend1=None, legend2=None, title=None, color1='red', color2='blue') None [source]
Given two (n * m) data arrays where n >> m, plot each column data from both arrays in separate subplots.
- pyDynaMapp.utils.tools.plot3Arrays(array1: numpy.ndarray, array2: numpy.ndarray, array3: numpy.ndarray, legend1=None, legend2=None, legend3=None, title=None, color1='red', color2='blue', color3='green') None [source]
Given three (n * m) data arrays where n >> m, plot each column data from all arrays in separate subplots.
- pyDynaMapp.utils.tools.plotArray(array: numpy.ndarray, title=None, ylabel=None) None [source]
Given an ( n * m ) data array where n >> m, plot each coloum data in sperate subplots .
- Args:
array: numpy ndarray
- pyDynaMapp.utils.tools.plotElementWiseArray(array: numpy.ndarray, title=None, xlabel=None, ylabel=None)[source]
- pyDynaMapp.utils.tools.rad2deg(angle_radians)[source]
Converts an angle given in radians to degrees.
- pyDynaMapp.utils.tools.smooth_columns(data: numpy.ndarray, window_size: int = 5) numpy.ndarray [source]
Smooth each column of the input data matrix using a moving average.
Parameters: - data: np.ndarray, the input data matrix of size N x 7 - window_size: int, the window size for the moving average
Returns: - smoothed_data: np.ndarray, the smoothed data matrix of the same size as input