Skip to content

Commit 9f033bb

Browse files
authored
Merge branch 'main' into easydiffrigid
2 parents ef3954e + 12d9b95 commit 9f033bb

36 files changed

+1811
-312
lines changed

.github/workflows/production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
2525
HF_TOKEN: ${{ secrets.HF_TOKEN }}
2626
HF_HUB_DOWNLOAD_TIMEOUT: 60
27-
GENESIS_IMAGE_VER: "1_3"
27+
GENESIS_IMAGE_VER: "1_4"
2828
TIMEOUT_MINUTES: 180
2929
FORCE_COLOR: 1
3030
PY_COLORS: 1

examples/sensors/contact_force_go2.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import os
23

34
from tqdm import tqdm
45

@@ -8,11 +9,11 @@
89

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

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

2425
########################## scene setup ##########################
2526
scene = gs.Scene(
26-
sim_options=gs.options.SimOptions(dt=args.timestep),
27+
sim_options=gs.options.SimOptions(
28+
dt=args.timestep,
29+
),
2730
rigid_options=gs.options.RigidOptions(
28-
use_gjk_collision=True,
2931
constraint_timeconst=max(0.01, 2 * args.timestep),
32+
use_gjk_collision=True,
33+
),
34+
vis_options=gs.options.VisOptions(
35+
show_world_frame=True,
36+
),
37+
profiling_options=gs.options.ProfilingOptions(
38+
show_FPS=False,
3039
),
31-
vis_options=gs.options.VisOptions(show_world_frame=True),
32-
profiling_options=gs.options.ProfilingOptions(show_FPS=False),
3340
show_viewer=args.vis,
3441
)
3542

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

38-
foot_link_names = ["FR_foot", "FL_foot", "RR_foot", "RL_foot"]
45+
foot_link_names = ("FR_foot", "FL_foot", "RR_foot", "RL_foot")
3946
go2 = scene.add_entity(
4047
gs.morphs.URDF(
4148
file="urdf/go2/urdf/go2.urdf",
@@ -79,7 +86,7 @@ def main():
7986
scene.build()
8087

8188
try:
82-
steps = int(args.seconds / args.timestep)
89+
steps = int(args.seconds / args.timestep) if "PYTEST_VERSION" not in os.environ else 5
8390
for _ in tqdm(range(steps)):
8491
scene.step()
8592
except KeyboardInterrupt:

examples/sensors/imu_franka.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import os
23

34
import numpy as np
45
from tqdm import tqdm
@@ -21,14 +22,20 @@ def main():
2122

2223
########################## create a scene ##########################
2324
scene = gs.Scene(
24-
sim_options=gs.options.SimOptions(dt=args.timestep),
25-
vis_options=gs.options.VisOptions(show_world_frame=False),
25+
sim_options=gs.options.SimOptions(
26+
dt=args.timestep,
27+
),
28+
vis_options=gs.options.VisOptions(
29+
show_world_frame=False,
30+
),
2631
viewer_options=gs.options.ViewerOptions(
2732
camera_pos=(3.5, 0.0, 2.5),
2833
camera_lookat=(0.0, 0.0, 0.5),
2934
camera_fov=40,
3035
),
31-
profiling_options=gs.options.ProfilingOptions(show_FPS=False),
36+
profiling_options=gs.options.ProfilingOptions(
37+
show_FPS=False,
38+
),
3239
show_viewer=args.vis,
3340
)
3441

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

50+
########################## record sensor data ##########################
4351
imu = scene.add_sensor(
4452
gs.sensors.IMU(
4553
entity_idx=franka.idx,
@@ -59,25 +67,38 @@ def main():
5967
draw_debug=True,
6068
)
6169
)
62-
labels = {"lin_acc": ("acc_x", "acc_y", "acc_z"), "ang_vel": ("gyro_x", "gyro_y", "gyro_z")}
6370
if args.vis:
71+
xyz = ("x", "y", "z")
72+
labels = {"lin_acc": xyz, "true_lin_acc": xyz, "ang_vel": xyz, "true_ang_vel": xyz}
73+
74+
def data_func():
75+
data = imu.read()
76+
true_data = imu.read_ground_truth()
77+
return {
78+
"lin_acc": data.lin_acc,
79+
"true_lin_acc": true_data.lin_acc,
80+
"ang_vel": data.ang_vel,
81+
"true_ang_vel": true_data.ang_vel,
82+
}
83+
6484
if IS_PYQTGRAPH_AVAILABLE:
65-
imu.start_recording(gs.recorders.PyQtLinePlot(title="IMU Measured Data", labels=labels))
6685
scene.start_recording(
67-
imu.read_ground_truth,
86+
data_func,
6887
gs.recorders.PyQtLinePlot(title="IMU Ground Truth Data", labels=labels),
6988
)
7089
elif IS_MATPLOTLIB_AVAILABLE:
7190
gs.logger.info("pyqtgraph not found, falling back to matplotlib.")
72-
imu.start_recording(gs.recorders.MPLLinePlot(title="IMU Measured Data", labels=labels))
7391
scene.start_recording(
74-
imu.read_ground_truth,
92+
data_func,
7593
gs.recorders.MPLLinePlot(title="IMU Ground Truth Data", labels=labels),
7694
)
7795
else:
7896
print("matplotlib or pyqtgraph not found, skipping real-time plotting.")
7997

80-
imu.start_recording(gs.recorders.NPZFile(filename="imu_data.npz"))
98+
scene.start_recording(
99+
data_func=lambda: imu.read()._asdict(),
100+
rec_options=gs.recorders.NPZFile(filename="imu_data.npz"),
101+
)
81102

82103
########################## build ##########################
83104
scene.build()
@@ -98,7 +119,7 @@ def main():
98119
rate = np.deg2rad(2.0)
99120

100121
try:
101-
steps = int(args.seconds / args.timestep)
122+
steps = int(args.seconds / args.timestep) if "PYTEST_VERSION" not in os.environ else 5
102123
for i in tqdm(range(steps)):
103124
scene.step()
104125

0 commit comments

Comments
 (0)