Trying to use Costmap2DROS: mutex lock failed
Hello,
I'm trying to use an instance of Costmap2DRos
in my code, but whenever I execute it, I get this error message:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
what(): boost: mutex lock failed in pthread_mutex_lock: Invalid argument
My code basically looks like this:
class MyClass
{
public:
MyClass() : costmapRos_("costmap", tfl_) {}
private:
costmap_2d::Costmap2DROS costmapRos_;
tf::TransformListener tfl_;
};
When the constructor gets called, the above error occurs.
I also tried debugging it with gdb. When I hadn't compiled my code in Debug mode, It told me that the error occurs when calling the constructor of Costmap2DROS
. After that, I compiled it in Debug mode. Since then, I only get this output:
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed interminal_inferior: Inappropriate ioctl for device]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[New Thread 0x7fffee61c700 (LWP 11810)]
[New Thread 0x7fffede1b700 (LWP 11811)]
[New Thread 0x7fffed61a700 (LWP 11812)]
[New Thread 0x7fffece19700 (LWP 11813)]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
I'm using ROS Kinetic and I'm running Ubuntu 16.04.3 LTS (64-bit), with kernel 4.4.0-97.
Does anybody have an idea why this could be happening? Am I missing something that I should do or that I'm doing wrong?
Edit:
I executed it once more with gdb running and now I also got the error output from above and could get the backtrace. As my code is different from the easy version from above, I start where the costmap code is executed.
#0 0x00007ffff59bd428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff59bf02a in __GI_abort () at abort.c:89
#2 0x00007ffff630084d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff62fe6b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff62fe701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff62fe919 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff78a754a in void boost::throw_exception<boost::lock_error>(boost::lock_error const&) ()
from /opt/ros/kinetic/lib/libcostmap_2d.so
#7 0x00007ffff733045f in boost::unique_lock<boost::mutex>::lock() () from /opt/ros/kinetic/lib/libroscpp.so
#8 0x00007ffff4148cc1 in tf2::BufferCore::canTransform(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::Time const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const ()
from /opt/ros/kinetic/lib/libtf2.so
#9 0x00007ffff43a6f94 in tf2_ros::Buffer::canTransform(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::Time const&, ros::Duration, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const ()
from /opt/ros/kinetic/lib/libtf2_ros.so
#10 0x00007ffff7645aaf in tf::Transformer::waitForTransform(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const ...