track_ik's IK function fails and doesn't go into exception
Hi,
If I call IK
function in a program with wrong frame name as argument (for example tol_changer
not tool_changer
) I want back error, and not that whole program is terminated..
Code:
#!/usr/bin/env python
import rospy
from trac_ik_python.trac_ik import IK
rospy.init_node('test_script')
try:
urdf = rospy.get_param("/ur10_2/robot_description")
ik_solver = IK("base",
"tol_changer",
urdf_string=urdf)
rospy.loginfo("Sucess")
except:
rospy.logerr("Fail")
This code never goes to except
because it's always terminated by IK
:
Couldn't find chain base to tol_changer
terminate called after throwing an instance of 'ros::TimeNotInitializedException'
what(): Cannot use ros::Time::now() before the first NodeHandle has been created or ros::start() has been called. If this is a standalone app or test that just uses ros::Time and does not communicate over ROS, you may also call ros::Time::init()
Aborted (core dumped)
I have already tried first initializing node and then importing IK
as recommended here (altho I'm using ROS Kinetic) but it didn't work.
It works perfectly if tip frame name is correct. It also goes into exception if I put in wrong URDF name (as expected). Any ideas how I would fix that?