PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members
ControllerMethod Class Referenceabstract

Public Member Functions

Disabled Functions

Regular copy/move is not allowed because there can only be one controller per robot, and it must be constructed with the robot pointer present.

 ControllerMethod (const ControllerMethod &)=delete
 
 ControllerMethod (ControllerMethod &&)=delete
 
ControllerMethodoperator= (const ControllerMethod &)=delete
 
ControllerMethodoperator= (ControllerMethod &&)=delete
 
Interface
virtual Control operator() (const Cfg &_current, const Cfg &_target, const double _dt)
 
virtual Control GetRandomControl (const Cfg &_current, const double _dt) const noexcept
 
ControlSet * GetControlSet () noexcept
 
void SetControlSet (ControlSet *const _c) noexcept
 

Protected Member Functions

Control Selection
virtual std::vector< double > ComputeDesiredForce (const Cfg &_current, const Cfg &_target, const double _dt)=0
 
virtual Control ComputeNearestControl (const Cfg &_current, std::vector< double > &&_force)
 
virtual Control ComputeNearestContinuousControl (const Cfg &_current, std::vector< double > &&_force)
 
virtual Control ComputeNearestDiscreteControl (const Cfg &_current, std::vector< double > &&_force)
 

Protected Attributes

Internal State
Robot *const m_robot
 The owning robot object.
 
ControlSet * m_controls {nullptr}
 The discrete controls, if any.
 
bool m_debug {false}
 Show debug messages?
 

Construction

 ControllerMethod (Robot *const _r)
 
 ControllerMethod (Robot *const _r, XMLNode &_node)
 
 ControllerMethod (Robot *const _r, const ControllerMethod &_c)
 
virtual std::unique_ptr< ControllerMethodClone (Robot *const _r) const =0
 
virtual ~ControllerMethod ()
 
static std::unique_ptr< ControllerMethodFactory (Robot *const _r, XMLNode &_node)
 

Detailed Description

Controllers determine the best control needed to move a robot from one configuration to another. They require the standard Cfg as the planning space representation because that's what we can support in simulation.

@TODO Implement simultaneous use of controls from more than one actuator.

Constructor & Destructor Documentation

◆ ControllerMethod() [1/3]

ControllerMethod::ControllerMethod ( Robot *const  _r)

Construct a controller for a given robot.

Parameters
_rThe robot to control.

◆ ControllerMethod() [2/3]

ControllerMethod::ControllerMethod ( Robot *const  _r,
XMLNode _node 
)

Construct a controller for a given robot from an XML node.

Parameters
_rThe robot to control.
_nodeThe XML node to read parameters from.

◆ ControllerMethod() [3/3]

ControllerMethod::ControllerMethod ( Robot *const  _r,
const ControllerMethod _c 
)

Copy a controller for another robot.

Parameters
_rThe destination robot.
_cThe controller to copy.

Member Function Documentation

◆ Factory()

std::unique_ptr< ControllerMethod > ControllerMethod::Factory ( Robot *const  _r,
XMLNode _node 
)
static

Create a dynamically-allocated controller from an XML node.

Parameters
_rThe robot to control.
_nodeThe XML node to read parameters from.
Returns
A controller of the type described by _node.

◆ Clone()

virtual std::unique_ptr< ControllerMethod > ControllerMethod::Clone ( Robot *const  _r) const
pure virtual

Create a copy of this controller for another robot. This is provided so that we can copy controllers without knowing their derived type.

Parameters
_rThe robot receiving the cloned controller.
Returns
The cloned controller.

Implemented in ICreateController, CarlikeNeedleController, MatlabNeedleController, PIDFeedback, and SimpleController.

◆ operator()()

Control ControllerMethod::operator() ( const Cfg _current,
const Cfg _target,
const double  _dt 
)
virtual

Find the best available control to steer a robot from a starting configuration to a target configuration.

Parameters
_currentThe current configuration.
_targetThe target configuration.
_dtThe timestep length.
Returns
The best available control for steering from _current to _target.

Reimplemented in PIDFeedback, and MatlabNeedleController.

◆ GetRandomControl()

Control ControllerMethod::GetRandomControl ( const Cfg _current,
const double  _dt 
) const
virtualnoexcept

Find a random control.

Parameters
_currentThe current configuration.
_dtThe timestep length.
Returns
A random control that can be executed from _current for _dt steps.

Reimplemented in CarlikeNeedleController, and MatlabNeedleController.

◆ GetControlSet()

ControlSet * ControllerMethod::GetControlSet ( )
noexcept

Get the discrete set of controls that this controller can use, if any.

Returns
The discrete set of controls for this controller, or null if it uses a continuous space(s) of controls.

◆ SetControlSet()

void ControllerMethod::SetControlSet ( ControlSet *const  _c)
noexcept

Set a discrete set of controls for this controller to use. This limits the controller to a subset of all possible controls accepted by a robot's actuators.

Parameters
_cThe control set to use.

◆ ComputeDesiredForce()

virtual std::vector< double > ControllerMethod::ComputeDesiredForce ( const Cfg _current,
const Cfg _target,
const double  _dt 
)
protectedpure virtual

Compute the desired generalized force (or velocity) in the robot's local frame to move from the current position to the target.

Parameters
_currentThe current configuration.
_targetThe target configuration.
_dtThe timestep length.
Returns
The ideal generalized force.

Implemented in CarlikeNeedleController, ICreateController, PIDFeedback, SimpleController, and MatlabNeedleController.

◆ ComputeNearestControl()

Control ControllerMethod::ComputeNearestControl ( const Cfg _current,
std::vector< double > &&  _force 
)
protectedvirtual

Compute the control that produces the closest force to the ideal.

Parameters
_currentThe current configuration.
_forceThe desired force in the robot's local frame.
Returns
The control whose result is nearest to _force.

◆ ComputeNearestContinuousControl()

Control ControllerMethod::ComputeNearestContinuousControl ( const Cfg _current,
std::vector< double > &&  _force 
)
protectedvirtual

Compute the continuous control that produces the closest force to the ideal.

Parameters
_currentThe current configuration.
_forceThe desired force in the robot's local frame.
Returns
The control whose result is nearest to _force.

Reimplemented in CarlikeNeedleController.

◆ ComputeNearestDiscreteControl()

Control ControllerMethod::ComputeNearestDiscreteControl ( const Cfg _current,
std::vector< double > &&  _force 
)
protectedvirtual

Compute the discrete control that produces the closest force to the ideal.

Parameters
_currentThe current configuration.
_forceThe desired force in the robot's local frame.
Returns
The control whose result is nearest to _force.

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