Go to the documentation of this file. 1 #ifndef AIKIDO_CONTROL_EXECUTOR_HPP_
2 #define AIKIDO_CONTROL_EXECUTOR_HPP_
8 #include <dart/dart.hpp>
58 const std::set<ExecutorType>& types,
59 const std::vector<dart::dynamics::DegreeOfFreedom*>& dofs,
68 const std::vector<dart::dynamics::DegreeOfFreedom*>& dofs,
74 std::set<ExecutorType>
getTypes()
const;
77 const std::vector<dart::dynamics::DegreeOfFreedom*>
getDofs()
const;
85 const std::chrono::system_clock::time_point& )
117 step(std::chrono::system_clock::now());
129 unordered_map<ExecutorType, std::set<dart::dynamics::DegreeOfFreedom*>>
136 std::unique_ptr<aikido::common::ExecutorThread>
mThread;
143 std::vector<dart::dynamics::DegreeOfFreedom*>
mDofs;
static std::unordered_map< ExecutorType, std::set< dart::dynamics::DegreeOfFreedom * > > mDofManager
Manager for locking resources for degrees of freedom.
Definition: Executor.hpp:130
Executor(const std::set< ExecutorType > &types, const std::vector< dart::dynamics::DegreeOfFreedom * > &dofs, const std::chrono::milliseconds threadRate=defaultThreadRate)
Constructor.
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
bool mDofsRegistered
Whether this executor has a lock on its DoF resources.
Definition: Executor.hpp:125
std::vector< dart::dynamics::DegreeOfFreedom * > mDofs
Vector of dof names.
Definition: Executor.hpp:143
std::set< ExecutorType > mTypes
Vector of executor types.
Definition: Executor.hpp:140
std::set< ExecutorType > getTypes() const
Get all of this Executor's ExecutorTypes.
virtual void step(const std::chrono::system_clock::time_point &)
Step to a point in time.
Definition: Executor.hpp:84
virtual void cancel()
Cancel the current command.
Definition: Executor.hpp:105
static std::mutex mMutex
Mutex to protects the DofManager.
Definition: Executor.hpp:133
void start()
Start the underlying ExecutorThread.
void spin()
Call to spin first to pass current time to step Necessary for real-time execution via mThread.
Definition: Executor.hpp:113
void releaseDofs()
Unlock any resources required by the DoFs.
constexpr std::chrono::milliseconds defaultThreadRate
Default rate for ExecutorThread to call step()
Definition: Executor.hpp:47
bool registerDofs()
Lock the resources required by the DoFs.
std::unique_ptr< aikido::common::ExecutorThread > mThread
Executor thread calling step function.
Definition: Executor.hpp:136
ExecutorType
Type of executor Can be used to determine if 2 executors make conflicting demands of individual degre...
Definition: Executor.hpp:35
const std::vector< dart::dynamics::DegreeOfFreedom * > getDofs() const
Get list of dofs needed by this Executor.
Abstract class for executing commands on degrees of freedom.
Definition: Executor.hpp:50
#define AIKIDO_DECLARE_POINTERS(X)
Definition: pointers.hpp:21
void stop()
Stops the underlying ExecutorThread.
std::chrono::milliseconds mThreadRate
How often to run spin() on internal thread.
Definition: Executor.hpp:122