Identification¶
The identification module provides tools for dynamic parameter
identification of robots, including the
reporting & verification suite
(print_quality_report(), export_html_report(), verify(),
export_verification_report()) attached directly to BaseIdentification.
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.).
BaseIdentification(robot, config_file='config/robot_config.yaml')
¶
Bases: ABC
Base class for robot dynamic parameter identification.
Provides common functionality for all robots while allowing robot-specific implementations of key methods.
Initialize base identification with robot model and configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot
|
Robot model loaded with FIGAROH |
required | |
config_file
|
Path to robot configuration YAML file |
'config/robot_config.yaml'
|
Source code in src/figaroh/identification/base_identification.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
solve(decimate=True, decimation_factor=10, zero_tolerance=0.001, plotting=True, save_results=False, html_report=False, wls=False)
¶
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:
| Name | Type | Description | Default |
|---|---|---|---|
decimate
|
bool
|
Whether to apply decimation to reduce data size |
True
|
decimation_factor
|
int
|
Factor for signal decimation (default: 10) |
10
|
zero_tolerance
|
float
|
Tolerance for eliminating zero columns |
0.001
|
plotting
|
bool
|
Whether to generate plots |
True
|
save_results
|
bool
|
Whether to save parameters to file |
False
|
html_report
|
bool
|
If True, also export an HTML diagnostic
report (see :meth: |
False
|
wls
|
bool
|
If True, refine the OLS base-parameter estimate with
iteratively-weighted least squares (Gautier, 1997) before
computing quality metrics — see
:meth: |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
ndarray |
Base parameters phi_base |
Raises:
| Type | Description |
|---|---|
AssertionError
|
If prerequisites not met (dynamic_regressor, standard_parameter) |
ValueError
|
If data shapes are incompatible |
LinAlgError
|
If QR decomposition fails |
Source code in src/figaroh/identification/base_identification.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
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)
¶
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:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Solving method ('lstsq', 'ridge', 'lasso', 'constrained', etc.) |
'lstsq'
|
regularization
|
str
|
Regularization type ('l1', 'l2', 'elastic_net') |
None
|
alpha
|
float
|
Regularization strength |
0.0
|
constraints
|
dict
|
Linear constraints |
None
|
bounds
|
tuple
|
Box constraints on parameters |
None
|
decimate
|
bool
|
Whether to apply decimation |
False
|
decimation_factor
|
int
|
Decimation factor if decimate=True |
10
|
zero_tolerance
|
float
|
Tolerance for eliminating zero columns |
0.001
|
plotting
|
bool
|
Whether to generate plots |
False
|
save_results
|
bool
|
Whether to save parameters to file |
False
|
**solver_kwargs
|
Additional arguments for LinearSolver |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
ndarray |
Identified base parameters |
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)
Source code in src/figaroh/identification/base_identification.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | |
load_param(config_file, setting_type='identification')
¶
Load the identification parameters from the yaml file.
Only the unified configuration format is supported; a legacy flat
config raises an error naming figaroh.utils.config_migration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str
|
Path to a unified configuration file |
required |
setting_type
|
str
|
Configuration section to load |
'identification'
|
Source code in src/figaroh/identification/base_identification.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
load_trajectory_data(data_source=None)
abstractmethod
¶
Load and process CSV data.
This method must be implemented by robot-specific subclasses to handle their specific data formats and file structures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_source
|
str
|
Optional override identifying an alternate dataset
to load instead of the class's normal training data (e.g.
a directory holding a held-out validation trajectory with
the same file layout/naming as the training data). When
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dictionary with keys 'timestamps', 'positions', |
|
|
'velocities', 'accelerations', 'torques' (numpy arrays; |
||
|
'velocities'/'accelerations' may be None to be derived by |
||
|
differentiation). |
Source code in src/figaroh/identification/base_identification.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
process_data(truncate=None)
¶
Load and process data
Source code in src/figaroh/identification/base_identification.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
fit_joints()
¶
Active joints whose effort rows enter the fit, in active order.
identif_config["torque_fit_joints"] names them; by default every
active joint. The other active joints keep their kinematics in the
regressor (their motion still loads the fitted joints) but their
measured effort is neither fitted nor scored: use it for joints whose
effort signal is not trusted (unknown force constant, quantised).
Source code in src/figaroh/identification/base_identification.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | |
calculate_full_regressor()
¶
Build regressor matrix, compute pre-identified values of standard parameters, compute joint torques based on pre-identified standard parameters.
Source code in src/figaroh/identification/base_identification.py
646 647 648 649 650 651 652 653 654 655 656 657 | |
initialize_standard_parameters()
¶
Initialize standard parameters for the robot.
Source code in src/figaroh/identification/base_identification.py
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | |
compute_reference_torque()
¶
Compute reference joint torques based on standard parameters and dynamic regressor.
Source code in src/figaroh/identification/base_identification.py
692 693 694 695 696 697 698 699 700 701 702 | |
process_kinematics_data(filter_config=None)
¶
Process kinematics data (positions, velocities, accelerations) with filtering.
Source code in src/figaroh/identification/base_identification.py
1201 1202 1203 | |
filter_kinematics_data(filter_config=None)
¶
Apply filtering to data with configurable parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_config
|
dict
|
Filter configuration with keys: - differentiation_method: Method for derivative estimation - filter_params: Parameters for signal filtering |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If required data is missing |
Source code in src/figaroh/identification/base_identification.py
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | |
process_torque_data(**kwargs)
¶
Process torque data (generic implementation, should be overridden for robot-specific processing).
Source code in src/figaroh/identification/base_identification.py
1256 1257 1258 1259 1260 1261 1262 1263 | |
print_quality_report()
¶
Print a formatted identification quality report to the terminal.
Reports condition number, overall torque residual statistics, per-joint residuals (when available), base-parameter uncertainty, held-out validation metrics (if configured), and optional physical-consistency / reconstruction status.
Source code in src/figaroh/identification/base_identification.py
2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 | |
export_html_report(output_path=None, output_dir='results')
¶
Export the identification quality report as a self-contained
HTML file — the visual counterpart of :meth:print_quality_report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Explicit output file path. If None, writes to
|
None
|
output_dir
|
str
|
Directory used when output_path is not given (created if missing). |
'results'
|
Returns:
| Type | Description |
|---|---|
str
|
The path the report was written to. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If solve() has not been run yet. |
Source code in src/figaroh/identification/base_identification.py
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 | |
verify(thresholds=None, scope='prediction')
¶
Return scoped acceptance evidence with explicit incomplete states.
scope="execution" checks finite numerical fit outputs;
it does not certify prediction, physical parameters or export.
scope="prediction" (default) additionally requires independent validation
and explicit application error limits. No universal improvement,
correlation, conditioning or prediction-error gate is imposed.
thresholds maps metric names to threshold, comparison
(min/max), and optional required (default True). Missing required
evidence produces not_evaluated, not PASS. Nonfinite evidence fails.
passed is True only when all required checks in scope pass.
Source code in src/figaroh/identification/base_identification.py
2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 | |
export_urdf(nominal_urdf, output_path=None, merged_bodies='refuse')
¶
Write the selected estimate's link inertials into a URDF.
Needs select_stage reconstruction or physical_fit and an
accepted estimate: the base-parameter fit has no per-link
inertials, and a rejected estimate is not exported. Either case
records stage export as failed and raises. On success the URDF is
written, reloaded with Pinocchio as a check and export is
recorded ok with the file as artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nominal_urdf
|
str
|
Path of the nominal URDF the run was based on. |
required |
output_path
|
Optional[str]
|
Where to write; default |
None
|
merged_bodies
|
str
|
|
'refuse'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Absolute path of the written URDF. |
Raises:
| Type | Description |
|---|---|
ValueError
|
no accepted standard-space estimate, or the exporter refused the parameters. |
Source code in src/figaroh/identification/base_identification.py
2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 | |
export_verification_report(output_path=None, output_dir='results', thresholds=None, scope='prediction')
¶
Write this identification's :meth:verify verdict as JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str
|
Explicit file path. If omitted, defaults to
|
None
|
output_dir
|
str
|
Directory used when |
'results'
|
thresholds
|
Optional[Dict[str, Dict[str, Any]]]
|
Forwarded to :meth: |
None
|
scope
|
str
|
Forwarded to :meth: |
'prediction'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The path the JSON verdict was written to. |
Source code in src/figaroh/identification/base_identification.py
2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 | |
plot_results()
¶
Plot identification results using unified results manager.
Source code in src/figaroh/identification/base_identification.py
2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 | |
save_results(output_dir='results')
¶
Save identification results using unified results manager.
Source code in src/figaroh/identification/base_identification.py
2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 | |
identification_tools¶
base_param_from_standard(phi_standard, params_base)
¶
Convert standard parameters to base parameters.
Takes standard dynamic parameters and calculates the corresponding base parameters using analytical relationships between them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi_standard
|
dict
|
Standard parameters from model/URDF |
required |
params_base
|
list
|
Analytical parameter relationships |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
Base parameter values calculated from standard parameters |
Source code in src/figaroh/identification/identification_tools.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
relative_stdev(W_b, phi_b, tau)
¶
Calculate relative standard deviation of identified parameters.
Implements the residual error method from [Pressé & Gautier 1991] to estimate parameter uncertainty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
W_b
|
ndarray
|
Base regressor matrix |
required |
phi_b
|
list
|
Base parameter values |
required |
tau
|
ndarray
|
Measured joint torques/forces |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ndarray |
Relative standard deviation (%) for each base parameter |
Source code in src/figaroh/identification/identification_tools.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
index_in_base_params(params, id_segments)
¶
Map segment IDs to their base parameters.
For each segment ID, finds which base parameters contain inertial parameters from that segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
list
|
Base parameter expressions |
required |
id_segments
|
list
|
Segment IDs to map |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Maps segment IDs to lists of base parameter indices |
Source code in src/figaroh/identification/identification_tools.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
weigthed_least_squares(robot, phi_b, W_b, tau_meas, tau_est, identif_config)
¶
Compute weighted least squares solution for parameter identification.
Implements iteratively reweighted least squares method from [Gautier, 1997]. Accounts for heteroscedastic noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot
|
Robot
|
Robot model |
required |
phi_b
|
ndarray
|
Initial base parameters |
required |
W_b
|
ndarray
|
Base regressor matrix |
required |
tau_meas
|
ndarray
|
Measured joint torques |
required |
tau_est
|
ndarray
|
Estimated joint torques |
required |
param
|
dict
|
Settings including idx_tau_stop |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ndarray |
Identified base parameters |
Source code in src/figaroh/identification/identification_tools.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
calculate_first_second_order_differentiation(model, q, identif_config, dt=None, backend=None)
¶
Estimate interval tangent velocities and their coordinate derivatives.
Configuration differences use the model/backend Lie-group operation, so
positions have width nq and velocities/accelerations have width nv.
Effort-selection flags do not determine these dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
Robot model; unused when backend is supplied. |
required |
q
|
ndarray
|
Finite configurations of shape (n_samples, nq), with at least three samples. Manifold configurations must be valid for the selected model (e.g. normalized quaternions). |
required |
identif_config
|
dict
|
Contains positive finite |
required |
dt
|
float or ndarray
|
Positive finite sample interval, or one interval per consecutive configuration pair (n_samples - 1). Pass timestamp differences, not absolute timestamps. |
None
|
backend
|
DynamicsBackend
|
Supplies nq, nv and compute_difference instead of the Pinocchio model. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Positions (n_samples - 2, nq), velocities and accelerations |
|
|
(n_samples - 2, nv). All tangent coordinates are differentiated. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Invalid configurations, sample count or timesteps. |
Note
Preserves the historical alignment: q[:-2] and the first n_samples-2 forward interval velocities. Velocities represent interval midpoints, not the returned position timestamps. Acceleration is the gradient of those tangent components at the midpoint times (one-sided at endpoints). No interpolation to position timestamps or moving-frame transport is performed. Both discarded position samples are at the end.
Source code in src/figaroh/identification/identification_tools.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
low_pass_filter_data(data, identif_config, nbutter=5)
¶
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:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
ndarray
|
Raw measurement data to filter |
required |
param
|
dict
|
Filter parameters containing: - ts: Sample time - cut_off_frequency_butterworth: Cutoff frequency in Hz |
required |
nbutter
|
int
|
Filter order. Higher order gives sharper frequency cutoff. Defaults to 5. |
5
|
Returns:
| Name | Type | Description |
|---|---|---|
ndarray |
Filtered data with border regions removed |
Note
Border effects are handled by removing nborder = 5*nbutter samples from start and end of filtered signal.
Source code in src/figaroh/identification/identification_tools.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
config¶
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
unified_to_legacy_identif_config(robot, unified_identif_config)
¶
Convert unified identification format to legacy identif_config format.
Maps the unified identification configuration structure to the
identif_config dict the identification classes consume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot
|
RobotWrapper
|
Robot instance containing model and data |
required |
unified_identif_config
|
dict
|
Configuration from create_task_config |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Identification configuration ( |
Example
unified_config = create_task_config(robot, parsed_config, ... "identification") legacy_config = unified_to_legacy_identif_config(robot, ... unified_config)
legacy_config has the identif_config keys¶
Source code in src/figaroh/identification/config.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
parameter¶
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
reorder_inertial_parameters(pinocchio_params)
¶
Reorder inertial parameters from Pinocchio format to desired format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pinocchio_params
|
Parameters in Pinocchio order [m, mx, my, mz, Ixx, Ixy, Iyy, Ixz, Iyz, Izz] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
Parameters in desired order [Ixx, Ixy, Ixz, Iyy, Iyz, Izz, mx, my, mz, m] |
Source code in src/figaroh/identification/parameter.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
add_standard_additional_parameters(model, identif_config)
¶
Add standard additional parameters (actuator inertia, friction, offsets).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Robot model |
required | |
identif_config
|
dict
|
Identification configuration |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Additional parameters with their values |
Source code in src/figaroh/identification/parameter.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
add_custom_parameters(model, custom_params)
¶
Add custom user-defined parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Robot model |
required | |
custom_params
|
dict
|
Custom parameter definitions Format: {param_name: {values: list, per_joint: bool, default: float}} |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Custom parameters with their values |
Source code in src/figaroh/identification/parameter.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get_standard_parameters(model, identif_config=None)
¶
Get standard inertial parameters from robot model with extensible parameter support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Robot model (Pinocchio model) |
required | |
identif_config
|
dict
|
Dictionary of parameter settings |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Parameter names mapped to their values |
Source code in src/figaroh/identification/parameter.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
get_parameter_info()
¶
Get information about available parameter types.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Information about standard and custom parameter types |
Source code in src/figaroh/identification/parameter.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
physical_fit¶
Direct LMI effort fit over all standard parameters (public since #61;
figaroh.identification._physical_comparator remains as an alias).
Physically consistent parameter recovery by convex (LMI) effort fits.
Three different objectives are available on one shared problem; none of them silently falls back to another:
- :func:
solve_exact_reconstruction- closest-to-prior theta that reproduces the OLS base parameters exactly (M_full theta = phi_ols) with a pseudo-inertia LMI per link. - :func:
solve_direct_effort_fit- regularised effort fit with the same LMIs and bounds, no base equality. This is the estimator thatselect_stage: physical_fitselects in :class:BaseIdentification. - :func:
solve_per_link_projection- nullspace representative ofphi_olsfollowed by an independent LMI projection per link.
:func:diagnose_exact runs staged diagnostics (D0..D3) to explain why
objective 1 fails on a given problem.
Typical use::
problem = build_problem(Y, tau, params_std, joint_names, prior=prior)
record = solve_direct_effort_fit(problem, solver="cvxopt")
if record.accepted:
theta = record.theta # aligned to ``problem.params_std``
Every solve returns a :class:SolveRecord that states the solver status,
the base residual and per-link feasibility, so a caller can decide whether
the estimate is usable. The module was promoted from the private
_physical_comparator; that name remains as a re-export shim.
FixedExtras(names=(), values=(), source='zero')
dataclass
¶
Parameters held fixed (e.g. friction); their effort is subtracted.
names must be column names of Y_std; source records where
values came from (truth, zero or declared).
PhysicalPolicy(mass_min=1e-06, mass_ratio_bounds=None, feas_tol=-1e-08, base_rel_tol=1e-06, prior_weight=1e-06)
dataclass
¶
Bounds and tolerances shared by all objectives.
mass_min lower-bounds every link mass, feas_tol is the
pseudo-inertia eigenvalue tolerance of the acceptance test,
base_rel_tol the relative base residual allowed for the exact
objective and prior_weight the Tikhonov weight towards the prior.
ComparatorProblem(params_std, joint_names, Y, tau, row_weight, theta_prior, coord_scale, M_full, phi_ols, R, Qt_tau, extras, policy, theta_truth=None, base_indices=(), removed_columns=())
dataclass
¶
Shared problem data built by :func:build_problem.
Y/tau are the (unweighted) regressor and effort over
params_std; row_weight the per-row weights; M_full/phi_ols
the base mapping and OLS base parameters used by the exact objective.
SolveRecord(objective, solver, solver_status, picos_status, exception, runtime_s, objective_value, theta, fallback_used, fallback_candidate, base_residual, effort_rmse_fit_per_joint, feasibility, accepted, truth_error, inputs_hash, notes=dict())
dataclass
¶
Outcome of one solve: status, estimate, residuals and acceptance.
accepted is true only for an optimal solve whose every link passes
the pseudo-inertia feasibility test (and, for the exact objective, whose
relative base residual is within tolerance). theta is None for a
non-optimal solve; no estimate is substituted.
build_problem(Y_std, tau, params_std, joint_names, *, prior, extras=None, policy=None, row_weight=None, qr_tol=1e-06, theta_truth=None)
¶
Assemble the shared problem.
prior/theta_truth are given over params_std. Columns named in
extras are removed from the unknowns and their effort is subtracted
from tau. Columns removed by the QR step stay in M_full as zeros
so every link keeps its LMI.
Source code in src/figaroh/identification/physical_fit.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
solve_exact_reconstruction(p, *, solver='cvxopt', **opts)
¶
Objective 1: min ||D(theta-theta0)|| s.t. M_full theta = phi_ols, LMIs.
Source code in src/figaroh/identification/physical_fit.py
571 572 573 574 575 576 | |
solve_direct_effort_fit(p, *, solver='cvxopt', **opts)
¶
Objective 2: regularised effort fit with the same LMIs, no equality.
Source code in src/figaroh/identification/physical_fit.py
579 580 581 582 583 584 | |
solve_per_link_projection(p, *, solver='cvxopt')
¶
Objective 3: nullspace representative, then per-link LMI projection.
Source code in src/figaroh/identification/physical_fit.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
diagnose_exact(p, *, solver='cvxopt')
¶
Staged diagnostics for objective 1 (D0 reproduce, D1 phase-I, D2 one-change variants, D3 relaxed equality).
Source code in src/figaroh/identification/physical_fit.py
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
selection¶
Which estimate an identification run reports (#61).
tasks.identification.select_stage picks the estimate that validation,
verify(), the reports, the run archive and the URDF export use:
fit(default): the base-parameter least-squares fit, unchanged.reconstruction: the full parameter vector reconstructed from the fit, accepted only when it is physically consistent and was produced by the requested method.physical_fit: the direct LMI effort fit (:func:figaroh.identification.physical_fit.solve_direct_effort_fit).
A requested stage that does not meet its acceptance conditions is
rejected: nothing else is substituted, the selected stage is none and
the verdict fails. The fit numbers stay under their usual result keys.
SelectedEstimate(stage, requested, status, reason, space, names=list(), values=None, phi_base_equivalent=None, base_residual_rel=None, feasibility=dict(), effective_method=None, solvers=list(), psd_eig_tol=-1e-10, extra=dict())
dataclass
¶
The estimate chosen by select_stage and the verdict on it.
Attributes:
| Name | Type | Description |
|---|---|---|
stage |
str
|
Stage whose numbers are reported: |
requested |
str
|
The stage that was asked for. |
status |
str
|
|
reason |
str
|
Why, in one line (names the solver(s) and the failed test). |
space |
str
|
|
names |
List[str]
|
Parameter names aligned with |
values |
Optional[ndarray]
|
The candidate vector; kept for diagnosis when rejected. |
phi_base_equivalent |
Optional[ndarray]
|
|
base_residual_rel |
Optional[float]
|
Relative distance of |
feasibility |
Dict[str, Dict[str, Any]]
|
Per link |
effective_method |
Optional[str]
|
Method that produced a reconstruction. |
solvers |
List[str]
|
Solver names tried for a physical fit. |
psd_eig_tol |
float
|
Pseudo-inertia eigenvalue tolerance the links were judged feasible with; export uses the same one. |
predict(W_full)
¶
Effort predicted by this estimate: the full regressor times the
standard parameter vector (never phi_base_equivalent).
Source code in src/figaroh/identification/selection.py
91 92 93 94 95 96 | |
parameter_dict()
¶
{name: value} of the candidate (empty when no values).
Source code in src/figaroh/identification/selection.py
126 127 128 129 130 | |
link_p10(joint_names)
¶
Per-link 10-vectors of a standard-space estimate.
Source code in src/figaroh/identification/selection.py
132 133 134 135 136 137 138 139 140 141 142 | |
requested_stage(identif)
¶
The configured select_stage (fit when absent).
Source code in src/figaroh/identification/selection.py
145 146 147 148 | |
physical_fit_config(identif)
¶
The physical_fit settings with every key present.
The config parser already merges the defaults; a programmatic config may hold a partial mapping (or none), which is completed here.
Source code in src/figaroh/identification/selection.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
run_physical_fit(identif)
¶
Solve the direct LMI effort fit on the data the fit used.
Returns an outcome dict (never raises): record (a
:class:~figaroh.identification.physical_fit.SolveRecord or None),
solvers (names tried), reason and accepted. The processed
regressor is scattered into all standard columns (zeros where columns
were eliminated); friction and offsets are free parameters and the
prior is the nominal standard parameter vector.
Source code in src/figaroh/identification/selection.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
select_estimate(identif)
¶
Build the :class:SelectedEstimate for the configured stage.
Source code in src/figaroh/identification/selection.py
426 427 428 429 430 431 432 433 434 435 | |
Physical inertial conventions¶
Physical-consistency utilities use Pinocchio dynamic-parameter order:
[m, mx, my, mz, Ixx, Ixy, Iyy, Ixz, Iyz, Izz]. The first moments are
h = m*c; the six tensor entries describe rotational inertia I_O about
the link-frame origin. They are distinct from inertia I_C about the centre
of mass: I_O = I_C + m * ((c.T*c)*eye(3) - c*c.T).
The physical constraint is positive semidefiniteness of the pseudo-inertia
P = [[Sigma, h], [h.T, m]], with
Sigma = 0.5*trace(I_O)*eye(3) - I_O. Projection uses this second-moment
block as its decision variable and converts back using
I_O = trace(Sigma)*eye(3) - Sigma. Its objective and weights apply to the
ten dynamic parameters. SDP reconstruction imposes the same pseudo-inertia
constraint while preserving its base-parameter equalities.
The existing CAD com_bounds option bounds first moments h, in kg*m,
rather than CoM coordinates in metres. Physical feasibility does not establish
identifiability or complete inertial URDF export.