gkjohnson / xacro-parser

Utility for parsing and converting ROS Xacro files in Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

roll=0.0 param fails to parse

jhurliman opened this issue · comments

The following line:

<xacro:macro name="stack_bottom_pole" params="parent number x_loc y_loc z_loc roll=0.0 pitch=0.0 yaw=0.0">

from https://github.com/turtlebot/turtlebot/blob/melodic/turtlebot_description/urdf/stacks/hexagons.urdf.xacro#L13 fails to parse correctly. The =0.0 is treated as part of the parameter name instead of a default value.

Hello! Thanks for the report. From the xacro documentation it seemed to be that only the := syntax was mentioned but looking at some of the official tests and your file it seems that = is valid, as well, and should behave the same. Would you like to make a PR with a fix? If I recall correctly it seems only the parseMacroParam function would have to change.

I think a full fix would include the following:

  • Update the parseMacroParam function to support "=" default parameters.
  • Add a test (or possibly just enable this one) to test default macro params using =.
  • Add a small section to the Undocumented Xacro Behavior section describing that := and = are the same for Macro default parameters.

Thanks again!

PR created at #73, thanks for the guidance!