Using properties

Using xacro, we can declare constants or properties that are the named values inside the xacro file, which can be used anywhere in the code. The main use of these constant definitions is, instead of giving hardcoded values on links and joints, we can keep constants, and it will be easier to change these values rather than finding the hardcoded values and replacing them.

An example of using properties is given here. We declare the base link and the pan link's length and radius. So, it will be easy to change the dimension here rather than changing the values in each one:

 <xacro:property name="base_link_length" value="0.01" /> <xacro:property name="base_link_radius" value="0.2" /> <xacro:property name="pan_link_length" value="0.4" ...

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.