Validation Checksο
The validation system is built from modular, single-responsibility checks. Each check targets one specific aspect of the robot model and can be run independently or composed into a full validation pipeline.
Abstract Baseο
- class linkforge.core.validation.ValidationCheck[source]ο
Bases:
ABCAbstract base class for a single, focused validation rule.
All concrete checks must implement
run(). Checks are stateless by design β all output is written into the providedValidationResult.- abstractmethod run(robot, result)[source]ο
Apply this check, writing errors and warnings into
result.- Parameters:
robot (
Robot) β The robot model to validate.result (
ValidationResult) β The shared result object to append errors/warnings to.
- Return type:
Built-in Checksο
- class linkforge.core.validation.HasLinksCheck[source]ο
Bases:
ValidationCheckCheck that the robot has at least one link.
- run(robot, result)[source]ο
Check that robot has at least one link.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.DuplicateNameCheck[source]ο
Bases:
ValidationCheckCheck for duplicate link and joint names.
- run(robot, result)[source]ο
Check for duplicate link and joint names.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.JointReferenceCheck[source]ο
Bases:
ValidationCheckCheck that all joints reference existing links.
- run(robot, result)[source]ο
Check that all joints reference valid links.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.TreeStructureCheck[source]ο
Bases:
ValidationCheckCheck kinematic tree integrity: cycles, root link, and connectivity.
- run(robot, result)[source]ο
Check kinematic tree structure.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.MassPropertiesCheck[source]ο
Bases:
ValidationCheckCheck for mass and inertia issues (warnings).
- run(robot, result)[source]ο
Check for mass property health.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.GeometryCheck[source]ο
Bases:
ValidationCheckCheck for missing visual and collision geometry (warnings).
- run(robot, result)[source]ο
Check for geometry warnings.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.Ros2ControlCheck[source]ο
Bases:
ValidationCheckCheck that ros2_control joints reference existing robot joints.
- run(robot, result)[source]ο
Check ros2_control joint existence.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
- class linkforge.core.validation.MimicChainCheck[source]ο
Bases:
ValidationCheckCheck for invalid or circular mimic joint configurations.
- run(robot, result)[source]ο
Check for invalid mimic joint configurations.
- Parameters:
robot (
Robot)result (
ValidationResult)
- Return type:
Usage Examplesο
Run the full validatorο
The standard workflow β runs all registered checks in order:
from linkforge.core.validation import RobotValidator
validator = RobotValidator()
result = validator.validate(robot)
if not result.is_valid:
for error in result.errors:
print(f"[ERROR] {error.title}: {error.message}")
Run a single check in isolationο
Useful for targeted testing or when building a custom validation pipeline:
from linkforge.core.validation import TreeStructureCheck, ValidationResult
result = ValidationResult()
TreeStructureCheck().run(robot, result)
if result.errors:
print("Tree structure is invalid:")
for err in result.errors:
print(f" - {err.message}")
else:
print("Tree structure is valid.")
Build a custom validation pipelineο
Pick and compose only the checks you need:
from linkforge.core.validation import (
HasLinksCheck,
DuplicateNameCheck,
MassPropertiesCheck,
ValidationResult,
)
checks = [HasLinksCheck(), DuplicateNameCheck(), MassPropertiesCheck()]
result = ValidationResult()
for check in checks:
check.run(robot, result)
print(f"Errors: {len(result.errors)}, Warnings: {len(result.warnings)}")
Tip
All checks are stateless. The same check instance can be run against multiple robots in sequence without any side effects.