0

Rosanswers logo

We want to use the value of pi in an URDF file, since we have to rotate a model by 90 degrees. Is there any builtin macro for pi in URDF? At the moment we are simply using our own M_PI macro, but it would be nice to know what the intended way of doing such a thing would be.


Originally posted by MatthiasLoebach on ROS Answers with karma: 13 on 2017-11-30

Post score: 1

1 Answers1

0

Rosanswers logo

You can do this with xacro (a XML macro language): http://wiki.ros.org/xacro

From section 3. Math Expression

Since ROS Jade, Xacro employs python to evaluate expressions enclosed in dollared-braces (${}). > This allows for more complex > arithmetic expressions. Also, **some > basic constants, e.g. pi, are already > predefined**: > > <xacro:property name="R" value="2" /> > <xacro:property name="alpha" value="${30/180*pi}" />


You might be interested in the ROS xacro tutorial


Originally posted by josephcoombe with karma: 697 on 2017-11-30

This answer was ACCEPTED on the original site

Post score: 8