17 #ifndef GAZEBO_PHYSICS_POPULATION_HH_ 
   18 #define GAZEBO_PHYSICS_POPULATION_HH_ 
   22 #include <ignition/math/Pose3.hh> 
   23 #include <ignition/math/Vector3.hh> 
   24 #include <boost/shared_ptr.hpp> 
   25 #include <boost/scoped_ptr.hpp> 
   39     class PopulationPrivate;
 
   45       public: ignition::math::Vector3d 
size;
 
   54       public: ignition::math::Vector3d 
step;
 
   57       public: ignition::math::Pose3d 
pose;
 
   90       public: 
Population(sdf::ElementPtr _sdf, boost::shared_ptr<World> _world);
 
   98       public: 
bool PopulateAll();
 
  104       private: 
bool PopulateOne(
const sdf::ElementPtr _population);
 
  112       private: 
template<
typename T> 
bool ValueFromSdf(
 
  113         const sdf::ElementPtr &_sdfElement, 
const std::string &_element,
 
  116         if (_sdfElement->HasElement(_element))
 
  118           _value = _sdfElement->Get<T>(_element);
 
  121         gzerr << 
"Unable to find <" << _element << 
"> inside the population tag" 
  132       private: 
bool ElementFromSdf(
const sdf::ElementPtr &_sdfElement,
 
  133         const std::string &_element, sdf::ElementPtr &_value);
 
  143       private: 
bool ParseSdf(sdf::ElementPtr _population,
 
  154         std::vector<ignition::math::Vector3d> &_poses);
 
  165         std::vector<ignition::math::Vector3d> &_poses);
 
  178         std::vector<ignition::math::Vector3d> &_poses);
 
  188         std::vector<ignition::math::Vector3d> &_poses);
 
  198         std::vector<ignition::math::Vector3d> &_poses);
 
  208         std::vector<ignition::math::Vector3d> &_poses);
 
  220       private: 
void CreatePosesCylinderRandom(
 
  222         std::vector<ignition::math::Vector3d> &_poses);
 
  235       private: 
void CreatePosesCylinderUniform(
 
  237         std::vector<ignition::math::Vector3d> &_poses);
 
  241       private: boost::scoped_ptr<PopulationPrivate> dataPtr;
 
std::string distribution
Object distribution. E.g.: random, grid. 
Definition: Population.hh:75
 
Class that automatically populates an environment with multiple objects based on several parameters t...
Definition: Population.hh:85
 
double radius
Radius of the cylinder's base containing the models. 
Definition: Population.hh:60
 
ignition::math::Vector3d size
The three side lengths of the box. 
Definition: Population.hh:45
 
std::string region
Type region in which the objects will be spawned. E.g.: box. 
Definition: Population.hh:78
 
int cols
Number of columns used when models are distributed as a grid. 
Definition: Population.hh:51
 
#define gzerr
Output an error message. 
Definition: Console.hh:50
 
Stores all the posible parameters that define a population. 
Definition: Population.hh:42
 
int modelCount
Number of models to spawn. 
Definition: Population.hh:72
 
ignition::math::Vector3d step
Distance between models when they are distributed as a grid. 
Definition: Population.hh:54
 
int rows
Number of rows used when models are distributed as a grid. 
Definition: Population.hh:48
 
std::string modelName
Name of the model. 
Definition: Population.hh:66
 
ignition::math::Pose3d pose
The reference frame of the population's region. 
Definition: Population.hh:57
 
double length
Length of the cylinder containing the models. 
Definition: Population.hh:63
 
std::string modelSdf
Contains the sdf representation of the model. 
Definition: Population.hh:69