Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ed668f3
add raycaster sensor
Milotrince Sep 24, 2025
3d14673
deprecate compile_kernels, move sensor build
Milotrince Sep 30, 2025
49d731d
update docstring
Milotrince Sep 30, 2025
6e03d1d
update example
Milotrince Sep 30, 2025
c43fc0c
address review 1 part 1
Milotrince Oct 1, 2025
d2c20fb
address review 1 part 2
Milotrince Oct 1, 2025
9d28b30
address review 1 part 3: simplify raycastpattern
Milotrince Oct 1, 2025
e35df06
restore is_free/is_fixed change
Milotrince Oct 1, 2025
4ce6b70
cleanup pattern
Milotrince Oct 1, 2025
608e586
update post init sensor option validation
Milotrince Oct 1, 2025
d308fd8
update raycaster test, rename raycaster data fields
Milotrince Oct 2, 2025
9983f43
fix unintended stuffs
Milotrince Oct 2, 2025
2d5194a
rebase updates, add sensor draw debug test
Milotrince Oct 3, 2025
f916f58
sensor draw debug test fixes
Milotrince Oct 4, 2025
2128c71
remove only_cast_fixed option
Milotrince Oct 4, 2025
76fb95e
minor fixes
Milotrince Oct 6, 2025
565fc8f
rm examples from ignore list
Milotrince Oct 6, 2025
f7f58a0
cleanup rendering unit tests.
duburcqa Oct 7, 2025
d4ec32b
Fix offscreen interactive viewer.
duburcqa Oct 7, 2025
46ae857
Fix viewer deadlock in case of missing display.
duburcqa Oct 7, 2025
fa36ee9
Fix example unit tests.
duburcqa Oct 7, 2025
e8224d6
Increase tolerance unit test to avoid flakiness.
duburcqa Oct 7, 2025
dbba03e
Add hugging face Xet deps.
duburcqa Oct 7, 2025
d37c5da
Cleanup sensor draw debug unit test.
duburcqa Oct 7, 2025
1956f04
Fix draw debug sensor update for raycaster.
duburcqa Oct 7, 2025
cc25f46
Expose option to force refreshing rasterizer context.
duburcqa Oct 7, 2025
b4c20b5
Force headless window if supported and '--vis' is not specified in un…
duburcqa Oct 7, 2025
bf4abf7
Fix rasterizer rendering discrepency across platforms.
duburcqa Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_HUB_DOWNLOAD_TIMEOUT: 60
GENESIS_IMAGE_VER: "1_3"
GENESIS_IMAGE_VER: "1_4"
TIMEOUT_MINUTES: 180
FORCE_COLOR: 1
PY_COLORS: 1
Expand Down
23 changes: 15 additions & 8 deletions examples/sensors/contact_force_go2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import os

from tqdm import tqdm

Expand All @@ -8,11 +9,11 @@

def main():
parser = argparse.ArgumentParser()
parser.add_argument("-dt", "--timestep", type=float, default=1e-2, help="Simulation time step")
parser.add_argument("-dt", "--timestep", type=float, default=0.01, help="Simulation time step")
parser.add_argument("-v", "--vis", action="store_true", default=True, help="Show visualization GUI")
parser.add_argument("-nv", "--no-vis", action="store_false", dest="vis", help="Disable visualization GUI")
parser.add_argument("-c", "--cpu", action="store_true", help="Use CPU instead of GPU")
parser.add_argument("-t", "--seconds", type=float, default=2, help="Number of seconds to simulate")
parser.add_argument("-t", "--seconds", type=float, default=2.0, help="Number of seconds to simulate")
parser.add_argument("-f", "--force", action="store_true", default=True, help="Use ContactForceSensor (xyz float)")
parser.add_argument("-nf", "--no-force", action="store_false", dest="force", help="Use ContactSensor (boolean)")

Expand All @@ -23,19 +24,25 @@ def main():

########################## scene setup ##########################
scene = gs.Scene(
sim_options=gs.options.SimOptions(dt=args.timestep),
sim_options=gs.options.SimOptions(
dt=args.timestep,
),
rigid_options=gs.options.RigidOptions(
use_gjk_collision=True,
constraint_timeconst=max(0.01, 2 * args.timestep),
use_gjk_collision=True,
),
vis_options=gs.options.VisOptions(
show_world_frame=True,
),
profiling_options=gs.options.ProfilingOptions(
show_FPS=False,
),
vis_options=gs.options.VisOptions(show_world_frame=True),
profiling_options=gs.options.ProfilingOptions(show_FPS=False),
show_viewer=args.vis,
)

scene.add_entity(gs.morphs.Plane())

foot_link_names = ["FR_foot", "FL_foot", "RR_foot", "RL_foot"]
foot_link_names = ("FR_foot", "FL_foot", "RR_foot", "RL_foot")
go2 = scene.add_entity(
gs.morphs.URDF(
file="urdf/go2/urdf/go2.urdf",
Expand Down Expand Up @@ -79,7 +86,7 @@ def main():
scene.build()

try:
steps = int(args.seconds / args.timestep)
steps = int(args.seconds / args.timestep) if "PYTEST_VERSION" not in os.environ else 5
for _ in tqdm(range(steps)):
scene.step()
except KeyboardInterrupt:
Expand Down
41 changes: 31 additions & 10 deletions examples/sensors/imu_franka.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import os

import numpy as np
from tqdm import tqdm
Expand All @@ -21,14 +22,20 @@ def main():

########################## create a scene ##########################
scene = gs.Scene(
sim_options=gs.options.SimOptions(dt=args.timestep),
vis_options=gs.options.VisOptions(show_world_frame=False),
sim_options=gs.options.SimOptions(
dt=args.timestep,
),
vis_options=gs.options.VisOptions(
show_world_frame=False,
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(3.5, 0.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
),
profiling_options=gs.options.ProfilingOptions(show_FPS=False),
profiling_options=gs.options.ProfilingOptions(
show_FPS=False,
),
show_viewer=args.vis,
)

Expand All @@ -40,6 +47,7 @@ def main():
end_effector = franka.get_link("hand")
motors_dof = (0, 1, 2, 3, 4, 5, 6)

########################## record sensor data ##########################
imu = scene.add_sensor(
gs.sensors.IMU(
entity_idx=franka.idx,
Expand All @@ -59,25 +67,38 @@ def main():
draw_debug=True,
)
)
labels = {"lin_acc": ("acc_x", "acc_y", "acc_z"), "ang_vel": ("gyro_x", "gyro_y", "gyro_z")}
if args.vis:
xyz = ("x", "y", "z")
labels = {"lin_acc": xyz, "true_lin_acc": xyz, "ang_vel": xyz, "true_ang_vel": xyz}

def data_func():
data = imu.read()
true_data = imu.read_ground_truth()
return {
"lin_acc": data.lin_acc,
"true_lin_acc": true_data.lin_acc,
"ang_vel": data.ang_vel,
"true_ang_vel": true_data.ang_vel,
}

if IS_PYQTGRAPH_AVAILABLE:
imu.start_recording(gs.recorders.PyQtLinePlot(title="IMU Measured Data", labels=labels))
scene.start_recording(
imu.read_ground_truth,
data_func,
gs.recorders.PyQtLinePlot(title="IMU Ground Truth Data", labels=labels),
)
elif IS_MATPLOTLIB_AVAILABLE:
gs.logger.info("pyqtgraph not found, falling back to matplotlib.")
imu.start_recording(gs.recorders.MPLLinePlot(title="IMU Measured Data", labels=labels))
scene.start_recording(
imu.read_ground_truth,
data_func,
gs.recorders.MPLLinePlot(title="IMU Ground Truth Data", labels=labels),
)
else:
print("matplotlib or pyqtgraph not found, skipping real-time plotting.")

imu.start_recording(gs.recorders.NPZFile(filename="imu_data.npz"))
scene.start_recording(
data_func=lambda: imu.read()._asdict(),
rec_options=gs.recorders.NPZFile(filename="imu_data.npz"),
)

########################## build ##########################
scene.build()
Expand All @@ -98,7 +119,7 @@ def main():
rate = np.deg2rad(2.0)

try:
steps = int(args.seconds / args.timestep)
steps = int(args.seconds / args.timestep) if "PYTEST_VERSION" not in os.environ else 5
for i in tqdm(range(steps)):
scene.step()

Expand Down
Loading
Loading