Aikido
aikido::control::Executor Class Reference

Abstract class for executing commands on degrees of freedom. More...

#include <aikido/control/Executor.hpp>

Inheritance diagram for aikido::control::Executor:
aikido::control::JointCommandExecutor< T > aikido::control::TrajectoryExecutor aikido::control::VisualServoingVelocityExecutor aikido::control::JacobianExecutor< T > aikido::control::KinematicSimulationJointCommandExecutor< T > aikido::control::ros::RosJointCommandExecutor< T > aikido::control::InstantaneousTrajectoryExecutor aikido::control::KinematicSimulationTrajectoryExecutor aikido::control::QueuedTrajectoryExecutor aikido::control::ros::RosTrajectoryExecutor

Public Member Functions

 Executor (const std::set< ExecutorType > &types, const std::vector< dart::dynamics::DegreeOfFreedom * > &dofs, const std::chrono::milliseconds threadRate=defaultThreadRate)
 Constructor. More...
 
 Executor (const ExecutorType type, const std::vector< dart::dynamics::DegreeOfFreedom * > &dofs, std::chrono::milliseconds threadRate=defaultThreadRate)
 Constructor. More...
 
virtual ~Executor ()
 
std::set< ExecutorTypegetTypes () const
 Get all of this Executor's ExecutorTypes. More...
 
const std::vector< dart::dynamics::DegreeOfFreedom * > getDofs () const
 Get list of dofs needed by this Executor. More...
 
virtual void step (const std::chrono::system_clock::time_point &)
 Step to a point in time. More...
 
void start ()
 Start the underlying ExecutorThread. More...
 
void stop ()
 Stops the underlying ExecutorThread. More...
 
bool registerDofs ()
 Lock the resources required by the DoFs. More...
 
void releaseDofs ()
 Unlock any resources required by the DoFs. More...
 
virtual void cancel ()
 Cancel the current command. More...
 

Protected Attributes

std::set< ExecutorTypemTypes
 Vector of executor types. More...
 
std::vector< dart::dynamics::DegreeOfFreedom * > mDofs
 Vector of dof names. More...
 

Private Member Functions

void spin ()
 Call to spin first to pass current time to step Necessary for real-time execution via mThread. More...
 

Private Attributes

std::chrono::milliseconds mThreadRate
 How often to run spin() on internal thread. More...
 
bool mDofsRegistered {false}
 Whether this executor has a lock on its DoF resources. More...
 
std::unique_ptr< aikido::common::ExecutorThreadmThread
 Executor thread calling step function. More...
 

Static Private Attributes

static std::unordered_map< ExecutorType, std::set< dart::dynamics::DegreeOfFreedom * > > mDofManager
 Manager for locking resources for degrees of freedom. More...
 
static std::mutex mMutex
 Mutex to protects the DofManager. More...
 

Detailed Description

Abstract class for executing commands on degrees of freedom.

Constructor & Destructor Documentation

◆ Executor() [1/2]

aikido::control::Executor::Executor ( const std::set< ExecutorType > &  types,
const std::vector< dart::dynamics::DegreeOfFreedom * > &  dofs,
const std::chrono::milliseconds  threadRate = defaultThreadRate 
)

Constructor.

Parameters
[in]typesSet of controller types
[in]dofsVector of degree-of-freedom names this Executor acts upon
[in]threadRate(Optional) How often to call step()

◆ Executor() [2/2]

aikido::control::Executor::Executor ( const ExecutorType  type,
const std::vector< dart::dynamics::DegreeOfFreedom * > &  dofs,
std::chrono::milliseconds  threadRate = defaultThreadRate 
)

Constructor.

Parameters
[in]typeSingle type to be added to this class's set of types
[in]dofsVector of degree-of-freedom names this Executor acts upon
[in]threadRate(Optional) How often to call step()

◆ ~Executor()

virtual aikido::control::Executor::~Executor ( )
virtual

Member Function Documentation

◆ cancel()

◆ getDofs()

const std::vector<dart::dynamics::DegreeOfFreedom*> aikido::control::Executor::getDofs ( ) const

Get list of dofs needed by this Executor.

◆ getTypes()

std::set<ExecutorType> aikido::control::Executor::getTypes ( ) const

Get all of this Executor's ExecutorTypes.

◆ registerDofs()

bool aikido::control::Executor::registerDofs ( )

Lock the resources required by the DoFs.

Returns
True if locked successfully, false otherwise.

◆ releaseDofs()

void aikido::control::Executor::releaseDofs ( )

Unlock any resources required by the DoFs.

◆ spin()

void aikido::control::Executor::spin ( )
inlineprivate

Call to spin first to pass current time to step Necessary for real-time execution via mThread.

◆ start()

void aikido::control::Executor::start ( )

Start the underlying ExecutorThread.

◆ step()

◆ stop()

void aikido::control::Executor::stop ( )

Stops the underlying ExecutorThread.

Member Data Documentation

◆ mDofManager

std:: unordered_map<ExecutorType, std::set<dart::dynamics::DegreeOfFreedom*> > aikido::control::Executor::mDofManager
staticprivate

Manager for locking resources for degrees of freedom.

◆ mDofs

std::vector<dart::dynamics::DegreeOfFreedom*> aikido::control::Executor::mDofs
protected

Vector of dof names.

◆ mDofsRegistered

bool aikido::control::Executor::mDofsRegistered {false}
private

Whether this executor has a lock on its DoF resources.

◆ mMutex

std::mutex aikido::control::Executor::mMutex
staticprivate

Mutex to protects the DofManager.

◆ mThread

std::unique_ptr<aikido::common::ExecutorThread> aikido::control::Executor::mThread
private

Executor thread calling step function.

◆ mThreadRate

std::chrono::milliseconds aikido::control::Executor::mThreadRate
private

How often to run spin() on internal thread.

◆ mTypes

std::set<ExecutorType> aikido::control::Executor::mTypes
protected

Vector of executor types.