A plugin that allows models to be spawned at a given location in a specific simulation time. As an example, this plugin might be used for placing objects in a conveyor belt. More...
#include <PopulationPlugin.hh>
Public Member Functions | |
virtual void | Load (physics::WorldPtr _world, sdf::ElementPtr _sdf) |
void | Pause () |
Pause the object population. | |
PopulationPlugin () | |
Constructor. | |
virtual void | Restart () |
Restart the the object population. | |
void | Resume () |
Resume the object population after a pause. | |
virtual | ~PopulationPlugin () |
Destructor. | |
Protected Member Functions | |
bool | Enabled () const |
True when the plugin is enabled or false if it's paused. | |
void | OnActivation (ConstGzStringPtr &_msg) |
Callback that receives activation messages. If the <activation_topic> is set in SDF, the plugin won't populate any object until the activation is received. | |
void | OnUpdate () |
Update the plugin. | |
Private Member Functions | |
virtual void | Publish () const |
Overwrite this method for sending periodic updates with the plugin state. | |
Private Attributes | |
std::unique_ptr < PopulationPluginPrivate > | dataPtr |
Private data pointer. |
A plugin that allows models to be spawned at a given location in a specific simulation time. As an example, this plugin might be used for placing objects in a conveyor belt.
The plugin accepts the following SDF parameters: <object_sequence>: Contains the list of objects to be populated. An object should be declared as an <object> element with the following parameters: <time> Simulation time to be spawned. <type> Model. <pose> Initial object pose.
<loop_forever>: Optional parameter. If true, all objects will be spawned as a circular buffer. After spawning the last element of the collection, the first one will be inserted.
<frame>: Optional parameter. If present, the poses of the objects will be in the frame of this link/model. Otherwise the world frame is used.
<activation_topic>: Optional parameter. If present, the objects won't be inserted in simulation until the proper command is received in the specified topic. Available commands: "restart" : The object population will be restarted. "stop" : Stop the object insertion.
Here's an example of a valid SDF:
<plugin filename="libPopulationPlugin.so" name="populate_conveyor"> <loop_forever>true</loop_forever> <object_sequence> <object> <time>8.0</time> <type>coke_can</type> <pose>1 6 1 0 0 0</pose> </object> <object> <time>4.0</time> <type>cordless_drill/</type> <pose>1 6 1 0 0 0</pose> </object> <object> <time>12.0</time> <type>beer</type> <pose>1 6 1 0 0 0</pose> </object> </object_sequence> </plugin>
Definition at line 81 of file PopulationPlugin.hh.
Constructor.
Definition at line 125 of file PopulationPlugin.cc.
PopulationPlugin::~PopulationPlugin | ( | ) | [virtual] |
Destructor.
Definition at line 131 of file PopulationPlugin.cc.
bool PopulationPlugin::Enabled | ( | ) | const [protected] |
True when the plugin is enabled or false if it's paused.
Definition at line 337 of file PopulationPlugin.cc.
void PopulationPlugin::Load | ( | physics::WorldPtr | _world, |
sdf::ElementPtr | _sdf | ||
) | [virtual] |
Reimplemented in gazebo::ROSPopulationPlugin.
Definition at line 136 of file PopulationPlugin.cc.
void PopulationPlugin::OnActivation | ( | ConstGzStringPtr & | _msg | ) | [protected] |
Callback that receives activation messages. If the <activation_topic> is set in SDF, the plugin won't populate any object until the activation is received.
[in] | _msg | String message that indicates the activation command. start|restart: Start/restart the object population. |
Definition at line 322 of file PopulationPlugin.cc.
void PopulationPlugin::OnUpdate | ( | ) | [protected] |
Update the plugin.
Definition at line 274 of file PopulationPlugin.cc.
void PopulationPlugin::Pause | ( | ) |
Pause the object population.
Definition at line 238 of file PopulationPlugin.cc.
void PopulationPlugin::Publish | ( | ) | const [private, virtual] |
Overwrite this method for sending periodic updates with the plugin state.
Reimplemented in gazebo::ROSPopulationPlugin.
Definition at line 343 of file PopulationPlugin.cc.
void PopulationPlugin::Restart | ( | ) | [virtual] |
Restart the the object population.
Definition at line 264 of file PopulationPlugin.cc.
void PopulationPlugin::Resume | ( | ) |
Resume the object population after a pause.
Definition at line 251 of file PopulationPlugin.cc.
std::unique_ptr<PopulationPluginPrivate> gazebo::PopulationPlugin::dataPtr [private] |
Private data pointer.
Reimplemented in gazebo::ROSPopulationPlugin.
Definition at line 119 of file PopulationPlugin.hh.