tf::StampedTransform Throws Segfault
Hello all, I am attempting the following:
class Durp { tf::TransformListener _tfListener; tf::StampedTransform * saveMyTransform; Durp() : saveMyTransform(NULL) { Nodehandle n; someSub = n.sub(bla bla bla &callback); } ~Durp() { if(saveMyTransform!=NULL) delete saveMyTransform } void callback(geo_msgs::StampedPoint incPoint) { tf::StampedTransform tempTransform; //<---- SEGFAULT FOR NO REASON try { if(saveMyTransform == NULL) { saveMyTransform = new tf::StampedTransform(); _tfListener.lookupTransform("bla", "bla2", ros::Time(0), *saveMyTransform); // ^^ Segfaults if I comment out tf::StampedTransform tempTransform above } transform things.... } catch bllaaaa } };
Could someone please shed some light on what I am doing wrong. I would sincerely appreciate, I am ripping my hair out.
Segfault for StampedTransform tempTransform dump:
0x00007fffeba92116 in std::basic_string<char, std::char_traits<char="">, std::allocator<char> >::~basic_string() () from /usr/lib/libstdc++.so.6 (gdb) bt #0 0x00007fffeba92116 in std::basic_string<char, std::char_traits<char="">, std::allocator<char> >::~basic_string() () from /usr/lib/libstdc++.so.6 #1 0x000000000041d321 in ~StampedTransform (this=0x7fffd4f7b2b0, __in_chrg=<value optimized="" out="">) at /opt/ros/electric/stacks/geometry/tf/include/tf/transform_datatypes.h:89 #2 0x00007fffee75421a in tf::Transformer::setTransform (this=<value optimized="" out="">, transform=<value optimized="" out="">, authority=<value optimized="" out="">) at /tmp/buildd/ros-electric-geometry-1.6.1/debian/ros-electric-geometry/opt/ros/electric/stacks/geometry/tf/src/tf.cpp:438 #3 0x00007fffee7670a5 in tf::TransformListener::subscription_callback (this=<value optimized="" out="">, msg=<value optimized="" out="">) at /tmp/buildd/ros-electric-geometry-1.6.1/debian/ros-electric-geometry/opt/ros/electric/stacks/geometry/tf/src/transform_listener.cpp:326 #4 0x00007fffee76d1ab in boost::function1<void, boost::shared_ptr<tf::tfmessage_<std::allocator<void=""> > const> const&>::operator() (function_obj_ptr=<value optimized="" out="">, a0=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. ) at /usr/include/boost/function/function_template.hpp:1013 #5 boost::detail::function::void_function_obj_invoker1<boost::function<void ()(boost::shared_ptr<tf::tfmessage_<std::allocator<void=""> > const> const&)>, void, boost::shared_ptr<tf::tfmessage_<std::allocator<void> > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<tf::tfmessage_<std::allocator<void> > const>) (function_obj_ptr=<value optimized="" out="">, a0=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece. ) at /usr/include/boost/function/function_template.hpp:153 #6 0x00007fffee770890 in boost::function1<void, boost::shared_ptr<tf::tfmessage_<std::allocator<void=""> > const> >::operator() (this=0x7fffd0000a70, params=<value optimized="" out="">) at /usr/include/boost/function/function_template.hpp:1013 #7 ros::SubscriptionCallbackHelperT<boost::shared_ptr<tf::tfmessage_<std::allocator<void> > const> const&, void>::call (this=0x7fffd0000a70, params=<value optimized="" out="">) at /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/subscription_callback_helper.h:180
Backtrace of when I pass my dynamically allocated Transform in
0 0x00007fffeba921fd in std::string::assign(std::string const&) () from /usr/lib/libstdc++.so.6 #1 0x00007fffee75581e in std::string::operator= (this=<value optimized="" out="">, target_frame=<value optimized="" out="">, source_frame=<value optimized="" out="">, time=..., transform=...) at /usr/include/c++/4.4/bits/basic_string.h:506 #2 tf::Transformer::lookupTransform (this=<value optimized="" out="">, target_frame=<value optimized="" out="">, source_frame=<value optimized="" out="">, time=..., transform=...) at /tmp/buildd/ros-electric-geometry-1.6.1/debian/ros-electric-geometry/opt/ros/electric/stacks/geometry/tf/src/tf.cpp:483 #3 0x0000000000439494 in RaveServer::displayWaypoint ...