ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is there way to run this specific ROS package built for ROS Kinetic on ROS Melodic?

asked 2021-11-09 03:38:53 -0500

shreyas1996 gravatar image

updated 2021-11-09 12:06:35 -0500

The package in question: RRT Path Planner ROS Plugin / Turtlebot .

I have tested this package on ROS Kinetic and works perfectly fine after solving some errors through the steps followed in the issues tab of the particular github repo.

But, I am trying to test it on ROS Melodic as that's what I am mainly working with and when I catkin_make. The following error appears:

/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc: In member function ‘std::pair<float, float> turtlebot_rrt::RRTPlanner::GetRandomPoint()’:
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:159:10: error: ‘random_device’ is not a member of ‘std’
std::random_device rd;
^~~~~~~~~~~~~
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:159:10: note: suggested alternative: ‘random_shuffle’
std::random_device rd;
^~~~~~~~~~~~~
random_shuffle
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:160:10: error: ‘mt19937’ is not a member of ‘std’
std::mt19937 gen(rd());
^~~~~~~
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:160:10: note: suggested alternatives:
In file included from /usr/include/boost/random.hpp:43:0,
from /home/shreyas/catkin_ws/src/turtlebot_rrt/include/turtlebot_rrt/turtlebot_rrt.h:62,
from /home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:37:
/usr/include/boost/random/mersenne_twister.hpp:624:61: note: ‘boost::random::mt19937’
11,0xffffffff,7,0x9d2c5680,15,0xefc60000,18,1812433253> mt19937;
^~~~~~~
/usr/include/boost/random/mersenne_twister.hpp:624:61: note: ‘boost::random::mt19937’
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:163:10: error: ‘uniform_real_distribution’ is not a member of ‘std’
std::uniform_real_distribution<> x(-map_width, map_width);
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:163:10: note: suggested alternative: ‘uniform_int_distribution’
std::uniform_real_distribution<> x(-map_width, map_width);
^~~~~~~~~~~~~~~~~~~~~~~~~
uniform_int_distribution
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:163:36: error: expected primary-expression before ‘>’ token
std::uniform_real_distribution<> x(-map_width, map_width);
^
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:163:38: error: ‘x’ was not declared in this scope
std::uniform_real_distribution<> x(-map_width, map_width);
^
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:164:10: error: ‘uniform_real_distribution’ is not a member of ‘std’
std::uniform_real_distribution<> y(-map_height, map_height);
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:164:10: note: suggested alternative: ‘uniform_int_distribution’
std::uniform_real_distribution<> y(-map_height, map_height);
^~~~~~~~~~~~~~~~~~~~~~~~~
uniform_int_distribution
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:164:36: error: expected primary-expression before ‘>’ token
std::uniform_real_distribution<> y(-map_height, map_height);
^
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:164:38: error: ‘y’ was not declared in this scope
std::uniform_real_distribution<> y(-map_height, map_height);
^
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:164:38: note: suggested alternative: ‘yn’
std::uniform_real_distribution<> y(-map_height, map_height);
^
yn
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:166:28: error: ‘gen’ was not declared in this scope
random_point.first = x(gen);
^~~
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc: In member function ‘std::vector<geometry_msgs::PoseStamped_<std::allocator > > turtlebot_rrt::RRTPlanner::BuildPlan(int, const PoseStamped&, const PoseStamped&)’:
/home/shreyas/catkin_ws/src/turtlebot_rrt/src/turtlebot_rrt.cc:394:34: error: ‘tf’ has not been declared
pos.pose.orientation = tf::createQuaternionMsgFromYaw(0);
^~
turtlebot_rrt/CMakeFiles/turtlebot_rrt.dir/build.make:62: recipe for target 'turtlebot_rrt/CMakeFiles/turtlebot_rrt.dir/src ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2021-11-09 10:46:07 -0500

aprotyas gravatar image

It looks like the compilation is not happening against the C++11 (or above) standard, even though the package's CMakeLists.txt file explicitly specifies the standard. Does your compiler support that standard?

Maybe adding this snippet after line 3 of the CMakeLists.txt file may help:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

edit flag offensive delete link more
1

answered 2021-11-09 12:28:37 -0500

osilva gravatar image

updated 2021-11-09 12:29:48 -0500

If the compiling with C++11 option doesn't work, you can always change the code slightly

For example for the first error:

Add #include <random> to turtlebot_rrt/src/turtlebot_rrt.cc

Below a reference:

https://en.cppreference.com/w/cpp/num...

It will be more tedious though, as you need to do for every error.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2021-11-09 03:38:29 -0500

Seen: 65 times

Last updated: Nov 09 '21