-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathfollow_entity.py
More file actions
49 lines (39 loc) · 1.04 KB
/
follow_entity.py
File metadata and controls
49 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import argparse
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--fix", action="store_true", default=False)
args = parser.parse_args()
gs.init()
scene = gs.Scene(
vis_options=gs.options.VisOptions(
rendered_envs_idx=(0,),
),
profiling_options=gs.options.ProfilingOptions(
show_FPS=False,
),
show_viewer=False,
)
scene.add_entity(morph=gs.morphs.Plane())
cube = scene.add_entity(
gs.morphs.Box(
size=(0.1, 0.1, 0.1),
pos=(0.0, -0.9, 1.0),
euler=(15.0, 30.0, 60.0),
)
)
cam = scene.add_camera(
res=(640, 480),
pos=(2.0, 0.0, 1.5),
lookat=(0, 0, 0.7),
fov=40,
GUI=True,
)
cam.follow_entity(cube, fix_orientation=args.fix)
scene.build()
cube.set_dofs_velocity([0.0, 5.0, 0.0, 0.0, 0.0, 1.0])
for _ in range(100):
scene.step()
cam.render()
if __name__ == "__main__":
main()