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: ABC

Abstract 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 provided ValidationResult.

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:

None

Built-in Checks

class linkforge.core.validation.HasLinksCheck[source]

Bases: ValidationCheck

Check that the robot has at least one link.

run(robot, result)[source]

Check that robot has at least one link.

Parameters:
Return type:

None

class linkforge.core.validation.DuplicateNameCheck[source]

Bases: ValidationCheck

Check for duplicate link and joint names.

run(robot, result)[source]

Check for duplicate link and joint names.

Parameters:
Return type:

None

class linkforge.core.validation.JointReferenceCheck[source]

Bases: ValidationCheck

Check that all joints reference existing links.

run(robot, result)[source]

Check that all joints reference valid links.

Parameters:
Return type:

None

class linkforge.core.validation.TreeStructureCheck[source]

Bases: ValidationCheck

Check kinematic tree integrity: cycles, root link, and connectivity.

run(robot, result)[source]

Check kinematic tree structure.

Parameters:
Return type:

None

class linkforge.core.validation.MassPropertiesCheck[source]

Bases: ValidationCheck

Check for mass and inertia issues (warnings).

run(robot, result)[source]

Check for mass property health.

Parameters:
Return type:

None

class linkforge.core.validation.GeometryCheck[source]

Bases: ValidationCheck

Check for missing visual and collision geometry (warnings).

run(robot, result)[source]

Check for geometry warnings.

Parameters:
Return type:

None

class linkforge.core.validation.Ros2ControlCheck[source]

Bases: ValidationCheck

Check that ros2_control joints reference existing robot joints.

run(robot, result)[source]

Check ros2_control joint existence.

Parameters:
Return type:

None

class linkforge.core.validation.MimicChainCheck[source]

Bases: ValidationCheck

Check for invalid or circular mimic joint configurations.

run(robot, result)[source]

Check for invalid mimic joint configurations.

Parameters:
Return type:

None


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.