-
Notifications
You must be signed in to change notification settings - Fork 377
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
Clearing entities with transforms leaves an identity transform behind #7729
Comments
A reproduceable program: use rerun as rr;
fn generate_transform(x: f32) -> rr::Transform3D {
rr::Transform3D::from_translation_rotation(
rr::Vec3D::new(x, 0.0, 0.0),
rr::Quaternion::IDENTITY,
)
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (stream, storage) = rr::RecordingStreamBuilder::new("Clear").memory()?;
let t_3 = generate_transform(3.0);
let t_5 = generate_transform(5.0);
let t_6 = generate_transform(6.0);
stream.set_time_seconds("sim_time", 0.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &t_5)?;
stream.set_time_seconds("sim_time", 1.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &t_6)?;
stream.set_time_seconds("sim_time", 2.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &rerun::Clear::flat())?; // <-- sends the visual 3d axes back to the origin
rr::native_viewer::show(storage.take())?;
Ok(())
} |
Here is a workaround for now: use rerun as rr;
fn generate_transform(x: f32) -> rr::Transform3D {
rr::Transform3D::from_translation_rotation(
rr::Vec3D::new(x, 0.0, 0.0),
rr::Quaternion::IDENTITY,
)
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (stream, storage) = rr::RecordingStreamBuilder::new("Clear").memory()?;
let t_3 = generate_transform(3.0);
let t_5 = generate_transform(5.0);
let t_6 = generate_transform(6.0);
stream.set_time_seconds("sim_time", 0.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &t_5)?;
stream.set_time_seconds("sim_time", 1.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &t_6)?;
stream.set_time_seconds("sim_time", 2.0);
stream.log("/foo", &t_3)?;
stream.log("/bar", &rerun::Clear::flat())?; // <-- sends the visual 3d axes back to the origin
stream.log("/bar", &rr::Transform3D::clear().with_axis_length(0.0))?; // <-- workaround
rr::native_viewer::show(storage.take())?;
Ok(())
} |
Aye, started with that workaround, but going two steps further... Step 1: Use that zero'd axis length to make them vanish (easy) but ... if entities are far from the origin, rerun zooms out excessively to try and fit in a transform that has been sent to the origin Step 2: Reset the transform with the last transform (more of a pain) but ... none of this handles transforms that have been cleared for sub-entities when using recursive Step 3: Reset the transforms of all subentities with their last transforms (can be too difficult to be worth chasing) |
Describe the bug
Everything seems to be working as documented, i.e.
However, it's the combination of the two when a non-identity transform is logged to an entity. It gets first cleared, and then reactivated as the identity keyframe which is subsequently visualized at the origin.
This can cause spurious transforms to appear in the 3D view, it can also cause rerun to excessively zoom out if entities are all far from the origin to compensate for the one re-registered at the world origin.
To Reproduce
recording_stream.log("/bob", &transform);
(transform must not be the identity)
recording_stream.log("\bob", &rerun::Clear::recursive());
Expected behavior
The transform is not restored (and thus not re-visualized).
Desktop (please complete the following information):
Rerun version
0.18.2
The text was updated successfully, but these errors were encountered: