-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use ros::Time::now() before the first NodeHandle has been created or ros::start() has been called. #30
Comments
I have tried it in
So it looks that the tf is using tf2 and the problem is somewhere there. |
This is a reoccurance of this patched issue: 70defb1 |
The cleaner solution is to use the python tf2 buffer class. |
Actually a problem in tf2_ros fixed here: ros/geometry2@5e41627 |
Can You post a simple example how to get transformation from the tf2, I have tried all tutorial I could found and none of the worked. |
@liborw not sure if you still need this, but here's a simple example for tf2 in python: #!/usr/bin/env python
import sys
import rospy
import math
import tf2_ros
import turtlesim.msg
import turtlesim.srv
rospy.init_node('tf_turtle')
buf = tf2_ros.Buffer()
listener = tf2_ros.TransformListener(buf)
# wait a second for frames to accumulate. buf.lookup_transform seems to fail immediately if it hasn't yet
# gotten any transfroms for the 'odom' frame, instead of waiting for the timeout
rospy.sleep(1.0)
try:
tform = buf.lookup_transform('odom', 'base_link', rospy.Time(0), timeout=rospy.Duration(4))
except (tf2_ros.LookupException, tf2_ros.ConnectivityException, tf2_ros.ExtrapolationException) as e:
print e
print 'Success'
print tform |
This helps a bit but what I missing is wait for transform. |
From my understanding, that should now be built into lookup_transform, which is why the "timeout" arg is passed in. |
However, this probably still doesn't work: This is the call:
And the error:
|
Yeah i've had that problem too. Seemed like a bug to me |
Is there a fix for this that doesn't involve shifting to tf2? |
…imeNotInitializedException. This will at least let things function, there are still issues with simtime not propogating inside correctly. fixes #30
There was a second issue with the sleep failing due to being uninitialized. I believe that I have fixed the issue here: 0a034c5 Can someone verify that this works for them? You will need to checkout geometry_experimental into your workspace from geometry_issue_30 branch. |
Awesome, it works for me, thanks for fixing it! The code at the very top wont work fyi, because waitForTransform returns None. So I tested it with this: #!/usr/bin/env python
import roslib; roslib.load_manifest('beginner_tutorials')
import rospy
import tf
import sys, traceback
if __name__ == '__main__':
rospy.init_node("test_tf_listener")
listener = tf.TransformListener()
try:
listener.waitForTransform('camera_link', 'camera_rgb_frame', rospy.Time(), rospy.Duration(5.0))
(trans, rot) = listener.lookupTransform('camera_link', 'camera_rgb_frame', rospy.Time())
print str(trans) + " " + str(rot)
except:
traceback.print_exc(file=sys.stdout) |
I got bitten by the same bug and i do not want to convert to tf2 now. So will the fix above be available soon in hydro? Or do I need to check out the branch? |
This change is in 0.4.8 It's available in the testing debian repo at the moment, but has not been synced to the public repo: http://www.ros.org/debbuild/hydro.html?q=geometry_experimental A sync can be expected in the next week or so. We've had a pattern of syncing approximately every 2 weeks. |
terminate called after throwing an instance of 'ros::TimeNotInitializedException' |
when I use roscpp function ros::init(argc,argv,"name") ,it report the up problem |
@loulansuiye This is a years closed issue for a completely different component in a different language. If you'd like some help please ask a question on answers.ros.org |
Under Hydro the following minimal example
result in this error:
The text was updated successfully, but these errors were encountered: