Go to the documentation of this file.
10 #ifdef PINOCCHIO_WITH_HPP_FCL
34 int main(
int ,
const char ** )
36 using namespace Eigen;
39 typedef Eigen::Matrix<bool, Eigen::Dynamic, 1>
VectorXb;
48 std::cout <<
"(the time score in debug mode is not relevant) " << std::endl;
52 const size_t NUM_THREADS = (size_t)omp_get_max_threads();
56 + std::string(
"/example-robot-data/robots/talos_data/robots/talos_reduced.urdf");
61 std::cout <<
"nq = " <<
model.nq << std::endl;
62 std::cout <<
"nv = " <<
model.nv << std::endl;
63 std::cout <<
"name = " <<
model.name << std::endl;
65 #ifdef PINOCCHIO_WITH_HPP_FCL
70 std::vector<std::string> package_paths(1, package_path);
80 int num_active_collision_pairs = 0;
84 num_active_collision_pairs++;
86 std::cout <<
"active collision pairs = " << num_active_collision_pairs << std::endl;
90 std::cout <<
"--" << std::endl;
91 std::cout <<
"NUM_THREADS: " << NUM_THREADS << std::endl;
92 std::cout <<
"BATCH_SIZE: " <<
BATCH_SIZE << std::endl;
93 std::cout <<
"--" << std::endl;
96 const VectorXd qmax = Eigen::VectorXd::Ones(
model.nq);
105 for (
size_t i = 0;
i < NBT; ++
i)
113 vs.col(
i) = Eigen::VectorXd::Random(
model.nv);
114 as.col(
i) = Eigen::VectorXd::Random(
model.nv);
115 taus.col(
i) = Eigen::VectorXd::Random(
model.nv);
126 std::cout <<
"mean RNEA = \t\t\t\t";
137 std::stringstream ss;
138 ss <<
"mean RNEA pool (";
140 ss <<
" threads) = \t\t";
141 ss << elapsed <<
" us" << std::endl;
142 std::cout << ss.str();
145 std::cout <<
"--" << std::endl;
153 std::cout <<
"mean ABA = \t\t\t\t";
164 std::stringstream ss;
165 ss <<
"mean ABA pool (";
167 ss <<
" threads) = \t\t";
168 ss << elapsed <<
" us" << std::endl;
169 std::cout << ss.str();
172 #ifdef PINOCCHIO_WITH_HPP_FCL
173 std::cout <<
"--" << std::endl;
174 const int NBT_COLLISION =
math::max(NBT, 1);
176 SMOOTH((
size_t)NBT_COLLISION)
180 std::cout <<
"non parallel collision = \t\t\t";
181 timer.
toc(std::cout, NBT_COLLISION);
186 SMOOTH((
size_t)NBT_COLLISION)
191 double elapsed = timer.
toc() / (NBT_COLLISION);
192 std::stringstream ss;
193 ss <<
"parallel collision (";
195 ss <<
" threads) = \t\t";
196 ss << elapsed <<
" us" << std::endl;
197 std::cout << ss.str();
200 std::cout <<
"--" << std::endl;
203 collision_res.fill(
false);
211 std::cout <<
"non parallel collision = \t\t\t";
212 timer.
toc(std::cout, NBT_COLLISION);
221 double elapsed = timer.
toc() / (NBT_COLLISION);
222 std::stringstream ss;
223 ss <<
"pool parallel collision (";
225 ss <<
" threads) = \t\t";
226 ss << elapsed <<
" us" << std::endl;
227 std::cout << ss.str();
230 std::cout <<
"--" << std::endl;
233 model, geometry_model, NUM_THREADS);
235 collision_res.fill(
false);
243 std::cout <<
"non parallel collision = \t\t\t";
244 timer.
toc(std::cout, NBT_COLLISION);
253 double elapsed = timer.
toc() / (NBT_COLLISION);
254 std::stringstream ss;
255 ss <<
"pool parallel collision (";
257 ss <<
" threads) = \t\t";
258 ss << elapsed <<
" us" << std::endl;
259 std::cout << ss.str();
263 std::cout <<
"--" << std::endl;
266 model, geometry_model, NUM_THREADS);
268 collision_res.fill(
false);
276 std::cout <<
"non parallel collision = \t\t\t";
277 timer.
toc(std::cout, NBT_COLLISION);
286 double elapsed = timer.
toc() / (NBT_COLLISION);
287 std::stringstream ss;
288 ss <<
"pool parallel collision (";
290 ss <<
" threads) = \t\t";
291 ss << elapsed <<
" us" << std::endl;
292 std::cout << ss.str();
297 std::cout <<
"--" << std::endl;
bool computeCollisions(BroadPhaseManagerBase< BroadPhaseManagerDerived > &broadphase_manager, CollisionCallBackBase *callback)
Calls computeCollision for every active pairs of GeometryData. This function assumes that updateGeome...
int main(int, const char **)
JointModelFreeFlyerTpl< Scalar > JointModelFreeFlyer
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & aba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &tau, const Convention convention=Convention::LOCAL)
The Articulated-Body algorithm. It computes the forward dynamics, aka the joint accelerations given t...
void addAllCollisionPairs()
Add all possible collision pairs.
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
void abaInParallel(const size_t num_threads, ModelPoolTpl< Scalar, Options, JointCollectionTpl > &pool, const Eigen::MatrixBase< ConfigVectorPool > &q, const Eigen::MatrixBase< TangentVectorPool1 > &v, const Eigen::MatrixBase< TangentVectorPool2 > &tau, const Eigen::MatrixBase< TangentVectorPool3 > &a)
A parallel version of the Articulated Body algorithm. It computes the forward dynamics,...
std::shared_ptr< MeshLoader > MeshLoaderPtr
std::vector< bool > activeCollisionPairs
Vector of collision pairs.
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, const std::string &rootJointName, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false)
Build the model from a URDF file with a particular joint as root of the model tree inside the model g...
void rneaInParallel(const size_t num_threads, ModelPoolTpl< Scalar, Options, JointCollectionTpl > &pool, const Eigen::MatrixBase< ConfigVectorPool > &q, const Eigen::MatrixBase< TangentVectorPool1 > &v, const Eigen::MatrixBase< TangentVectorPool2 > &a, const Eigen::MatrixBase< TangentVectorPool3 > &tau)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
GeometryModel & buildGeom(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const std::string &filename, const GeometryType type, GeometryModel &geom_model, const std::vector< std::string > &package_paths=std::vector< std::string >(), ::hpp::fcl::MeshLoaderPtr mesh_loader=::hpp::fcl::MeshLoaderPtr())
Build The GeometryModel from a URDF file. Search for meshes in the directories specified by the user ...
Eigen::Matrix< bool, Eigen::Dynamic, 1 > VectorXb
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & rnea(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
void computeCollisionsInParallel(const size_t num_threads, BroadPhaseManagerPoolBase< BroadPhaseManagerDerived, Scalar, Options, JointCollectionTpl > &pool, const Eigen::MatrixBase< ConfigVectorPool > &q, const Eigen::MatrixBase< CollisionVectorResult > &res, const bool stopAtFirstCollisionInConfiguration=false, const bool stopAtFirstCollisionInBatch=false)
#define PINOCCHIO_ALIGNED_STD_VECTOR(Type)
Eigen::Matrix< bool, Eigen::Dynamic, 1 > VectorXb
AD< Scalar > max(const AD< Scalar > &x, const AD< Scalar > &y)
Main pinocchio namespace.
#define PINOCCHIO_MODEL_DIR
void removeCollisionPairs(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, GeometryModel &geom_model, const std::string &filename, const bool verbose=false)
Deactive all possible collision pairs mentioned in the SRDF file. It throws if the SRDF file is incor...
pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:33