DRPlugin Class Reference

Multi-purpose domain randomization plugin. More...

#include <DRPlugin.hh>

Public Member Functions

 DRPlugin ()
 Constructs the object. More...
 
virtual ~DRPlugin ()
 Destroys the object. More...
 
virtual void Load (physics::WorldPtr _world, sdf::ElementPtr _sdf)
 Loads the plugin. More...
 
void onUpdate ()
 Called on World Update event. More...
 
void onRequest (DRRequestPtr &_msg)
 Callback function for handling incoming requests. More...
 

Static Public Attributes

static const char REQUEST_TOPIC [] = "~/dr"
 Topic for DRPlugin requests. More...
 
static const char RESPONSE_TOPIC [] = "~/dr/response"
 Topic for DRPlugin responses. More...
 
static const int POSITION = 0
 Position controller type. More...
 
static const int VELOCITY = 1
 Velocity controller type. More...
 

Private Member Functions

void processPhysics (const msgs::Physics &msg)
 Processes physics message. More...
 
void processModel (const msgs::Model &msg)
 Processes model message. More...
 
void processJoint (physics::ModelPtr model, const msgs::Joint &msg)
 Updates joint. More...
 
void processLink (physics::ModelPtr model, const msgs::Link &msg)
 Updates link. More...
 
void processInertial (physics::LinkPtr link, const msgs::Inertial &msg)
 Updates inertial. More...
 
void processSurface (physics::CollisionPtr collision, const msgs::Surface &msg)
 Updates surface. More...
 
void processModelCmd (const ModelCmdMsg &msg)
 Processes model command message. More...
 
void processJointCmd (physics::ModelPtr model, const msgs::JointCmd &msg)
 Processes joint command message. More...
 
void processPID (int type, physics::JointControllerPtr controller, const std::string &joint, const msgs::PID &msg)
 Updates PID controller. More...
 

Private Attributes

std::unique_ptr< DRPluginPrivatedata_ptr
 Class with private attributes. More...
 
event::ConnectionPtr update_connection
 Connection to world update event. More...
 
physics::WorldPtr world
 World to which the plugin is attached. More...
 
physics::PhysicsEnginePtr physics_engine
 Physics engine pointer. More...
 
boost::shared_ptr< DRRequest const > msg
 Pending request. More...
 

Detailed Description

Multi-purpose domain randomization plugin.

See the example usage below:

1 <plugin name="domain_randomization_plugin" filename="libDRPlugin.so"/>

See worlds/domain_randomization.world for a complete example.

Constructor & Destructor Documentation

DRPlugin ( )

Constructs the object.

~DRPlugin ( )
virtual

Destroys the object.

Member Function Documentation

void Load ( physics::WorldPtr  _world,
sdf::ElementPtr  _sdf 
)
virtual

Loads the plugin.

Parameters
_worldThe world pointer
_sdfThe sdf element pointer
void onRequest ( DRRequestPtr _msg)

Callback function for handling incoming requests.

Parameters
_msgThe message
void onUpdate ( )

Called on World Update event.

void processInertial ( physics::LinkPtr  link,
const msgs::Inertial &  msg 
)
private

Updates inertial.

Parameters
linkParent link pointer
msgInertial message
void processJoint ( physics::ModelPtr  model,
const msgs::Joint &  msg 
)
private

Updates joint.

Parameters
modelParent model pointer
msgJoint message
void processJointCmd ( physics::ModelPtr  model,
const msgs::JointCmd &  msg 
)
private

Processes joint command message.

Parameters
modelParent model pointer
msgJoint command message pointer
void processLink ( physics::ModelPtr  model,
const msgs::Link &  msg 
)
private

Updates link.

Parameters
modelParent model pointer
msgLink message
void processModel ( const msgs::Model &  msg)
private

Processes model message.

Parameters
msgModel message
void processModelCmd ( const ModelCmdMsg msg)
private

Processes model command message.

Parameters
msgJoint command message pointer
void processPhysics ( const msgs::Physics &  msg)
private

Processes physics message.

Parameters
msgPhysics message
void processPID ( int  type,
physics::JointControllerPtr  controller,
const std::string &  joint,
const msgs::PID &  msg 
)
private

Updates PID controller.

Parameters
typePID controller type (POSITION or VELOCITY)
controllerJoint controller pointer
jointTarget joint name
msgPID message pointer
void processSurface ( physics::CollisionPtr  collision,
const msgs::Surface &  msg 
)
private

Updates surface.

Parameters
collisionParent collision pointer
msgSurface message

Member Data Documentation

std::unique_ptr<DRPluginPrivate> data_ptr
private

Class with private attributes.

boost::shared_ptr<DRRequest const> msg
private

Pending request.

physics::PhysicsEnginePtr physics_engine
private

Physics engine pointer.

const int POSITION = 0
static

Position controller type.

const char REQUEST_TOPIC = "~/dr"
static

Topic for DRPlugin requests.

const char RESPONSE_TOPIC = "~/dr/response"
static

Topic for DRPlugin responses.

event::ConnectionPtr update_connection
private

Connection to world update event.

const int VELOCITY = 1
static

Velocity controller type.

physics::WorldPtr world
private

World to which the plugin is attached.


The documentation for this class was generated from the following files: