Skip to content
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

Bug in referencing ROS2 package paths in xml #207

Closed
Serafadam opened this issue Jun 17, 2020 · 3 comments · Fixed by #351
Closed

Bug in referencing ROS2 package paths in xml #207

Serafadam opened this issue Jun 17, 2020 · 3 comments · Fixed by #351
Assignees
Labels
bug Something isn't working

Comments

@Serafadam
Copy link

Serafadam commented Jun 17, 2020

Hi, I think I've found a bug, in ROS2 version of package, for xml referencing ros1 version of package searching is used, in ROS2 it's ament_index_cpp::get_package_share_directory instead of ros::package::getPath as per https://answers.ros.org/question/288501/ros2-equivalent-of-rospackagegetpath/

auto ros_pkg_path = ros::package::getPath( include_node->Attribute("ros_pkg") );

Edit: Also, I have some problems when including files with relative paths, for example to the previous directory ../tree_that_i_want_to_include.xml

On a side note, is there a plan to release newest version of the code in ROS Dashing?

@facontidavide
Copy link
Collaborator

thanks. I will have a look at it

@facontidavide facontidavide self-assigned this Jun 17, 2020
@facontidavide facontidavide added the bug Something isn't working label Jun 17, 2020
@asasine
Copy link
Contributor

asasine commented Apr 23, 2021

I'm not sure this bug would be hit since USING_ROS isn't defined when building with ament

if ( ament_cmake_FOUND )
# Not adding -DUSING_ROS since xml_parsing.cpp hasn't been ported to ROS2

Using the ros_pkg attribute would cause a runtime error in that case since #ifdef USING_ROS doesn't pass and #else is called

#ifdef USING_ROS
if( file_path.is_absolute() )
{
std::cout << "WARNING: <include path=\"...\"> containes an absolute path.\n"
<< "Attribute [ros_pkg] will be ignored."<< std::endl;
}
else {
auto ros_pkg_path = ros::package::getPath( include_node->Attribute("ros_pkg") );
file_path = filesystem::path( ros_pkg_path ) / file_path;
}
#else
throw RuntimeError("Using attribute [ros_pkg] in <include>, but this library was compiled "
"without ROS support. Recompile the BehaviorTree.CPP using catkin");
#endif

@asasine
Copy link
Contributor

asasine commented Apr 8, 2022

Edit: Also, I have some problems when including files with relative paths, for example to the previous directory ../tree_that_i_want_to_include.xml

@Serafadam I've encountered the same issue and started #324 to track it. I think I found a resolution and created #358, a review from a maintainer would be good since it does change the existing behavior of tree inclusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants