A MATLAB toolkit for programmatically creating, modifying, and managing URDF (Unified Robot Description Format) files. This library provides an object-oriented interface for robot model construction and manipulation.
-
Complete URDF Element Support
- Links and Joints (Continuous, Fixed, Floating, Planar, Prismatic, Revolute)
- Visual and Geometric Components (Box, Cylinder, Sphere, Mesh)
- Origins and Transformations
- Materials and Properties
- Reusable Component assemblies
-
Object-Oriented Design
- Clean class hierarchy with
URDFTag
as base class - Modular component structure
- Extensible architecture
- Clean class hierarchy with
-
Comprehensive Joint Types
- Continuous joints for unlimited rotation
- Fixed joints for rigid connections
- Floating joints for unconstrained motion
- Planar joints for 2D movement
- Prismatic joints for linear motion
- Revolute joints with configurable limits
-
Comprehensive Geometry Support
- Basic shapes (Box, Cylinder, Sphere)
- Mesh import capabilities
- Visual component management
- Origin and transformation handling
-
Reusable Component Assembly Support
- Create reusable component assemblies with links and joints
- Define and attach parameters to component assemblies
- Create unique component instances with their own set of parameter values
-
XML Processing
- Read existing URDF files
- Write URDF files
- Compare URDF structures
- Validate URDF syntax
└── robotBuilder_matlab/
├── +urdf
│ ├── +joints
│ │ ├── Continuous.m
│ │ ├── Fixed.m
│ │ ├── Floating.m
│ │ ├── Planar.m
│ │ ├── Prismatic.m
│ │ └── Revolute.m
│ ├── +shapes
│ │ ├── Box.m
│ │ ├── Cylinder.m
│ │ ├── Mesh.m
│ │ └── Sphere.m
│ ├── +util
│ │ ├── isNullTag.m
│ │ ├── findNodeFromRobotRoot.m
│ │ ├── compareURDF.m
│ │ ├── readXML.m
│ │ └── writeToURDFFile.m
│ ├── Axis.m
│ ├── Builder.m
│ ├── Component.m
│ ├── Geometry.m
│ ├── Collision.m
│ ├── Inertial.m
│ ├── Joint.m
│ ├── Link.m
│ ├── Material.m
│ ├── Origin.m
│ ├── Robot.m
│ ├── URDFTag.m
│ └── Visual.m
├── LICENSE
└── minion.mlx
- Robot: Main container class for the URDF model
- Component: Reusable component class for component assemblies
- Link: Represents physical elements of the robot
- Joint: Base class for all joint types
- Visual: Adds a visual element to a link
- Collision: Adds a collision element to a link
- Geometry: Handles visual representation
- Origin: Manages spatial transformations
- URDFTag: Base class providing XML functionality
Before getting started with robotBuilder_matlab, ensure your runtime environment meets the following requirements:
- Programming Language: MATLAB
- Tools: MATLAB (Version R2023b and Above)
- Clone the repository:
git clone https://github.com/artineering/robotBuilder_matlab.git
- Add the project directory to your MATLAB path:
addpath('/path/to/robotBuilder_matlab');
% Initialize a new robot
robot = urdf.Robot('my_robot');
% Add a base link
base_link = urdf.Link('base_link');
robot.addLink(base_link);
% Add a joint
joint = urdf.joints.Revolute('joint1', 'base_link', 'link1', -pi/2, pi/2, 100, 1);
robot.addJoint(joint);
% Write to file
urdf.util.writeToURDFFile(robot, 'my_robot.urdf');
% Read from file
robot_node = urdf.util.readXML('existing_robot.urdf');
robot = urdf.Robot.buildFromURDF(robot_node);
% Create main robot instance
robot = urdf.Robot('test_robot');
% Create arm component
arm = urdf.Component('arm');
base = urdf.Link('base');
upperArm = urdf.Link('upper_arm');
forearm = urdf.Link('forearm');
% Add geometry with parameterized dimensions
cylinderBase = urdf.shapes.Cylinder(0,0);
base.addVisual(cylinderBase);
% Add joints with parameterized properties
shoulder = urdf.joints.Revolute('shoulder', 'base', 'upper_arm', ...
-pi/2, pi/2, 0,0);
elbow = urdf.joints.Revolute('elbow', 'upper_arm', 'forearm', ...
-pi/2, pi/2, 0,0);
% Add components to arm
arm.addLink(base);
arm.addLink(upperArm);
arm.addLink(forearm);
arm.addJoint(shoulder);
arm.addJoint(elbow);
% Define the parameters
arm.addParameter('radius', 2, 'base.visual.geometry.cylinder.radius');
arm.addParameter('length', 2, 'base.visual.geometry.cylinder.length');
% Add left arm instance to the robot
left_params = struct;
left_params.radius = 5;
left_params.length = 10;
robot = arm.createInstance(robot, 'left_arm', left_params);
% Add right arm instance to the robot
right_params = struct;
right_params.radius = 5;
right_params.length = 10;
robot = arm.createInstance(robot, 'right_arm', right_params);
% View the robot urdf structure
robot.serialize
- 💬 Join the Discussions: Share your insights, provide feedback, or ask questions.
- 🐛 Report Issues: Submit bugs found or log feature requests for the
robotBuilder_matlab
project. - 💡 Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/artineering/robotBuilder_matlab
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
If you use this software in your research, please cite:
@software{robotbuilder_matlab,
title={MATLAB URDF Builder},
author={Siddharth Vaghela},
year={2024},
url={https://github.com/artineering/robotBuilder_matlab}
}