|
Mujoco KDL Wrapper
0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
|
Headless H.264 video recording via EGL offscreen rendering and ffmpeg. More...
Classes | |
| struct | mj_kdl::CameraConf |
| class | mj_kdl::CameraRosPublisher |
| struct | mj_kdl::VideoRecorder |
Enumerations | |
| enum class | mj_kdl::VideoResolution { mj_kdl::VideoResolution::R360p = 360 , mj_kdl::VideoResolution::R480p = 480 , mj_kdl::VideoResolution::R720p = 720 , mj_kdl::VideoResolution::R1080p = 1080 , mj_kdl::VideoResolution::R2K = 1440 , mj_kdl::VideoResolution::R4K = 2160 } |
Functions | |
| Status | mj_kdl::init_video_recorder (VideoRecorder *vr, mjModel *model, const char *out_path, int width=1280, int height=720, int fps=60) |
| Status | mj_kdl::init_video_recorder (VideoRecorder *vr, mjModel *model, const char *out_path, VideoResolution resolution, int fps=60) |
| bool | mj_kdl::record_frame (VideoRecorder *vr, Env *env) |
| Status | mj_kdl::init_offscreen (VideoRecorder *vr, mjModel *model, int width, int height) |
| bool | mj_kdl::render_rgb (VideoRecorder *vr, Env *env, std::uint8_t *out) |
| bool | mj_kdl::render_rgb (VideoRecorder *vr, Env *env, std::function< void(const std::uint8_t *rgb)> done) |
| void | mj_kdl::cleanup (VideoRecorder *vr) |
Headless H.264 video recording via EGL offscreen rendering and ffmpeg.
No display or GLFW window is needed. Requires EGL (libegl-dev) and ffmpeg in PATH. Enable with -DBUILD_RECORDER=ON (default).
|
strong |
Standard output resolution presets for init_video_recorder(). Each maps to a 16:9 frame size at the named quality level.
| Enumerator | |
|---|---|
| R360p | |
| R480p | |
| R720p | |
| R1080p | |
| R2K | |
| R4K | |
Definition at line 452 of file mj_kdl_wrapper.hpp.
| void mj_kdl::cleanup | ( | VideoRecorder * | vr | ) |
Flush the ffmpeg pipe, finalise the MP4, and release all EGL resources. After this call vr->_impl is null and the VideoRecorder may be discarded.
| vr | VideoRecorder to tear down. |
| Status mj_kdl::init_offscreen | ( | VideoRecorder * | vr, |
| mjModel * | model, | ||
| int | width, | ||
| int | height ) |
Initialise offscreen rendering only: EGL context, no ffmpeg process and no output file. Use with render_rgb() to grab frames; the camera is vr->cam, as for a recording, and cleanup(VideoRecorder*) frees it. An open vr is freed first.
| vr | VideoRecorder to initialise; freed by cleanup(VideoRecorder*). |
| model | MuJoCo model whose default free camera vr->cam starts from. |
| width | Frame width in pixels. |
| height | Frame height in pixels. |
Referenced by TEST().
| Status mj_kdl::init_video_recorder | ( | VideoRecorder * | vr, |
| mjModel * | model, | ||
| const char * | out_path, | ||
| int | width = 1280, | ||
| int | height = 720, | ||
| int | fps = 60 ) |
Initialise a headless EGL video recorder. Creates an EGL context and launches an ffmpeg process (H.264/MP4) via a pipe. The render context is made from the Env at its first frame and remade after the Env's model is rebuilt.
| vr | VideoRecorder to initialise; freed by cleanup(VideoRecorder*). |
| model | MuJoCo model whose default free camera vr->cam starts from. |
| out_path | Output MP4 path (e.g. "sim.mp4"). |
| width | Frame width in pixels (default 1280). |
| height | Frame height in pixels (default 720). |
| fps | Playback frame rate (default 60). |
| Status mj_kdl::init_video_recorder | ( | VideoRecorder * | vr, |
| mjModel * | model, | ||
| const char * | out_path, | ||
| VideoResolution | resolution, | ||
| int | fps = 60 ) |
Convenience overload: initialise a VideoRecorder using a named resolution preset. Frame width is derived from the preset at 16:9 aspect ratio.
| vr | VideoRecorder to initialise. |
| model | MuJoCo model. |
| out_path | Output MP4 path. |
| resolution | VideoResolution preset (e.g. VideoResolution::R1080p). |
| fps | Playback frame rate (default 60). |
| bool mj_kdl::record_frame | ( | VideoRecorder * | vr, |
| Env * | env ) |
Snapshot env's current state as the next video frame; it is rendered and encoded on the recorder's thread. Waits only while the previous frame has not been picked up.
| vr | VideoRecorder initialised by init_video_recorder(). |
| env | Env to render. |
| bool mj_kdl::render_rgb | ( | VideoRecorder * | vr, |
| Env * | env, | ||
| std::function< void(const std::uint8_t *rgb)> | done ) |
Snapshot env's current state and return; done gets the top-down RGB8 frame on the recorder's thread, valid only during the call. Waits only while the previous frame has not been picked up.
| vr | VideoRecorder initialised by init_offscreen() or init_video_recorder(). |
| env | Env to render. |
| done | Receives width*height*3 bytes. |
| bool mj_kdl::render_rgb | ( | VideoRecorder * | vr, |
| Env * | env, | ||
| std::uint8_t * | out ) |
Render env's current state into a caller-owned top-down RGB8 buffer of width*height*3 bytes.
| vr | VideoRecorder initialised by init_offscreen() or init_video_recorder(). |
| env | Env to render. |
| out | Destination buffer, width*height*3 bytes. |
Referenced by TEST().