Unverified Commit c153dfd7 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1434 from jcarpent/topic/geometry

Enhance Pool at update level
parents 5d5ceddc 4cf648b8
Pipeline #14062 passed with stage
in 157 minutes and 59 seconds
......@@ -60,7 +60,10 @@ namespace pinocchio
bp::args("self","geometry_model"),
"Update the geometry model, meaning that all the datas will be refreshed accordingly.")
.def("update",(void (GeometryPool::*)(const GeometryData &))&GeometryPool::update,
bp::args("self","data"),"Update all the geometry datas with the input geometry data value.")
bp::args("self","geometry_data"),"Update all the geometry datas with the input geometry data value.")
.def("update",(void (GeometryPool::*)(const GeometryModel &, const GeometryData &))&GeometryPool::update,
bp::args("self","geometry_model","geometry_data"),
"Update the geometry model and data together.")
;
}
......
......@@ -64,6 +64,8 @@ namespace pinocchio
"Update the model, meaning that all the datas will be refreshed accordingly.")
.def("update",(void (ModelPool::*)(const Data &))&ModelPool::update,
bp::args("self","data"),"Update all the datas with the input data value.")
.def("update",(void (ModelPool::*)(const Model &, const Data &))&ModelPool::update,
bp::args("self","model","data"),"Update the model and data together.")
;
}
......
......@@ -243,10 +243,10 @@ namespace pinocchio
///
PairIndex collisionPairIndex;
/// \brief Functoqr associated to the computation of collisions.
/// \brief Functor associated to the computation of collisions.
PINOCCHIO_ALIGNED_STD_VECTOR(ComputeCollision) collision_functors;
/// \brief Functoqr associated to the computation of distances.
/// \brief Functor associated to the computation of distances.
PINOCCHIO_ALIGNED_STD_VECTOR(ComputeDistance) distance_functors;
#endif // PINOCCHIO_WITH_HPP_FCL
......
......@@ -112,6 +112,20 @@ namespace pinocchio
GeometryData(m_geometry_model));
}
///
/// \brief Update the geometry model and data with the new input values.
/// In this case, all the geometry_datas will be replaced
///
/// \param[in] geometry_model new geometry model value.
/// \param[in] geometry_data new geometry data value
///
void update(const GeometryModel & geometry_model,
const GeometryData & geometry_data)
{
m_geometry_model = geometry_model;
update(geometry_data);
}
/// \brief Destructor
virtual ~GeometryPoolTpl() {};
......@@ -130,7 +144,7 @@ namespace pinocchio
if(size() < new_size)
{
typename GeometryDataVector::iterator it = m_geometry_datas.begin();
std::advance(it, (size_t)(new_size - size()));
std::advance(it, (long)(new_size - size()));
std::fill(it,m_geometry_datas.end(),m_geometry_datas[0]);
}
}
......
......@@ -77,6 +77,20 @@ namespace pinocchio
{
std::fill(m_datas.begin(),m_datas.end(),data);
}
///
/// \brief Update the model and data with the new input values.
/// In this case, all the geometry_datas will be replaced
///
/// \param[in] geometry_model new geometry model value.
/// \param[in] geometry_data new geometry data value
///
void update(const Model & model,
const Data & data)
{
m_model = model;
update(data);
}
/// \brief Returns the size of the pool.
int size() const { return m_size; }
......@@ -88,7 +102,7 @@ namespace pinocchio
if(m_size < new_size)
{
typename DataVector::iterator it = m_datas.begin();
std::advance(it, (size_t)(new_size - m_size));
std::advance(it, (long)(new_size - m_size));
std::fill(it,m_datas.end(),m_datas[0]);
}
do_resize(new_size); // call Derived::do_resize();
......
......@@ -16,6 +16,32 @@ using namespace pinocchio;
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
BOOST_AUTO_TEST_CASE(test_pool)
{
const std::string filename = PINOCCHIO_MODEL_DIR + std::string("/example-robot-data/robots/talos_data/robots/talos_reduced.urdf");
pinocchio::Model model;
pinocchio::urdf::buildModel(filename,JointModelFreeFlyer(),model);
Data data(model);
const std::string package_path = PINOCCHIO_MODEL_DIR;
hpp::fcl::MeshLoaderPtr mesh_loader = boost::make_shared<hpp::fcl::CachedMeshLoader>();
const std::string srdf_filename = PINOCCHIO_MODEL_DIR + std::string("/example-robot-data/robots/talos_data/srdf/talos.srdf");
std::vector<std::string> package_paths(1,package_path);
pinocchio::GeometryModel geometry_model;
pinocchio::urdf::buildGeom(model,filename,COLLISION,geometry_model,package_paths,mesh_loader);
const int num_thread = omp_get_max_threads();
GeometryPool pool(model,pinocchio::GeometryModel(),num_thread);
pool.update(geometry_model);
BOOST_CHECK(pool.geometry_model() == geometry_model);
pool.update(GeometryData(geometry_model));
pool.update(geometry_model,GeometryData(geometry_model));
}
BOOST_AUTO_TEST_CASE(test_talos)
{
const std::string filename = PINOCCHIO_MODEL_DIR + std::string("/example-robot-data/robots/talos_data/robots/talos_reduced.urdf");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment