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

With ROS2 a 2 is missing in the called lib name #1

Open
torydebra opened this issue Nov 14, 2024 · 2 comments
Open

With ROS2 a 2 is missing in the called lib name #1

torydebra opened this issue Nov 14, 2024 · 2 comments

Comments

@torydebra
Copy link
Member

The problem I have here is that with ROS2, the robot interface fails to load the librobotinterface2, since it looks for librobotinterface2_ros.so, while the library is called librobotinterface2_ros2.so (so Cartesio run in the "visual_only" mode)

For now I have solved with std::string robot_type = "ros2"; which I imagine would cause the dual problem with ROS1.

std::string robot_type = "ros";
opt.get_parameter("robot_type", robot_type);
bool ignore_type_from_env = false;
opt.get_parameter("ignore_type_from_env", ignore_type_from_env);
const char * robot_type_env = getenv("XBOT2IFC_ROBOT_TYPE");
if(robot_type_env && !ignore_type_from_env)
{
robot_type = robot_type_env;
}
auto rob = CallFunction<RobotInterface*>(
"librobotinterface2_" + robot_type + ".so",
"xbot2_create_robot_plugin_" + robot_type,
std::move(mdl)
);

I do not know which is the exact intention, and if an external arg is necessary, since in the ros2 folder the cpp/hpp are called robotinterface2_ros (without the 2 suffix), but then in the cmake the name is robotinterface2_ros2

@alaurenzi

@alaurenzi
Copy link
Contributor

I'd say that the intention is to have a default value that is good for ros2 (and so your fix is correct), and then have the possibility to change it via (i) env variable as you see in the code, or (ii) the config options class (opt.set_parameter<std::string>("robot_type", "whatever"))

You can open a small PR with the fix!

@torydebra
Copy link
Member Author

Ok, now I see, with that getenv we could set the variable in the cmake acording to the ros/ros2 compilation flags.

BTW, I do not know what happened, but since today it is ok even without my hardcoded modification. It seems that now it looks for librobotinterface2_xbot2rt.so which is present and gives no problem at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants