ROS 2 tf2 "Lookup would require extrapolation into the future", "into the past" and "target_frame does not exist"

ROS 2 tf2 “Lookup would require extrapolation into the future”, “into the past” and “target_frame does not exist”: lookup_transform timing, measured

Lookup would require extrapolation into the future.  Requested time 1793159231.232437 but the latest data is at time 1793159231.218410, when looking up transform from frame [base_link] to frame [odom]

The two related errors come from the same lookup call:

Lookup would require extrapolation into the past.  Requested time 1793159341.155947 but the earliest data is at time 1793159343.127506, when looking up transform from frame [base_link] to frame [odom]

"odom" passed to lookupTransform argument target_frame does not exist.

Short answer: if you pass self.get_clock().now() as the lookup time, the lookup fails every time. In my run it failed 1,800 out of 1,800 times, at 10, 50 and 100 Hz, on Humble, Jazzy and Lyrical. The newest transform in the buffer is always at least about 1 ms older than “now”, because it has to travel from the broadcaster to your listener first. Ask for the latest transform with rclpy.time.Time() (time 0), or keep the time you need and add a timeout:

from rclpy.time import Time
from rclpy.duration import Duration
from tf2_ros import TransformException

# Option 1: newest transform in the buffer, never waits
t = self.tf_buffer.lookup_transform('odom', 'base_link', Time())

# Option 2: transform at a specific time (a message stamp, or now), wait up to 0.1 s
try:
    t = self.tf_buffer.lookup_transform('odom', 'base_link', msg.header.stamp,
                                        timeout=Duration(seconds=0.1))
except TransformException as e:
    self.get_logger().warn(str(e))

Option 1 returned a transform 200 out of 200 times at every rate. Option 2 with now() also succeeded 100 out of 100 times, but each call blocked for 20 to 100 ms. A timeout only helps if something else is spinning the listener while your code waits. In a plain single-threaded node, a lookup with a timeout inside a timer callback failed 12 out of 12 times.

ROS 2 tf2 "Lookup would require extrapolation into the future", "into the past" and "target_frame does not exist": lookup_transform timing, measured — measured results table
At a glance: the main measured table from this article. Full details below.

Find your error text

Error text What it meant in my run Fix that worked
extrapolation into the future, gap of a few ms to one publish period Lookup at now() with no timeout Time(), or a timeout
extrapolation into the future, gap of seconds The requested stamp is far ahead of the TF data. I requested now() + 5 s Check the clocks. See the clock-mismatch section
extrapolation into the past … earliest data is at The requested time is older than the buffer keeps (10 s by default), or older than when the listener started Buffer(cache_time=Duration(seconds=30)), or process the data sooner
"odom" passed to lookupTransform argument target_frame does not exist Buffer still empty. Every lookup made right after creating the listener failed this way Wait with a timeout and keep the listener spinning
"camera_link" passed to lookupTransform argument source_frame does not exist The other frames are there, but this one is never published Fix the frame name or start its broadcaster. A timeout only delays the error

Note the order in the message. I called lookup_transform('odom', 'base_link', ...), target first, and the message says “from frame [base_link] to frame [odom]”, source first.

What I ran

On 2026-10-28 I used the official ros:humble-ros-base, ros:jazzy-ros-base and ros:lyrical-ros-base Docker images on a 2-vCPU cloud server, with --network none and the default RMW. All three images already had tf2_ros for Python. One Python process was the broadcaster. It sent a static map to odom transform once on /tf_static, and a dynamic odom to base_link transform on /tf from a timer, stamped with now(). A second Python process held a Buffer and a TransformListener, spun by its own executor thread, and ran the lookups. I waited a random 0 to 20 ms between lookups so they didn’t line up with the publish timer. I counted /tf messages during each run, and the rate came out at exactly 10.0, 50.0 and 100.0 msg/s.

The results were the same on all three distros. Where numbers differ, the table shows the range across Humble, Jazzy and Lyrical.

Lookup 10 Hz 50 Hz 100 Hz
now(), no timeout 0/200 0/200 0/200
Time() (latest) 200/200 200/200 200/200
now(), timeout=0.1 s 100/100 100/100 100/100
stamp 50 ms in the past, no timeout 92 to 103/200 200/200 200/200
static map to odom at now() 200/200 200/200 200/200
map to base_link (static + dynamic) at now() 0/200 0/200 0/200
can_transform at now(), no timeout False 200/200 False 200/200 False 200/200
wait_for_transform_async(now()) 100/100 100/100 100/100

Why now() fails at every publish rate

tf2 interpolates between two stored transforms. It doesn’t extrapolate past the newest one. When you ask for now(), the newest stored transform was stamped some time before now, so the request is always past the end of the data. The error message gives both times, so I subtracted them for every failure:

Publish rate Requested minus latest, median Max Min
10 Hz 48.4 to 49.5 ms 99.4 to 99.7 ms 1.2 to 1.5 ms
50 Hz 8.9 to 10.6 ms 20.2 to 21.1 ms 1.0 to 1.3 ms
100 Hz 4.8 to 5.2 ms 10.3 to 11.2 ms 1.0 to 1.2 ms

So the error rate does not depend on the publish rate. It was 100% at 10 Hz and 100% at 100 Hz. A faster publisher only makes the gap smaller: about half a period on average, and about one period at most. It never reached zero. Even right after a message arrived, the newest stamp was still at least 1.0 ms behind now(). That’s the time from sendTransform to the listener’s buffer on the same machine. Publishing faster won’t remove the error. Change the lookup.

can_transform with now() and no timeout gives the same answer without an exception: it returned False 1,800 times out of 1,800. If your code checks can_transform first and skips the lookup when it’s False, the node silently does nothing.

Time() returns the newest transform, and it is old

rclpy.time.Time() is time zero, which tf2 reads as “the latest you have”. It never raised an extrapolation error in my run. It returns the newest stored transform, so it’s as old as the last message:

Publish rate Age of the returned transform, median Max
10 Hz 45.5 to 54.5 ms 100.3 to 101.2 ms
50 Hz 9.8 to 10.8 ms 20.3 to 21.2 ms
100 Hz 4.5 to 5.2 ms 11.2 to 21.1 ms

A 10 ms old pose rarely matters. A 100 ms old pose on a turning robot does, so for sensor data look up the transform at the sensor’s stamp. The C++ equivalent of Time() is tf2::TimePointZero.

What a timeout actually costs

With timeout=Duration(seconds=0.1), the lookup at now() worked 100 out of 100 times at every rate. It waits until a transform newer than the requested time arrives, then interpolates. But the wait wasn’t as short as I expected:

Publish rate Call duration, median Min Max
10 Hz 81.4 to 81.7 ms 20.5 to 40.9 ms 101.8 to 104.5 ms
50 Hz 20.5 ms 20.3 to 20.4 ms 21.2 to 41.4 ms
100 Hz 20.4 to 20.5 ms 20.3 to 20.4 ms 21.2 to 27.9 ms

At 100 Hz the next transform arrives about 5 ms later, yet the call took 20 ms. The reason is in the installed tf2_ros/buffer.py: can_transform, which lookup_transform calls, checks the buffer in a loop with sleep(0.02) between checks. That line is present on all three distros. So in Python, a timeout that has to wait at all costs at least about 20 ms, however fast your TF is. At 10 Hz the median was 81 ms. That’s closer to a full period than to the 50 ms you might expect, because the 20 ms polling steps add delay too.

Buffer.wait_for_transform_async() doesn’t poll. It returns a future that completes when the data arrives. I created the future for now(), waited for it, then looked up the transform:

future = self.tf_buffer.wait_for_transform_async('odom', 'base_link', stamp)
# in an async callback: await future
# then:
t = self.tf_buffer.lookup_transform('odom', 'base_link', stamp)

It completed 100 out of 100 times. The median wait was 88.8 to 91.1 ms at 10 Hz, 10.7 to 12.4 ms at 50 Hz and 6.0 to 7.0 ms at 100 Hz, about half the time to the next message, as expected. One outlier: on Jazzy at 10 Hz, one wait took 171.4 ms. This is the Python counterpart of waitForTransform from ROS 1.

A timeout on a frame that doesn’t exist waits the whole time. A lookup for an unpublished camera_link with a 0.5 s timeout raised LookupException after 500.9 to 506.9 ms. Without a timeout it failed in 0.0 to 0.1 ms. With no broadcaster at all, a 2 s timeout blocked for 2004.4 to 2005.5 ms. A request for now() + 5 s with a 0.5 s timeout blocked for 505.4 to 517.2 ms, then raised “extrapolation into the future” with a 4-second gap. If you put a timeout inside a control loop, a missing frame costs you the full timeout on every iteration.

The timeout needs something spinning the listener

The listener’s subscription only fills the buffer when an executor runs it. If the thread that’s waiting is the only one spinning the node, nothing arrives while it waits. I tested three setups, each with a 2 Hz timer whose callback did lookup_transform(..., now(), timeout=0.2 s) against a 50 Hz broadcaster:

Setup Result Call duration
One node, rclpy.spin_once (single-threaded), listener on the same node 0/12, ExtrapolationException 202.6 to 212.7 ms, the full timeout every time
Same node, MultiThreadedExecutor(num_threads=4) 11/11 ok median 20.5 to 20.9 ms
TransformListener(buffer, Node('tf_listener'), spin_thread=True) 12/12 ok median 20.4 ms

In the single-threaded case the error looks like a plain timing problem, and a longer timeout only makes each callback block longer. The listener puts its subscriptions in a ReentrantCallbackGroup, so a multi-threaded executor can run them while your callback waits. The second fix is spin_thread=True, which gives the listener its own executor thread. Give it a separate node so the same node isn’t spun by two executors. On Jazzy, the multi-threaded executor had two calls that took 243 and 333 ms, longer than the 0.2 s timeout, and still returned a transform. The 4 threads were competing for 2 CPUs.

A buffer whose listener is never spun stays empty. In my no-spin test, with the broadcaster running, lookup_transform(..., Time(), timeout=1 s) blocked for 1012.5 to 1012.9 ms and then said "odom" passed to lookupTransform argument target_frame does not exist. If you see “does not exist” for a frame that ros2 run tf2_ros tf2_echo shows fine, check that your listener’s node is actually being spun.

“target_frame does not exist” right after startup

A new TransformListener starts empty. Every lookup I made immediately after creating it failed with "odom" passed to lookupTransform argument target_frame does not exist. That happened in 18 out of 18 starts across the three distros, including the 15 starts where the broadcaster had been publishing for seconds. can_transform at that moment returned 0, not an exception. Then I waited with lookup_transform(..., Time(), timeout=2 s) in five fresh listener processes per distro:

Distro Time until the first lookup succeeded (5 starts)
Humble 465.6, 20.4, 20.4, 20.4, 121.5 ms
Jazzy 485.9, 142.9, 144.7, 143.0, 143.2 ms
Lyrical 182.3, 181.9, 182.4, 182.2, 182.2 ms

Discovery took between 20 ms and half a second, so a startup lookup without a timeout is a race. That fits one asker’s report that the error happened “About 50% of the time”. The fix is to wait once at startup with a timeout of a few seconds, from a thread that isn’t the one spinning the listener, or to skip the first few cycles until can_transform returns true.

Static transforms and chains

A transform from /tf_static is valid at any time. A lookup of the static map to odom at now() worked 200 out of 200 times at every rate, with no timeout, even though it was published once at startup. A chain is only as good as its newest dynamic link, though. map to base_link, static plus dynamic, failed 200 out of 200 times at now(), with the same gap as the dynamic link alone. If a transform truly never changes, such as a sensor bolted to the chassis, publish it with StaticTransformBroadcaster or static_transform_publisher and not from a timer on /tf.

Use the message stamp, and when that fails

For sensor data, the right time is usually msg.header.stamp, the moment the data was captured. A stamp in the past is fine as long as a newer transform has arrived. With a stamp 50 ms old and no timeout, the lookup worked 200 out of 200 times at 50 and 100 Hz. At 10 Hz it worked only 92 to 103 times out of 200, roughly half, because half the time the next transform hadn’t arrived yet. So with a fresh stamp, add a timeout of at least one TF period, or use wait_for_transform_async.

In C++, tf2_ros::MessageFilter does this for you: it holds each message until its transform is available. The Python tf2_ros package had no MessageFilter attribute on any of the three distros. In Python, use wait_for_transform_async or a timeout.

If the gap in the error is seconds rather than milliseconds, and it stays the same while the robot runs, it’s not latency. Two clocks disagree: a sensor stamping in its own clock, a second machine without time sync, or use_sim_time set on only some nodes. I measured that case separately in ROS 2 “Message Filter dropping message”: find the mismatched clock. The same subtraction on the two times in the extrapolation error tells you which clock is off.

Extrapolation into the past and cache_time

The buffer keeps 10 seconds of history by default. I let a listener run for 16 seconds at 50 Hz, then looked up older times:

Requested time Default Buffer() Buffer(cache_time=Duration(seconds=30))
now() – 5 s ok ok
now() – 9.5 s ok ok
now() – 12 s extrapolation into the past ok
now() – 15 s extrapolation into the past ok
now() – 25 s extrapolation into the past extrapolation into the past

With the default buffer, the “earliest data” in the error was 10.02 to 10.04 s before the time I took now(). That’s the 10 s cache. With the 30 s buffer, the 25 s request still failed, and its “earliest data” was 16.0 s back: the moment the listener started. A bigger cache can’t hold data from before the listener started. Raise cache_time when you process messages late on purpose. If the stamps come from a clock that’s behind, or a bag replayed against a fresh listener, fix that instead.

Version notes

Humble (tf2_ros 0.25.24), Jazzy (0.36.23) and Lyrical (0.45.10) behaved the same in every test. The error texts were identical, the 20 ms polling loop is present on all three, and none has a Python MessageFilter. Startup discovery times differed: Humble was fastest at 20.4 ms in three of five starts, Jazzy took about 143 ms and Lyrical about 182 ms. Jazzy and Lyrical printed The following exception was never retrieved: cannot use Destroyable because destruction was requested when the spin_thread=True listener shut down. It appeared after the results and had no effect on them.

Not tested

rclcpp (lookupTransform, tf2_ros::MessageFilter, waitForTransform), so I can’t say whether C++ polls the same way. Also not tested: use_sim_time with a bag or simulator, two machines with clock offset, CycloneDDS or Zenoh instead of the default RMW, publish rates above 100 Hz, lookup_transform_full (time travel), TF published by robot_state_publisher, and loaded systems where the listener falls behind.

FAQ

Why does lookup_transform with get_clock().now() always fail?

The newest transform in the buffer is always older than now, by at least 1.0 ms in my run and by up to one publish period. tf2 doesn’t extrapolate, so the lookup failed 1,800 out of 1,800 times at 10, 50 and 100 Hz. Use rclpy.time.Time() for the latest transform, or add timeout=Duration(seconds=0.1).

Will publishing TF faster fix “extrapolation into the future”?

No. At 100 Hz it still failed 200 out of 200 times. Only the gap shrank, from a median of about 49 ms at 10 Hz to about 5 ms at 100 Hz.

How long does a lookup_transform timeout block?

In rclpy it checks every 20 ms, so a lookup that has to wait took about 20.5 ms even at 100 Hz, and about 81 ms at 10 Hz. For a frame that doesn’t exist, it blocks for the whole timeout: 0.5 s took about 506 ms.

Why does my timeout not help inside a timer callback?

With a single-threaded executor, the listener can’t receive TF while your callback waits, so the lookup failed 12 out of 12 times after the full 0.2 s. A MultiThreadedExecutor, or TransformListener with spin_thread=True on its own node, fixed it.

How do I fix “extrapolation into the past”?

The requested time is older than the buffer’s history. The default history is 10 s. Buffer(cache_time=Duration(seconds=30)) fixed 12 and 15 s old lookups, but no buffer has data from before the listener started.

Measured on 2026-10-28 with ros:humble-ros-base (sha256:d9bcf2e6f72d..., tf2 and tf2_ros 0.25.24, rclpy 3.3.22), ros:jazzy-ros-base (sha256:8eed0a4669bb..., tf2 and tf2_ros 0.36.23, rclpy 7.1.12) and ros:lyrical-ros-base (sha256:3224ee150cb0..., tf2 and tf2_ros 0.45.10, rclpy 10.0.11), default RMW, Python only. Full digests are in digests.txt.

Script and raw output: evidence folder. Questions this answers: ROS2 lookupTransform() – cannot get transform at time now(), Waiting for TransformListener with ROS2 and Python?, Lookup would require extrapolation into the future on the same machine, transformPoseInTargetFrame: Extrapolation Error looking up target frame, tf2 transform error: Lookup would require extrapolation into the past.