run-algo-in-parallel.py
Go to the documentation of this file.
1 import pinocchio as pin
2 import numpy as np
3 
4 model = pin.buildSampleModelHumanoid()
5 model.lowerPositionLimit[:7] = -np.ones(7)
6 model.upperPositionLimit[:7] = +np.ones(7)
7 
8 pool = pin.ModelPool(model)
9 
10 num_threads = pin.omp_get_max_threads()
11 batch_size = 128
12 q = np.empty((model.nq,batch_size))
13 for k in range(batch_size):
14  q[:,k] = pin.randomConfiguration(model)
15 
16 v = np.zeros((model.nv,batch_size))
17 a = np.zeros((model.nv,batch_size))
18 tau = np.zeros((model.nv,batch_size))
19 
20 print("num_threads: {}".format(num_threads))
21 print("batch_size: {}".format(batch_size))
22 
23 # Call RNEA
24 res_rnea = np.empty((model.nv,batch_size))
25 pin.rnea(num_threads,pool,q,v,a,res_rnea) # Without allocation
26 res_rnea2 = pin.rnea(num_threads,pool,q,v,a) # With allocation
27 
28 # Call ABA
29 res_aba = np.empty((model.nv,batch_size))
30 pin.aba(num_threads,pool,q,v,tau,res_aba) # Without allocation
31 res_aba2 = pin.aba(num_threads,pool,q,v,tau) # With allocation


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:04