Identification

The identification module provides tools for dynamic parameter identification of robots.

New in v0.3.0: - solve_with_custom_solver() method with advanced solving options - Support for regularization (L1, L2, Elastic Net) - Physical constraint enforcement (e.g., positive masses/inertias) - Enhanced configuration management with modular design

base_identification

Base class for robot dynamic parameter identification. This module provides a generalized framework for dynamic parameter identification that can be inherited by any robot type (TIAGo, UR10, MATE, etc.).

class figaroh.identification.base_identification.BaseIdentification(robot, config_file='config/robot_config.yaml')[source]

Bases: ABC

Base class for robot dynamic parameter identification.

Provides common functionality for all robots while allowing robot-specific implementations of key methods.

calculate_full_regressor()[source]

Build regressor matrix, compute pre-identified values of standard parameters, compute joint torques based on pre-identified standard parameters.

compute_reference_torque()[source]

Compute reference joint torques based on standard parameters and dynamic regressor.

filter_kinematics_data(filter_config=None)[source]

Apply filtering to data with configurable parameters.

Parameters:

filter_config (dict, optional) – Filter configuration with keys: - differentiation_method: Method for derivative estimation - filter_params: Parameters for signal filtering

Raises:

ValueError – If required data is missing

initialize(truncate=None)[source]
initialize_standard_parameters()[source]

Initialize standard parameters for the robot.

load_param(config_file, setting_type='identification')[source]

Load the identification parameters from the yaml file.

This method supports both legacy YAML format and the new unified configuration format. It automatically detects the format type and applies the appropriate parser.

Parameters:
  • config_file (str) – Path to configuration file (legacy or unified)

  • setting_type (str) – Configuration section to load

abstractmethod load_trajectory_data()[source]

Load and process CSV data.

This method must be implemented by robot-specific subclasses to handle their specific data formats and file structures.

Returns:

(timestamps, positions, velocities, torques) as numpy arrays

Return type:

tuple

plot_results()[source]

Plot identification results using unified results manager.

process_data(truncate=None)[source]

Load and process data

process_kinematics_data(filter_config=None)[source]

Process kinematics data (positions, velocities, accelerations) with filtering.

process_torque_data(**kwargs)[source]

Process torque data (generic implementation, should be overridden for robot-specific processing).

save_results(output_dir='results')[source]

Save identification results using unified results manager.

solve(decimate=True, decimation_factor=10, zero_tolerance=0.001, plotting=True, save_results=False)[source]

Main solving method for dynamic parameter identification.

This method implements the complete base parameter identification workflow including column elimination, optional decimation, QR decomposition, and quality metric computation.

Parameters:
  • decimate (bool) – Whether to apply decimation to reduce data size

  • decimation_factor (int) – Factor for signal decimation (default: 10)

  • zero_tolerance (float) – Tolerance for eliminating zero columns

  • plotting (bool) – Whether to generate plots

  • save_results (bool) – Whether to save parameters to file

Returns:

Base parameters phi_base

Return type:

ndarray

Raises:
  • AssertionError – If prerequisites not met (dynamic_regressor, standard_parameter)

  • ValueError – If data shapes are incompatible

  • np.linalg.LinAlgError – If QR decomposition fails

solve_with_custom_solver(method='lstsq', regularization=None, alpha=0.0, constraints=None, bounds=None, decimate=False, decimation_factor=10, zero_tolerance=0.001, plotting=False, save_results=False, **solver_kwargs)[source]

Alternative solving method using advanced linear solver.

This method provides more flexibility than the default QR-based solve(), offering multiple solving methods, regularization, and constraints.

Parameters:
  • method (str) – Solving method (‘lstsq’, ‘ridge’, ‘lasso’, ‘constrained’, etc.)

  • regularization (str) – Regularization type (‘l1’, ‘l2’, ‘elastic_net’)

  • alpha (float) – Regularization strength

  • constraints (dict) – Linear constraints

  • bounds (tuple) – Box constraints on parameters

  • decimate (bool) – Whether to apply decimation

  • decimation_factor (int) – Decimation factor if decimate=True

  • zero_tolerance (float) – Tolerance for eliminating zero columns

  • plotting (bool) – Whether to generate plots

  • save_results (bool) – Whether to save parameters to file

  • **solver_kwargs – Additional arguments for LinearSolver

Returns:

Identified base parameters

Return type:

ndarray

Example

>>> # Ridge regression with L2 regularization
>>> phi = identification.solve_with_custom_solver(
...     method='ridge', alpha=0.01)
>>> # Constrained optimization with physical bounds
>>> bounds = [(0, 100) for _ in range(n_params)]
>>> phi = identification.solve_with_custom_solver(
...     method='constrained', bounds=bounds)

identification_tools

figaroh.identification.identification_tools.base_param_from_standard(phi_standard, params_base)[source]

Convert standard parameters to base parameters.

Takes standard dynamic parameters and calculates the corresponding base parameters using analytical relationships between them.

Parameters:
  • phi_standard (dict) – Standard parameters from model/URDF

  • params_base (list) – Analytical parameter relationships

Returns:

Base parameter values calculated from standard parameters

Return type:

list

figaroh.identification.identification_tools.calculate_first_second_order_differentiation(model, q, identif_config, dt=None)[source]

Calculate joint velocities and accelerations from positions.

Computes first and second order derivatives of joint positions using central differences. Handles both constant and variable timesteps.

Parameters:
  • model (pin.Model) – Robot model

  • q (ndarray) – Joint position matrix (n_samples, n_joints)

  • param (dict) – Parameters containing: - is_joint_torques: Whether using joint torques - is_external_wrench: Whether using external wrench - ts: Timestep if constant

  • dt (ndarray, optional) – Variable timesteps between samples.

Returns:

  • q (ndarray): Trimmed position matrix

  • dq (ndarray): Joint velocity matrix

  • ddq (ndarray): Joint acceleration matrix

Return type:

tuple

Note

Two samples are removed from start/end due to central differences

figaroh.identification.identification_tools.index_in_base_params(params, id_segments)[source]

Map segment IDs to their base parameters.

For each segment ID, finds which base parameters contain inertial parameters from that segment.

Parameters:
  • params (list) – Base parameter expressions

  • id_segments (list) – Segment IDs to map

Returns:

Maps segment IDs to lists of base parameter indices

Return type:

dict

figaroh.identification.identification_tools.low_pass_filter_data(data, identif_config, nbutter=5)[source]

Apply zero-phase Butterworth low-pass filter to measurement data.

Uses scipy’s filtfilt for zero-phase digital filtering. Removes high frequency noise while preserving signal phase. Handles border effects by trimming filtered data.

Parameters:
  • data (ndarray) – Raw measurement data to filter

  • param (dict) – Filter parameters containing: - ts: Sample time - cut_off_frequency_butterworth: Cutoff frequency in Hz

  • nbutter (int, optional) – Filter order. Higher order gives sharper frequency cutoff. Defaults to 5.

Returns:

Filtered data with border regions removed

Return type:

ndarray

Note

Border effects are handled by removing nborder = 5*nbutter samples from start and end of filtered signal.

figaroh.identification.identification_tools.relative_stdev(W_b, phi_b, tau)[source]

Calculate relative standard deviation of identified parameters.

Implements the residual error method from [Pressé & Gautier 1991] to estimate parameter uncertainty.

Parameters:
  • W_b (ndarray) – Base regressor matrix

  • phi_b (list) – Base parameter values

  • tau (ndarray) – Measured joint torques/forces

Returns:

Relative standard deviation (%) for each base parameter

Return type:

ndarray

figaroh.identification.identification_tools.weigthed_least_squares(robot, phi_b, W_b, tau_meas, tau_est, identif_config)[source]

Compute weighted least squares solution for parameter identification.

Implements iteratively reweighted least squares method from [Gautier, 1997]. Accounts for heteroscedastic noise.

Parameters:
  • robot (pin.Robot) – Robot model

  • phi_b (ndarray) – Initial base parameters

  • W_b (ndarray) – Base regressor matrix

  • tau_meas (ndarray) – Measured joint torques

  • tau_est (ndarray) – Estimated joint torques

  • param (dict) – Settings including idx_tau_stop

Returns:

Identified base parameters

Return type:

ndarray

Configuration Management (New in v0.3.0)

Configuration parsing and parameter management for robot identification.

This module handles all configuration-related functionality including: - YAML configuration file parsing - Unified to legacy config format conversion - Parameter extraction and validation - Signal processing and mechanical parameter management

figaroh.identification.config.get_param_from_yaml(robot, identif_data)[source]

Parse identification parameters from YAML configuration file.

Extracts robot parameters, problem settings, signal processing options and total least squares parameters from a YAML config file.

Parameters:
  • robot (pin.RobotWrapper) – Robot instance containing model

  • identif_data (dict) – YAML configuration containing: - robot_params: Joint limits, friction, inertia settings - problem_params: External wrench, friction, actuator settings - processing_params: Sample rate, filter settings - tls_params: Load mass and location

Returns:

Parameter dictionary with unified settings

Return type:

dict

Example

>>> config = yaml.safe_load(config_file)
>>> params = get_param_from_yaml(robot, config)
>>> print(params["nb_samples"])
figaroh.identification.config.get_param_from_yaml_legacy(robot, identif_data) dict[source]

Legacy identification parameter parser for backward compatibility.

This is the original implementation. New code should use the unified config parser from figaroh.utils.config_parser.

Parameters:
  • robot – Robot instance

  • identif_data – Identification data dictionary

Returns:

Identification configuration dictionary

figaroh.identification.config.unified_to_legacy_identif_config(robot, unified_identif_config) dict[source]

Convert unified identification format to legacy identif_config format.

Maps the new unified identification configuration structure to produce the exact same output as get_param_from_yaml. This ensures backward compatibility while using the new unified parser.

Parameters:
  • robot (pin.RobotWrapper) – Robot instance containing model and data

  • unified_identif_config (dict) – Configuration from create_task_config

Returns:

Identification configuration matching get_param_from_yaml output

Return type:

dict

Example

>>> unified_config = create_task_config(robot, parsed_config,
...                                    "identification")
>>> legacy_config = unified_to_legacy_identif_config(robot,
...                                                  unified_config)
>>> # legacy_config has same keys as get_param_from_yaml output

Parameter Management (New in v0.3.0)

Parameter management utilities for robot identification.

This module handles parameter extraction, reordering, and management including: - Inertial parameter extraction and reordering - Standard additional parameters (friction, actuator inertia, offsets) - Custom parameter support - Parameter information queries

figaroh.identification.parameter.add_custom_parameters(model, custom_params)[source]

Add custom user-defined parameters.

Parameters:
  • model – Robot model

  • custom_params (dict) – Custom parameter definitions Format: {param_name: {values: list, per_joint: bool, default: float}}

Returns:

Custom parameters with their values

Return type:

dict

figaroh.identification.parameter.add_standard_additional_parameters(model, identif_config)[source]

Add standard additional parameters (actuator inertia, friction, offsets).

Parameters:
  • model – Robot model

  • identif_config (dict) – Identification configuration

Returns:

Additional parameters with their values

Return type:

dict

figaroh.identification.parameter.get_parameter_info()[source]

Get information about available parameter types.

Returns:

Information about standard and custom parameter types

Return type:

dict

figaroh.identification.parameter.get_standard_parameters(model, identif_config=None)[source]

Get standard inertial parameters from robot model with extensible parameter support.

Parameters:
  • model – Robot model (Pinocchio model)

  • identif_config (dict, optional) – Dictionary of parameter settings

Returns:

Parameter names mapped to their values

Return type:

dict

figaroh.identification.parameter.reorder_inertial_parameters(pinocchio_params)[source]

Reorder inertial parameters from Pinocchio format to desired format.

Parameters:

pinocchio_params – Parameters in Pinocchio order [m, mx, my, mz, Ixx, Ixy, Iyy, Ixz, Iyz, Izz]

Returns:

Parameters in desired order

[Ixx, Ixy, Ixz, Iyy, Iyz, Izz, mx, my, mz, m]

Return type:

list