Skip to content
Snippets Groups Projects
Commit bc6ac1cd authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Use vector instead of list.

parent 4d209d8d
No related branches found
No related tags found
No related merge requests found
Pipeline #18560 failed
......@@ -144,6 +144,7 @@ namespace hpp {
typedef core::JointAndShapes_t JointAndShapes_t;
typedef std::list <std::string> StringList_t;
typedef std::vector <std::string> Strings_t;
namespace pathOptimization {
HPP_PREDEF_CLASS (SmallSteps);
......
......@@ -191,15 +191,15 @@ namespace hpp {
struct ObjectDef_t {
std::string name;
StringList_t handles, shapes;
Strings_t handles, shapes;
};
GraphPtr_t graphBuilder (
const ProblemSolverPtr_t& ps,
const std::string& graphName,
const StringList_t& griNames,
const std::list <ObjectDef_t>& objs,
const StringList_t& envNames,
const Strings_t& griNames,
const std::vector <ObjectDef_t>& objs,
const Strings_t& envNames,
const Rules_t& rules,
const value_type& prePlaceWidth = 0.05);
/// \}
......
......@@ -91,8 +91,8 @@ namespace hpp {
/// \param margin see hpp::constraints::ConvexShapeContact::setNormalMargin
///
void createPlacementConstraint (const std::string& name,
const StringList_t& surface1,
const StringList_t& surface2,
const Strings_t& surface1,
const Strings_t& surface2,
const value_type& margin = 1e-4);
/// Create pre-placement constraint
......@@ -103,8 +103,8 @@ namespace hpp {
/// \param margin see hpp::constraints::ConvexShapeContact::setNormalMargin
///
void createPrePlacementConstraint (const std::string& name,
const StringList_t& surface1,
const StringList_t& surface2,
const Strings_t& surface1,
const Strings_t& surface2,
const value_type& width,
const value_type& margin = 1e-4);
......
......@@ -1007,9 +1007,9 @@ namespace hpp {
GraphPtr_t graphBuilder (
const ProblemSolverPtr_t& ps,
const std::string& graphName,
const StringList_t& griNames,
const std::list <ObjectDef_t>& objs,
const StringList_t& envNames,
const Strings_t& griNames,
const std::vector <ObjectDef_t>& objs,
const Strings_t& envNames,
const std::vector <Rule>& rules,
const value_type& prePlaceWidth)
{
......
......@@ -239,17 +239,18 @@ namespace hpp {
}
void ProblemSolver::createPlacementConstraint
(const std::string& name, const StringList_t& surface1,
const StringList_t& surface2, const value_type& margin)
(const std::string& name, const Strings_t& surface1,
const Strings_t& surface2, const value_type& margin)
{
bool explicit_(true);
if (!robot_) throw std::runtime_error ("No robot loaded");
JointAndShapes_t floorSurfaces, objectSurfaces, l;
for (StringList_t::const_iterator it1 = surface1.begin ();
for (Strings_t::const_iterator it1 = surface1.begin ();
it1 != surface1.end(); ++it1) {
if (!robot_->jointAndShapes.has (*it1))
throw std::runtime_error ("First list of triangles not found.");
l = robot_->jointAndShapes.get (*it1);
objectSurfaces.insert(objectSurfaces.end(), l.begin(), l.end());
for(auto js : l){
JointPtr_t j(js.first);
// If one robot contact surface is not on a freeflying object,
......@@ -261,11 +262,10 @@ namespace hpp {
{
explicit_ = false;
}
objectSurfaces.insert(objectSurfaces.end(), l.begin(), l.end());
}
}
for (StringList_t::const_iterator it2 = surface2.begin ();
for (Strings_t::const_iterator it2 = surface2.begin ();
it2 != surface2.end(); ++it2) {
// Search first robot triangles
if (robot_->jointAndShapes.has (*it2))
......@@ -319,13 +319,13 @@ namespace hpp {
}
void ProblemSolver::createPrePlacementConstraint
(const std::string& name, const StringList_t& surface1,
const StringList_t& surface2, const value_type& width,
(const std::string& name, const Strings_t& surface1,
const Strings_t& surface2, const value_type& width,
const value_type& margin)
{
if (!robot_) throw std::runtime_error ("No robot loaded");
JointAndShapes_t floorSurfaces, objectSurfaces, l;
for (StringList_t::const_iterator it1 = surface1.begin ();
for (Strings_t::const_iterator it1 = surface1.begin ();
it1 != surface1.end(); ++it1) {
if (!robot_->jointAndShapes.has (*it1))
throw std::runtime_error ("First list of triangles not found.");
......@@ -333,7 +333,7 @@ namespace hpp {
objectSurfaces.insert(objectSurfaces.end(), l.begin(), l.end());
}
for (StringList_t::const_iterator it2 = surface2.begin ();
for (Strings_t::const_iterator it2 = surface2.begin ();
it2 != surface2.end(); ++it2) {
// Search first robot triangles
if (robot_->jointAndShapes.has (*it2))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment