odio_urdf icon indicating copy to clipboard operation
odio_urdf copied to clipboard

creating new elements end tag does not match

Open BrentAChristensen opened this issue 1 year ago • 1 comments

When trying to create new elements the end tag sometimes does not match the start tag. If I create a new element named hardwareInterface, the end tag makes hardwareinterface. As you can see it made the entire word lower case. It appears the code is changing it to lower case. Also the transmission joint tag comes through as follows: <joint name="joint_1>. I tried a work around by creating my own elements, then I ran into the code making my end tag lower case.

BrentAChristensen avatar Apr 17 '23 23:04 BrentAChristensen

Hello, this issue is caused becuase of a small bug in the urdf generation where the explicitly named elements with element_name is overruled, for example in the case of a TransJoint. This line overrides the already mentioned name and simply reads the element name again, i.e., instead of reading it as joint, it reads it as transjoint, which causes the joint element to not close. This can be fixed by changing,

s +=" "*depth + "</" + type(self).__name__.lower() + ">\n"

to

s +=" "*depth + "</" + name + ">\n"

And to preserve the capitalisation of the tag of the hardwareInterface, youll need to simply make it into a named element by using the element_name argument.

Both of the issues are now fixed in the PR, which you can use if you still have the problem: https://github.com/hauptmech/odio_urdf/pull/17/commits/a8df303d42855bef2dc75dfcd34cc574cf3c168e

akhilsathuluri avatar Sep 12 '23 13:09 akhilsathuluri