-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Enable video streaming and URDF logging from Rerun 0.24 #1375
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
Draft
pweids
wants to merge
13
commits into
huggingface:main
Choose a base branch
from
pweids:rerun-0.24-video-and-urdf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,571
−59
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The main change in this commit, besides adding a URDF directory and files, is the URDFLogger class. This class provides the methods to log the URDF to Rerun as a static asset. It will also log the joint angles. The robot type is needed to resolve the motor norm modes, which default to M100_100 if the robot type does not have a motor bus.
Because rerun displays both meshes, sometimes they collide. Commenting out for now until this can be fixed on rerun's side. Also setting the default color to white.
note, the pre-commit bandit is failing because it thinks there's a typo in the element ID of one of the URDF files:
I bypassed this locally by committing with --no-verify (after solving all other pre-commit issues), but it's failing here. Not sure how to please the checker here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enable Video and URDF support from Rerun v0.24
What this does
This PR incorporates some new features to be released in Rerun 0.24 (that are currently available in the alpha release). Namely two things:
To utilize this, I've created some helpers classes/functions to modularize the logging procedures and bring them into
record.py
andteleoperate.py
.The main class here is the
RerunRobotLogger
invisualization_utils.py
. This class is highly configurable, and makes it easy to log observation and action data.On initialization, it will:
After initialization, the simplest way to use this is
log_all
, which willVideo tradeoffs
There is a tradeoff between using video, compressed, and raw images, which is why I've made that configurable by the user. The tradeoff is essentially that there is a small encoding penalty for video, which means the live streaming of the video is about 1/2 second behind the robot. On the plus side, the entire video interaction can be played back at normal speeds.
With compressed images, there is also an encoding penalty, but it's negligible. This reduces the images from several megabytes to under 100 kilobytes. It's generally a best practice to log compressed images for this reason.
In both cases of logging the compressed images and the raw frames, I've kept
static=True
because of the memory issue. The video files remain a manageable size because of inter-frame video compression, so that does not cause much of a memory impact.URDF logging
I've included the URDF files for the SO-100 and SO-101 arms. However, it's reasonable if you don't want to include this in the repository and instead instruct users to download them from somewhere else. These URDFs are slightly edited versions from here: https://github.com/TheRobotStudio/SO-ARM100/tree/main/Simulation
The
RerunRobotLogger
will try to load these URDFs, but an optional URDF path can be passed as well. And of course, URDF logging can be disabled. Logging the URDFs and meshes themselves is about 30-40MB of memory that's only incurred on launch, so some people may want to avoid this.Additional changes
None
checks. Happy to back these out if desired to reduce the footprint of this PR.How it was tested
I tested this mainly by running
lerobot.teleoperate
andlerobot.record
manually with the various settings.How to checkout & try? (for the reviewer)
To run this, version 0.24.0a4 is required. To avoid creating a dependency on an alpha version, I recommend we wait until 0.24 is released (targeting next week) before merging this in, so I'm going to submit this as a draft to get some eyes on it.
To run it, simply install the alpha version:
Demo
I've uploaded a brief screen cap of running teleop with the URDF and video file here: https://drive.google.com/file/d/185APpSQl3rp3spfRhHAFwv9buWh2Grjj/view?usp=share_link
Known issues
There are some playback quirks we're working out. Specifically, when scrubbing to a random time, the video will rapidly playback from the most recent keyframe (basically displaying all the intermediary frames until the desired one). This will be resolved by the time 0.24 gets officially released.
There may also be better default encoding settings for reducing the encoding latency any further.
Follow-up work
There's clear duplicated work in that images are stored to disk raw and then encoded after each episode. With Rerun's live encoding, we should be able to save the encoded video files directly. This would save a lot of post-episode encoding time and disk IO.