Drake
SimDiagramBuilder< T > Class Template Reference

A wrapper class around DiagramBuilder that facilitates diagram building for controlled simulation. More...

#include <drake/manipulation/util/sim_diagram_builder.h>

Public Member Functions

 SimDiagramBuilder ()
 
std::unique_ptr< systems::Diagram< T > > Build ()
 Builds a Diagram in two steps: connects all the StateFeedbackControllerInterface added using AddController() with the RigidBodyPlant added using AddPlant(), and connects the DrakeVisualizer if available with the plant. More...
 
void BuildInto (systems::Diagram< T > *target)
 Builds a Diagram in two steps: connects all the StateFeedbackControllerInterface added using AddController() with the RigidBodyPlant added using AddPlant(), and connects the DrakeVisualizer if available with the plant. More...
 
systems::RigidBodyPlant< T > * AddPlant (std::unique_ptr< systems::RigidBodyPlant< T >> plant)
 Adds a RigidBodyPlant. More...
 
systems::RigidBodyPlant< T > * AddPlant (std::unique_ptr< RigidBodyTree< T >> world_tree)
 Adds a RigidBodyPlant. More...
 
systems::DrakeVisualizerAddVisualizer (drake::lcm::DrakeLcmInterface *lcm)
 Adds a DrakeVisualizer. More...
 
template<class ControllerType >
ControllerType * AddController (int instance_id, std::unique_ptr< ControllerType > controller)
 Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface. More...
 
template<class ControllerType >
ControllerType * AddController (std::unique_ptr< ControllerType > controller)
 Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface<T>. More...
 
template<class ControllerType , typename... Args>
ControllerType * AddController (int instance_id, Args &&...args)
 Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface<T>. More...
 
systems::controllers::StateFeedbackControllerInterface< T > * get_controller (int instance_id) const
 Returns a StateFeedbackControllerInterface pointer to the controller for model instance instance_id. More...
 
systems::controllers::StateFeedbackControllerInterface< T > * get_controller () const
 Returns a StateFeedbackControllerInterface pointer to the controller. More...
 
systems::RigidBodyPlant< T > * get_plant () const
 Returns a pointer to the RigidBodyPlant. More...
 
systems::DiagramBuilder< T > * get_mutable_builder ()
 Returns a pointer to the underlying DiagramBuilder. More...
 
systems::DrakeVisualizerget_visualizer ()
 Returns a pointer to the DrakeVisualizer. More...
 
Does not allow copy, move, or assignment
 SimDiagramBuilder (const SimDiagramBuilder &)=delete
 
SimDiagramBuilderoperator= (const SimDiagramBuilder &)=delete
 
 SimDiagramBuilder (SimDiagramBuilder &&)=delete
 
SimDiagramBuilderoperator= (SimDiagramBuilder &&)=delete
 

Detailed Description

template<typename T>
class drake::manipulation::util::SimDiagramBuilder< T >

A wrapper class around DiagramBuilder that facilitates diagram building for controlled simulation.

This class provides three utilities: adding / accessing RigidBodyPlant, StateFeedbackControllerInterface and DrakeVisualizer. Access to a mutable DiagramBuilder is provided by get_mutable_builder().

Constructor & Destructor Documentation

SimDiagramBuilder ( const SimDiagramBuilder< T > &  )
delete
SimDiagramBuilder ( SimDiagramBuilder< T > &&  )
delete
SimDiagramBuilder ( )
inline

Member Function Documentation

ControllerType* AddController ( int  instance_id,
std::unique_ptr< ControllerType >  controller 
)
inline

Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface.

Parameters
instance_idIdentifier for the model instance in the RigidBodyPlant to be controlled by the added controller. Each model instance can have at most one controller.
controllerUnique pointer to the controller. Ownership will be transfered.
Returns
Pointer to the added controller.

Here is the caller graph for this function:

ControllerType* AddController ( std::unique_ptr< ControllerType >  controller)
inline

Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface<T>.

Assumes the RigidBodyPlant only has one model instance. Can be called at most once.

Parameters
controllerUnique pointer to the controller. Ownership will be transfered.
Returns
Pointer to the added controller.

Here is the call graph for this function:

ControllerType* AddController ( int  instance_id,
Args &&...  args 
)
inline

Adds a controller of type ControllerType, which must be derived from StateFeedbackControllerInterface<T>.

Parameters
instance_idIdentifier for the model instance in the RigidBodyPlant to be controlled by the added controller. Each model instance can have at most one controller.
argsArguments used to make a new ControllerType instance.
Returns
Pointer to the added controller.

Here is the call graph for this function:

systems::RigidBodyPlant< T > * AddPlant ( std::unique_ptr< systems::RigidBodyPlant< T >>  plant)

Adds a RigidBodyPlant.

Can be called at most once.

Parameters
plantunique pointer to the RigidBodyPlant. Ownership will be transfered.
Returns
Pointer to the added plant.

Here is the caller graph for this function:

systems::RigidBodyPlant< T > * AddPlant ( std::unique_ptr< RigidBodyTree< T >>  world_tree)

Adds a RigidBodyPlant.

Can be called at most once.

Parameters
plantunique pointer to a RigidBodyTree that is used to construct a RigidBodyPlant. Ownership will be transfered.
Returns
Pointer to the added plant.

Here is the call graph for this function:

Adds a DrakeVisualizer.

Can be called at most once. Must be called after AddPlant().

Parameters
lcmPointer to a lcm interface.
Returns
Pointer to the added visualizer.

Here is the caller graph for this function:

std::unique_ptr<systems::Diagram<T> > Build ( )
inline

Builds a Diagram in two steps: connects all the StateFeedbackControllerInterface added using AddController() with the RigidBodyPlant added using AddPlant(), and connects the DrakeVisualizer if available with the plant.

Then calls DiagramBuilder's Build() method and returns the resulting diagram. Must be called after AddPlant().

void BuildInto ( systems::Diagram< T > *  target)
inline

Builds a Diagram in two steps: connects all the StateFeedbackControllerInterface added using AddController() with the RigidBodyPlant added using AddPlant(), and connects the DrakeVisualizer if available with the plant.

Then calls DiagramBuilder's BuildInto() method. Must be called after AddPlant().

Parameters
[out]targetPointer to the resulting diagram.

Here is the call graph for this function:

systems::controllers::StateFeedbackControllerInterface<T>* get_controller ( int  instance_id) const
inline

Returns a StateFeedbackControllerInterface pointer to the controller for model instance instance_id.

systems::controllers::StateFeedbackControllerInterface<T>* get_controller ( ) const
inline

Returns a StateFeedbackControllerInterface pointer to the controller.

Assumes the RigidBodyPlant only has one model instance.

systems::DiagramBuilder<T>* get_mutable_builder ( )
inline

Returns a pointer to the underlying DiagramBuilder.

systems::RigidBodyPlant<T>* get_plant ( ) const
inline

Returns a pointer to the RigidBodyPlant.

systems::DrakeVisualizer* get_visualizer ( )
inline

Returns a pointer to the DrakeVisualizer.

SimDiagramBuilder& operator= ( const SimDiagramBuilder< T > &  )
delete
SimDiagramBuilder& operator= ( SimDiagramBuilder< T > &&  )
delete

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