Implement generic, URI-based robot configuration system for URDF customization#26
Implement generic, URI-based robot configuration system for URDF customization#26Copilot wants to merge 7 commits into
Conversation
|
@copilot The proposed solution is indeed a preferred one. Implement it with the example for |
|
for the attention of @LeonardoGuevara @ibrahimhroob @gpdas |
- Add config/robots directory with default.yaml and hunter_01.yaml - Create config_loader.py for loading and merging configurations - Update hunter_pltf.urdf.xacro to accept sensor pose parameters - Modify launch files (pltf_rsp, bringup, gazebo) to use robot_id arg - Add comprehensive README.md with usage documentation - Enable per-robot sensor calibration without separate xacro files Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
Implemented the YAML-based configuration system with a complete example for hunter_01: Configuration files:
All sensors are now configurable:
Usage: # Default
ros2 launch hunter_pltf_description pltf_rsp.launch.py
# Hunter-01 (simulation)
ros2 launch hunter_pltf_gazebo launch_sim.launch.py robot_id:=hunter_01
# Hunter-01 (real robot)
ros2 launch hunter_pltf_bringup hunter_pltf_bringup.launch.py robot_id:=hunter_01All launch files updated with |
Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
marc-hanheide
left a comment
There was a problem hiding this comment.
@copilot, try to address the individual comments to craft a more generic, reusable solution.
| return result | ||
|
|
||
|
|
||
| def load_robot_config(robot_id: str = 'default') -> Dict[str, Any]: |
There was a problem hiding this comment.
@copilot this assumes that robot configurations are always stored within this repository under config/robots, which is not a valid assumption. Robot specific configurations may well be stored in arbitrary files paths or even online (accessible via https). Amend the implementation to allow passing in URIs.
There was a problem hiding this comment.
Implemented URI support. The system now accepts:
- Simple robot IDs:
robot_id:=hunter_01(looks in config/robots/) - Absolute paths:
robot_id:=/path/to/config.yaml - File URLs:
robot_id:=file:///path/to/config.yaml - HTTPS URLs:
robot_id:=https://example.com/config.yaml
The load_robot_config() function auto-detects the input type and uses load_yaml_from_uri() which handles all URI schemes. Tested with local paths and URLs.
Commit: 4e80dd5
| return default | ||
|
|
||
|
|
||
| def get_xacro_args(config: Dict[str, Any], is_sim: bool = True) -> Dict[str, str]: |
There was a problem hiding this comment.
@copilot the get_xacro_args file is now very specific to the URDF. Is it possible to make an implementation that is more flexible and re-usable to be working with other URDFs, i.e., not referring to specific, hard-coded arguments, but directly expose the arguments of a URDF?
There was a problem hiding this comment.
Replaced hardcoded logic with generic flatten_dict() and get_xacro_args_from_config(). The system now:
- Automatically flattens any nested YAML structure (e.g.,
sensors.imu.x→imu_x) - Works with any URDF (not Hunter-specific)
- Handles
_sim/_realsuffixes dynamically - No hardcoded sensor names
Example: Any YAML structure like manipulator.joint1.position automatically becomes joint1_position.
The old get_xacro_args() is now just a wrapper for backward compatibility.
Commit: 4e80dd5
- Support loading configs from URIs (file paths, file://, https://) - Generic YAML-to-xacro mapping (no hardcoded sensor names) - Automatic flattening of nested YAML structures - Reusable for any URDF, not Hunter-specific - Update YAML sensor keys (front_lidar_link → front_lidar) - Backward compatible via get_xacro_args() wrapper - Enhanced documentation with URI examples Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
Crafted a more generic, reusable solution: URI Support:
Generic Mapping:
Reusable:
Updated documentation with examples showing usage for other robots. Commit: 4e80dd5 |
- Document usage with mobile robots, manipulators, drones - Show YAML-to-xacro mapping for different robot types - Provide launch file integration examples - Demonstrate URI loading from multiple sources - Include best practices and validation steps - Prove system works for any robot, not just Hunter Co-authored-by: marc-hanheide <1153084+marc-hanheide@users.noreply.github.com>
Individual Hunter robot instances have idiosyncratic differences in sensor mount positions due to manufacturing tolerances and calibration. Currently, all sensor poses are hardcoded in
hunter_pltf.urdf.xacro, requiring separate xacro files per robot or manual editing.This PR implements a generic, reusable YAML-based configuration system that allows customization of sensor poses for individual robot instances without creating separate xacro files. The system works with any robot and URDF, not just Hunter platform.
Implementation Summary
Complete generic configuration system with:
config/robots/(e.g.,hunter_01.yaml)default.yamlbaseline with all standard sensor posesFiles Created
Configuration Files
config/robots/default.yaml(156 lines) - Baseline configuration with all 7 sensorsconfig/robots/hunter_01.yaml(86 lines) - Fully documented example with calibrated valuesconfig/robots/config_loader.py(305 lines) - Generic Python utility for loading and merging configurations from any URIconfig/robots/README.md(280+ lines) - Complete documentation covering usage, calibration, URI loading, and generic mappingconfig/robots/EXAMPLE_USAGE.md(272 lines) - Practical examples and comparison tablesconfig/robots/GENERIC_USAGE.md(443 lines) - Examples for mobile robots, manipulators, and drones showing reusabilityModified Files
description/hunter_pltf.urdf.xacro- Added 60+ xacro:arg parameters for all sensor poseslaunch/pltf_rsp.launch.py- Integrated config loader with robot_id argumenthunter_pltf_bringup/launch/hunter_pltf_bringup.launch.py- Added robot_id supporthunter_pltf_gazebo/launch/launch_sim.launch.py- Added robot_id support for simulationCMakeLists.txt- Added config directory to install targets.gitignore- Added Python cache file patternsConfiguration Structure
Key Features
✅ URI-based loading - Load configs from anywhere:
robot_id:=hunter_01(looks in config/robots/)robot_id:=/path/to/config.yamlrobot_id:=file:///path/to/config.yamlrobot_id:=https://example.com/config.yaml✅ Generic YAML-to-xacro mapping - Works with any URDF:
sensors.imu.x→imu_x)_sim/_realsuffix handling✅ Reusable for any robot - Not Hunter-specific:
✅ Inheritance-based configuration - Robot-specific files only specify differences from default
✅ All sensors configurable - 7 sensors with full 6-DOF pose control:
✅ Simulation vs real hardware - Separate LiDAR orientations for sim and real deployments
✅ Launch argument support -
robot_idparameter in all launch files✅ Backward compatible - Defaults to baseline configuration if no robot_id specified
✅ Comprehensive documentation - 1000+ lines of documentation with usage examples, troubleshooting, and examples for different robot types
Usage Examples
Default configuration (backward compatible):
Hunter-01 configuration:
Load from absolute path:
Load from remote URL:
Test configuration:
Generic Usage (Any Robot)
The system automatically works with any robot structure:
See
GENERIC_USAGE.mdfor complete examples with mobile robots, manipulators, and drones.Hunter-01 Example
The hunter_01.yaml demonstrates realistic calibration with:
Validation
✅ Python syntax validated (all .py files)
✅ XML syntax validated (all .xacro files)
✅ YAML syntax validated (all .yaml files)
✅ Config loader tested with default and hunter_01
✅ Inheritance system verified (overrides work correctly)
✅ URI loading tested (paths, file://, https:// detection)
✅ Generic mapping tested with multiple robot types
Creating New Robot Configurations
hunter_01.yamlas template (or create your own structure)robot_idand calibration notesconfig_loader.pyrobot_id:=<your_robot>or full URIReusability for Other Projects
This configuration system can be used in any ROS project:
config_loader.pyto your projectget_xacro_args_from_config()for automatic mappingGENERIC_USAGE.mdfor integration examplesFixes #25
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.