-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_mesh_ex.py
34 lines (25 loc) · 917 Bytes
/
run_mesh_ex.py
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
import time
import warp as wp
import numpy as np
import mesh_utils
from warpforce import WarpCrowd
#### Initialize WARP #####
wp.init()
def run_class():
points, faces = mesh_utils.load_obj('examples/simple_env.obj')
wc = WarpCrowd()
wc.demo_agents(m=500, n=500, s=1.6)
wc.nagents = len(wc.agents_pos)
wc.configure_params() # Call to setup params for warp, use after defining agents
wc.config_hashgrid()
wc.config_mesh(np.asarray(points), np.asarray(faces))
wc.update_goals([[-80.8,-50.0,0.0]])
start = time.time()
num_sim_steps = 800
# Run simulation Steps
for i in range(num_sim_steps):
wc.compute_step()
pos = wc.xnew_wp # Get Agent Positions
print(f'Computation time of {num_sim_steps} for {len(wc.agents_pos)} agents took: \
{time.time()-start} seconds, for {((time.time()-start)/num_sim_steps)*1000}ms per step')
run_class()