ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I would recommend either using the ros1 xacro (a bit clanky in my opinion) or to use some templating language like Jinja2 or empy, both of which are independent of ros/ros2. The advantages of using jinja2 or empy are that you can specify templates with parameters, and then use those templates as many times as you want. You can also include other template files into a new template.

Using a robotic arm for example, you could create a single "segment" template that creates a hing, with a rigid arm on the other end. The "segment" template would need to be parameterized such that you can specify where to attach the hing, and how long the segment is, etc. Then you can create a new "Arm" template that pulls in multiple "segment" templates to build up a arm with several segments.

Once you have a template, you can write a python script that renders the urdf, and spits it out to be spawned by gazebo.