17 #ifndef _GAZEBO_POPULATION_HH_
18 #define _GAZEBO_POPULATION_HH_
22 #include <boost/shared_ptr.hpp>
23 #include <boost/scoped_ptr.hpp>
39 class PopulationPrivate;
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<math::Vector3> &_poses);
165 std::vector<math::Vector3> &_poses);
178 std::vector<math::Vector3> &_poses);
188 std::vector<math::Vector3> &_poses);
198 std::vector<math::Vector3> &_poses);
208 std::vector<math::Vector3> &_poses);
220 private:
void CreatePosesCylinderRandom(
222 std::vector<math::Vector3> &_poses);
235 private:
void CreatePosesCylinderUniform(
237 std::vector<math::Vector3> &_poses);
241 private: boost::scoped_ptr<PopulationPrivate> dataPtr;
double length
Length of the cylinder containing the models.
Definition: Population.hh:63
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Class that automatically populates an environment with multiple objects based on several parameters t...
Definition: Population.hh:85
math::Vector3 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
#define gzerr
Output an error message.
Definition: Console.hh:49
Stores all the posible parameters that define a population.
Definition: Population.hh:42
std::string modelName
Name of the model.
Definition: Population.hh:66
std::string distribution
Object distribution. E.g.: random, grid.
Definition: Population.hh:75
math::Vector3 step
Distance between models when they are distributed as a grid.
Definition: Population.hh:54
double radius
Radius of the cylinder's base containing the models.
Definition: Population.hh:60
int rows
Number of rows used when models are distributed as a grid.
Definition: Population.hh:48
std::string modelSdf
Contains the sdf representation of the model.
Definition: Population.hh:69
math::Pose pose
The reference frame of the population's region.
Definition: Population.hh:57
int modelCount
Number of models to spawn.
Definition: Population.hh:72
int cols
Number of columns used when models are distributed as a grid.
Definition: Population.hh:51