O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

To begin with xacro, we have to specify a namespace so that the file is parsed properly, as shown in the following code snippet:

<?xml version="1.0"?> 
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="mobile">

We must remember that the file must have an xacro extension in place of URDF:

  1. Constants:
    • We can use xacro to declare constant values, just like we do in any other programming language. For example, in the case of the mobile robot which has four wheels with the same values for length and radius, this can be declared and defined as follows:
<xacro:property name="length_wheel" value="0.05" /> 
<xacro:property name="radius_wheel" value="0.05" /> 
    • These values can be used in the following ways, later in the code: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required