ChainIkSolverPos_NR_JL::CartToJnt seg fault

Hi all,

I get a segfault running the ChainIkSolverPos_NR_JL::CartToJnt() function.

I have no idea where the error could come from, when I run the code
through gdb, the program just crashes when I call the function
CartToJnt(), but I didn't manage to get any useful information. The
complete backtrace is below.

Any ideas?

Cheers,

Ugo

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb3efdb70 (LWP 24671)]
0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
const&, KDL::Frame const&, KDL::JntArray&) ()
from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
(gdb) backtrace
#0 0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
const&, KDL::Frame const&, KDL::JntArray&) ()
from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
#1 0x0808f59d in shadowhand::SrKinematics::computeReverseKinematics (
this=0xb4f01610, transform=..., joints=...)
at
/home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow_robot/sr_hand/src/sr_kinematics.cpp:179
#2 0x080757c6 in
shadowhand_subscriber::ShadowhandSubscriber::reverseKinematicsCallback
(this=0x814f4b0, msg=...)
at
/home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow_robot/sr_hand/src/sr_subscriber.cpp:163
#3 0x0807ef45 in
boost::detail::function::void_function_obj_invoker1<boost::function ()(boost::shared_ptr const&)>, void, boost::shared_ptr<tf::tfMessage_ const> >::invoke(boost::detail::function::function_buffer&,
boost::shared_ptr<tf::tfMessage_ #4 0x080815b0 in
ros::SubscriptionCallbackHelperT<boost::shared_ptr > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&) ()
#5 0x027d0a4d in ros::SubscriptionQueue::call (this=0xb4f10378)
at
/opt/ros/cturtle/ros/core/roscpp/src/libros/subscription_queue.cpp:164
#6 0x02814aea in ros::CallbackQueue::callOneCB (this=0x812bea0,
tls=0x814ed40)
at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:381
---Type <return> to continue, or q <return> to quit---
#7 0x028151df in ros::CallbackQueue::callAvailable (this=0x812bea0,
timeout=...)
at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:333
#8 0x027a1a2b in ros::spinOnce ()
at /opt/ros/cturtle/ros/core/roscpp/src/libros/init.cpp:498
#9 0x08070e7f in shadowhand_publisher::ShadowhandPublisher::publish (
this=0x8138910)
at
/home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow_robot/sr_hand/src/sr_publisher.cpp:119
#10 0x080868de in run_publisher (shadowhand_pub=DWARF-2 expression
error: DW_OP_reg operations must be used either alone or in conjuction
with DW_OP_piece.
)
at
/home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow_robot/sr_hand/src/hand/virtual_arm_node.cpp:49
#11 0x08089193 in boost::detail::thread_data<boost::_bi::bind_t void (*)(boost::shared_ptr boost::_bi::list1<boost::_bi::value > > > >::run() ()
#12 0x028ca7c5 in thread_proxy () from /usr/lib/libboost_thread.so.1.40.0
#13 0x0148196e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#14 0x02ccea4e in clone () from /lib/tls/i686/cmov/libc.so.6

Ruben Smits's picture

ChainIkSolverPos_NR_JL::CartToJnt seg fault

On Monday 20 September 2010 18:20:17 Ugo Cupcic wrote:
> Hi all,
>
> I get a segfault running the ChainIkSolverPos_NR_JL::CartToJnt() function.
>
> I have no idea where the error could come from, when I run the code
> through gdb, the program just crashes when I call the function
> CartToJnt(), but I didn't manage to get any useful information. The
> complete backtrace is below.

Can you compile kdl with debug information and send us a new backtrace, which
will hopefully help us find the bug.

Ruben

> Any ideas?
>
> Cheers,
>
> Ugo
>
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb3efdb70 (LWP 24671)]
> 0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
> const&, KDL::Frame const&, KDL::JntArray&) ()
> from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
> (gdb) backtrace
> #0 0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
> const&, KDL::Frame const&, KDL::JntArray&) ()
> from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
> #1 0x0808f59d in shadowhand::SrKinematics::computeReverseKinematics (
> this=0xb4f01610, transform=..., joints=...)
> at
> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
> _robot/sr_hand/src/sr_kinematics.cpp:179 #2 0x080757c6 in
> shadowhand_subscriber::ShadowhandSubscriber::reverseKinematicsCallback
> (this=0x814f4b0, msg=...)
> at
> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
> _robot/sr_hand/src/sr_subscriber.cpp:163 #3 0x0807ef45 in
> boost::detail::function::void_function_obj_invoker1<boost::function > ()(boost::shared_ptr<tf::tfMessage_ > const&)>, void, boost::shared_ptr<tf::tfMessage_ > const> >::invoke(boost::detail::function::function_buffer&,
> boost::shared_ptr<tf::tfMessage_ > #4 0x080815b0 in
> ros::SubscriptionCallbackHelperT<boost::shared_ptr > cator<void>
>
> > const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&) ()
>
> #5 0x027d0a4d in ros::SubscriptionQueue::call (this=0xb4f10378)
> at
> /opt/ros/cturtle/ros/core/roscpp/src/libros/subscription_queue.cpp:164
> #6 0x02814aea in ros::CallbackQueue::callOneCB (this=0x812bea0,
> tls=0x814ed40)
> at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:381
> ---Type <return> to continue, or q <return> to quit---
> #7 0x028151df in ros::CallbackQueue::callAvailable (this=0x812bea0,
> timeout=...)
> at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:333
> #8 0x027a1a2b in ros::spinOnce ()
> at /opt/ros/cturtle/ros/core/roscpp/src/libros/init.cpp:498
> #9 0x08070e7f in shadowhand_publisher::ShadowhandPublisher::publish (
> this=0x8138910)
> at
> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
> _robot/sr_hand/src/sr_publisher.cpp:119 #10 0x080868de in run_publisher
> (shadowhand_pub=DWARF-2 expression error: DW_OP_reg operations must be
> used either alone or in conjuction with DW_OP_piece.
> )
> at
> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
> _robot/sr_hand/src/hand/virtual_arm_node.cpp:49 #11 0x08089193 in
> boost::detail::thread_data<boost::_bi::bind_t > (*)(boost::shared_ptr<shadowhand_publisher::ShadowhandPublisher>),
> boost::_bi::list1<boost::_bi::value > ::ShadowhandPublisher>
>
> > > > >::run() ()
>
> #12 0x028ca7c5 in thread_proxy () from /usr/lib/libboost_thread.so.1.40.0
> #13 0x0148196e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
> #14 0x02ccea4e in clone () from /lib/tls/i686/cmov/libc.so.6

ChainIkSolverPos_NR_JL::CartToJnt seg fault

Hi,

I think I just found my problem: my fk solver and ik velocity solver
where out of scope before the ChainIkSolverPos_NR_JL->CartToJnt()
function was used. (see below if I was unclear)

Sorry about that. I thought both the solvers where copied. My bad.

Cheers,

Ugo

e.g.
Class::Constructor
{
KDL::ChainFkSolverPos_recursive fk_solver_chain;
KDL::ChainIkSolverVel_pinv ik_solver_vel;
....
g_ik_solver = boost::shared_ptr<KDL::ChainIkSolverPos_NR_JL>(new
KDL::ChainIkSolverPos_NR_JL(chain, q_min, q_max, fk_solver_chain,
ik_solver_vel, 1000, 1e-2));
...
}

function
{
...
if( g_ik_solver->CartToJnt(q_init, destination_frame, q) < 0 )
...
}

On 20/09/10 18:31, Ruben Smits wrote:
> On Monday 20 September 2010 18:20:17 Ugo Cupcic wrote:
>> Hi all,
>>
>> I get a segfault running the ChainIkSolverPos_NR_JL::CartToJnt() function.
>>
>> I have no idea where the error could come from, when I run the code
>> through gdb, the program just crashes when I call the function
>> CartToJnt(), but I didn't manage to get any useful information. The
>> complete backtrace is below.
> Can you compile kdl with debug information and send us a new backtrace, which
> will hopefully help us find the bug.
>
> Ruben
>
>> Any ideas?
>>
>> Cheers,
>>
>> Ugo
>>
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb3efdb70 (LWP 24671)]
>> 0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
>> const&, KDL::Frame const&, KDL::JntArray&) ()
>> from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
>> (gdb) backtrace
>> #0 0x0232cd7c in KDL::ChainIkSolverPos_NR_JL::CartToJnt(KDL::JntArray
>> const&, KDL::Frame const&, KDL::JntArray&) ()
>> from /opt/ros/cturtle/stacks/geometry/kdl/lib/liborocos-kdl.so.1.0
>> #1 0x0808f59d in shadowhand::SrKinematics::computeReverseKinematics (
>> this=0xb4f01610, transform=..., joints=...)
>> at
>> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
>> _robot/sr_hand/src/sr_kinematics.cpp:179 #2 0x080757c6 in
>> shadowhand_subscriber::ShadowhandSubscriber::reverseKinematicsCallback
>> (this=0x814f4b0, msg=...)
>> at
>> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
>> _robot/sr_hand/src/sr_subscriber.cpp:163 #3 0x0807ef45 in
>> boost::detail::function::void_function_obj_invoker1<boost::function >> ()(boost::shared_ptr<tf::tfMessage_ >> const&)>, void, boost::shared_ptr<tf::tfMessage_ >> const> >::invoke(boost::detail::function::function_buffer&,
>> boost::shared_ptr<tf::tfMessage_ >> #4 0x080815b0 in
>> ros::SubscriptionCallbackHelperT<boost::shared_ptr >> cator<void>
>>
>>> const> const&, void>::call(ros::SubscriptionCallbackHelperCallParams&) ()
>> #5 0x027d0a4d in ros::SubscriptionQueue::call (this=0xb4f10378)
>> at
>> /opt/ros/cturtle/ros/core/roscpp/src/libros/subscription_queue.cpp:164
>> #6 0x02814aea in ros::CallbackQueue::callOneCB (this=0x812bea0,
>> tls=0x814ed40)
>> at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:381
>> ---Type <return> to continue, or q <return> to quit---
>> #7 0x028151df in ros::CallbackQueue::callAvailable (this=0x812bea0,
>> timeout=...)
>> at /opt/ros/cturtle/ros/core/roscpp/src/libros/callback_queue.cpp:333
>> #8 0x027a1a2b in ros::spinOnce ()
>> at /opt/ros/cturtle/ros/core/roscpp/src/libros/init.cpp:498
>> #9 0x08070e7f in shadowhand_publisher::ShadowhandPublisher::publish (
>> this=0x8138910)
>> at
>> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
>> _robot/sr_hand/src/sr_publisher.cpp:119 #10 0x080868de in run_publisher
>> (shadowhand_pub=DWARF-2 expression error: DW_OP_reg operations must be
>> used either alone or in conjuction with DW_OP_piece.
>> )
>> at
>> /home/ugo/Projects/ROS_interfaces/sr-ros-interface/reverse-kinematic/shadow
>> _robot/sr_hand/src/hand/virtual_arm_node.cpp:49 #11 0x08089193 in
>> boost::detail::thread_data<boost::_bi::bind_t >> (*)(boost::shared_ptr<shadowhand_publisher::ShadowhandPublisher>),
>> boost::_bi::list1<boost::_bi::value >> ::ShadowhandPublisher>
>>
>>>>>> ::run() ()
>> #12 0x028ca7c5 in thread_proxy () from /usr/lib/libboost_thread.so.1.40.0
>> #13 0x0148196e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
>> #14 0x02ccea4e in clone () from /lib/tls/i686/cmov/libc.so.6