Examples
Overview
The RaiSim binary distribution ships runnable C++ examples and rayrai tools.
Use the example_* executables to exercise RaiSim physics APIs, mesh
import/export, OpenUSD mesh loading, and PBR rayrai asset inspection. Use
rayrai_raisim_tcp_viewer to inspect applications that publish a
raisim::World through raisim::RaisimServer. RaisimUnity and
RaisimUnreal are no longer supported.
Run
Run examples from the installed package bin directory:
<raisim-install>/bin/example_anymal_contacts
<raisim-install>/bin/example_rayrai_pbr_asset_inspector
On Windows, use the .exe executable from the installed package bin
directory:
C:\path\to\raisim\bin\example_anymal_contacts.exe
If the runtime loader cannot find shared libraries, use the platform-specific environment setup before running examples:
source /path/to/raisim2Lib/raisim_env.sh
This script sets LD_LIBRARY_PATH on Linux and DYLD_LIBRARY_PATH on macOS.
.\raisim_env.ps1
raisim_env.bat
Visualization modes
There are two visualization paths. See Visualization for the full workflow comparison.
RaisimServer examples
example_anymal_contacts and example_atlas_contacts create a RaiSim world
and publish it through raisim::RaisimServer. They do not open a renderer
window themselves. Start rayrai_raisim_tcp_viewer, then run the example:
# Terminal 1
<raisim-install>/bin/rayrai_raisim_tcp_viewer
# Terminal 2
<raisim-install>/bin/example_anymal_contacts
The default server port is 8080 unless the example changes it. Use this
path when you want to inspect the same simulation data that a normal
RaisimServer application publishes.
Rayrai examples
Examples such as example_polyhaven_blue_wall,
example_rayrai_pbr_asset_inspector, and example_rayrai_usd_importer
create or use a raisin::RayraiWindow directly and render in process. They
do not need the TCP viewer:
<raisim-install>/bin/example_rayrai_pbr_asset_inspector
Prefer these examples when you need camera images, GPU/offscreen rendering, PBR materials, USD/glTF visual import, or standalone rayrai feature inspection.
Non-visual examples
Some examples are intended to print output or create files rather than show a
window. example_model_asset_pipeline writes preprocessed and exported OBJ
files to /tmp/raisim_model_asset_pipeline_example. example_usd_importer
loads OpenUSD mesh assets into a raisim::World and prints mesh counts.
Example layout
The installed package groups examples by executable behavior:
Group |
Purpose |
|---|---|
|
Installed examples for RaiSim physics, mesh import/export, OpenUSD mesh loading, and rayrai asset inspection. |
|
rayrai tools and standalone renderer examples. |
Server examples |
Examples that publish a world through |
Choosing an example
Start with these targets when learning a specific feature:
Target |
Demonstrates |
|---|---|
|
ANYmal standing on ground with PD gains and RaisimServer publishing. |
|
Atlas contact simulation with a small timestep and RaisimServer publishing. |
|
Mesh preprocessing, content-hash cache reuse, |
|
Loading OpenUSD mesh assets into |
|
Loading the same OpenUSD assets as rayrai visual meshes. |
|
Importing a Poly Haven glTF scene with HDR IBL, imported lights, reflection probes, and screenshot command-line options. |
|
Inspecting bundled glTF PBR sample assets under rayrai quality settings. |
|
Visually comparing original meshes and CoACD convex approximation
parts generated through |
|
Offscreen image generation for rayrai features, including full scene, depth of field, depth plane, deformables, PBR maps, and HDR IBL. |
|
Preset comparison images and quality reports for rayrai rendering. |
|
Rendering, readback, scene-sync, and TCP serialization benchmarks. |
|
Timed Anymal sensor-showcase benchmark with optional readback, visualization startup, startup profiling, and PBR world materials. |
|
First-draw and warm-frame benchmark for full PBR and core-eligible PBR shader-material paths. |
|
The TCP visualizer used by RaisimServer examples. |
Optional targets
Some targets depend on optional assets or platform packages:
OpenUSD examples require the package’s OpenUSD runtime and bundled USD files.
Rayrai examples require SDL2/OpenGL and rayrai runtime libraries.
Poly Haven and PBR asset examples require the corresponding assets under
rsc.
List available examples by inspecting the installed package bin directory:
ls <raisim-install>/bin
Current Package Examples
Benchmark Examples
Rayrai Tools And Examples
- rayrai_raisim_tcp_viewer
- rayrai_quality_comparison
- rayrai_benchmark
- rayrai_complete_showcase_benchmark
- rayrai_pbr_first_draw_benchmark
- Rayrai Example: Basic Scene
- Rayrai Example: Complete Showcase
- rayrai_blender_scene_import
- Rayrai Example: RGB Camera
- Rayrai Example: Depth Camera
- Rayrai Example: LiDAR Pointcloud
- Rayrai Example: Aruco Marker
- Rayrai Example: Custom Visuals
- Rayrai Example: Instancing Grid
- Rayrai Example: Pointcloud Animation
- Rayrai Example: PBR Material Grid
- Rayrai Example: PBR Texture Maps
- Rayrai Example: Quality Lighting and FXAA
- rayrai_visual_asset_support
- Rayrai Example: CoACD Mesh Approximation
- Rayrai Example: Runtime Scene Editing
- Rayrai Example: Rolling And Spinning Friction
- Rayrai Example: Swept CCD
- rayrai_feature_showcase
- Rayrai Example: TCP Viewer
Server Examples
- Server Example: Compound Object
- Server Example: Deformable Objects
- Server Example: Dynamic Heightmap
- Server Example: Dynamic Object Addition
- Server Example: Dzhanibekov Effect
- granular_media
- Server Example: Heightmap From Png
- Server Example: Inverse Dynamics
- Server Example: Kinematic Platform
- Server Example: Length Constraints Newtons Cradle
- Server Example: Material Restitution
- Server Example: Material Static Friction
- Server Example: Mesh Stack
- Server Example: Minitaur PD
- mjcf_gymnasium_hopper
- mjcf_gymnasium_humanoid
- mjcf_gymnasium_walker2d
- Server Example: Model Asset Pipeline
- Server Example: Object Lifecycle Stress
- Server Example: Primitive Grid
- Server Example: Procedural Heightmap
- Server Example: Ray Casting
- Server Example: Ray Scan LiDAR
- Server Example: Sphere Drop
- Server Example: Spring Damper Joints
- Server Example: Templated Tracked Robot
- Server Example: Visual Objects Showcase
- Server Example: Wheeled Robot Force Control
- ycb_objects
- ANYmal Pair
- Atlas
- Hill1 Heightmap
- Kinova Arm
- Lake1 Heightmap
- Mountain1 Heightmap
- Office1 Scene