-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade from tinyxml to tinyxml2 #186
Conversation
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/upcoming-api-break-in-urdfdom/34750/1 |
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
I think we also need to modify the following line to change the reference to urdfdom/cmake/urdfdom-config.cmake.in Line 6 in 6d3c5de
|
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
bcdaba7
to
2f45917
Compare
@traversaro You read my mind with almost all of your feedback; I've addressed most of it in 2f45917 and 06a18de. As for your comment in #186 (comment) ; if you'd just like to post a diff of what you are thinking about here, I'm happy to merge it in. |
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
14fe181
to
f2a2ce5
Compare
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Actually my comment was a bit outdated by your changes. I updated the modifications in felixf4xu#2, basically if |
Ok, this is partially outdated by 2383a0a . Adding |
The former doesn't exist in older TinyXML2, and is just a convenience function anyway. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
I've merged in felixf4xu#2 to this PR, though I'm not totally convinced by the |
@traversaro Relatedly, do you have a link to a non-ROS package that uses urdfdom? I'd like to have something concrete to test against. |
Probably a quite relevant example of such package may be sdformat (https://github.com/gazebosim/sdformat). |
Yes, that is correct. In the corrent form, this works:
However, it does not work with Ubuntu with apt dependencies, where libtinyxml2-dev package does not contain any |
Use the provided CMake primitives for this, which should make it work in all situations. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
With an assist from @sloretz , I updated this PR with b592bbd, which generates the necessary config file changes. I can't make this fail in any situation now; it always seems to do the right thing for me. But any additional testing @traversaro is much appreciated. |
Thanks! I will check this tomorrow (European) morning. |
Ok, I reproduced the problem I was referring to in earlier messages (with the example project https://gist.github.com/traversaro/c79f69e2fe5e0d2b7c1405ee973c2058, tested on Ubuntu 22.04 with apt dependencies): sudo apt install build-essential libtinyxml2-dev liburdfdom-headers-dev
mkdir -p urdfdom_ws/src
cd urdfdom_ws/src
git clone -b tinyxml2 https://github.com/felixf4xu/urdfdom/
git clone https://gist.github.com/traversaro/c79f69e2fe5e0d2b7c1405ee973c2058 urdfdom_test
cd ..
colcon build this fails with:
It turns out that sdformat is not actually a great example to see this problem, as it also uses tinyxml2 internally, and so in that case |
Ah, thanks for that. I didn't see this problem because, while I did an extremely similar test yesterday, I did it on Fedora 38. And there, the In any case, we should fix this, so I'll look at installing the FindTinyXML2.cmake file as we discussed earlier. |
This is so downstream projects can always find it. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
All right, 0e61d1f should fix that particular problem. I have a few other tests to run on it (like on ROS 2), but another look here is much appreciated. |
Probably also fedora switched to build tinyxml2 via cmake like done in conda-forge. |
It seems fine. I did a small suggestion to reduce the risk of conflict shadowing with other installed |
So we don't permanently manipulate it. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
URDFDOM_DLLAPI bool parseSensor(Sensor&, TiXmlElement*); | ||
URDFDOM_DLLAPI bool parseModelState(ModelState&, TiXmlElement*); | ||
URDFDOM_DLLAPI tinyxml2::XMLDocument* exportURDF(ModelInterfaceSharedPtr &model); | ||
URDFDOM_DLLAPI tinyxml2::XMLDocument* exportURDF(const ModelInterface &model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just remembered that we had planned some changes to the public API in #178 so that tinyxml2.h
wouldn't need to be included from this header file. We can address those in a separate pull request, so that this is a cleaner tinyxml -> tinyxml2 replacement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an issue for this: #189
All right. With the latest reviews, I'm going to go ahead and merge this one. There is some follow-up work to do here, so I'm not going to do the 4.0.0 release right now, but I'll keep it on my list to do in the next couple of weeks. @felixf4xu Thanks for getting this started, @traversaro thanks for the feedback, and @scpeters thanks for the review! |
* upgrade from tinyxml to tinyxml2 * Remove 'using tinyxml2' * Update github actions. * Add in FindTinyXML2 for systems that don't have it. * Make sure that tinyxml2::tinyxml2 is available in downstream packages * Update urdfdom-config.cmake.in * Replace InsertNewChildElement with GetDocument()->NewElement. The former doesn't exist in older TinyXML2, and is just a convenience function anyway. * Fix generation of CMake config files. Use the provided CMake primitives for this, which should make it work in all situations. * Install the FindTinyXML2.cmake file. This is so downstream projects can always find it. * Backup and restore the CMAKE_MODULE_PATH. So we don't permanently manipulate it. Signed-off-by: Chris Lalancette <clalancette@gmail.com> Co-authored-by: Silvio Traversaro <silvio@traversaro.it> Signed-off-by: harleylara <harley.lara@outlook.com>
my attempt to address the issue #185