ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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}" /> <circle circumference="${2 * pi * R}" pos="${sin(alpha)} ${cos(alpha)}" />
2 | No.2 Revision |
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}" /> <circle circumference="${2 * pi * R}" pos="${sin(alpha)} ${cos(alpha)}" />
You might be interested in the ROS xacro tutorial