CartesianInterface API Reference
The header files CartesianInterface.h
and CartesianInterfaceImpl.h
contain the API definition for the main CartesIO class, which users can load
via the provided factory method CartesianInterfaceImpl::MakeInstance()
.
After loading, the recommended way to interact with the defined tasks
and constraint is to use their own specific APIs, as
obtained via the getTask() method.
-
class XBot::Cartesian::CartesianInterface
The CartesianInterface class provides interfaces to perform cartesian control of floating base robots in a generic fashion.
The recommended way to interact with the defined tasks and constraint is to use their own specific APIs, as obtained via the getTask() method.
Subclassed by XBot::Cartesian::CartesianInterfaceImpl
Public Functions
-
virtual bool update(double time, double period) = 0
Update function. It must be called periodically inside the user control loop.
- Parameters
time – current time [s]
period – period between last call and current one [s]
- Returns
true if no errors occurred
-
virtual bool reset(double time) = 0
Reset all cartesian references to current model pose. It also resets time.
- Parameters
time – Current time
-
virtual bool resetWorld(const Eigen::Affine3d &w_T_new_world) = 0
Reset the world frame and call reset().
- Parameters
w_T_new_world – is the new world pose w.r.t. old world
-
virtual const std::vector<std::string> &getTaskList() const = 0
getTaskList returns the list of all defined tasks and constraints; returned elements may be used as arguments to getTask()
-
virtual TaskDescription::Ptr getTask(const std::string &task_name) = 0
getTask returns a shared pointer to the task or constraint with given name, if it exists. It returns a null shared pointer otherwise. From CartesI/O v2.0 on, the recommended way to interact with tasks and constraints is to use the returned task handle, casted to the appropriate type (e.g. ‘CartesianTask’) via std::dynamic_pointer_task<>()
- Parameters
task_name –
- Returns
a shared pointer to the task or constraint
-
virtual int getCurrentSegmentId(const std::string &end_effector) const = 0
If the specified task (arg #1) is performing a reaching motion, returns the index of the waypoint that is currently being processed. Otherwise, a negative value is returned.
- Parameters
Task – name
- Returns
A value between 0 and N-1 (-1 if task is not in reaching phase)
-
virtual bool update(double time, double period) = 0
-
class XBot::Cartesian::CartesianInterfaceImpl : public XBot::Cartesian::CartesianInterface
The CartesianInterfaceImpl class allows to implement the interface given by CartesianInterface, and provides a factory method to load such implementations.
Subclassed by XBot::Cartesian::LockfreeBufferImpl, XBot::Cartesian::RosClient
Public Functions
-
CartesianInterfaceImpl(ProblemDescription ik_problem, Context::Ptr context)
CartesianInterfaceImpl constructor. Most often, users should not use directly this. Rather, they should dynamically load an implementation via the factory method MakeInstance().
- Parameters
ik_problem – is a description of the problem to be solved
context – holds some data structures used by CartesIO, such as the robot model.
-
ModelInterface::Ptr getModel() const
getModel returns a shared pointer to the robot model used by this instance
-
const ProblemDescription &getIkProblem() const
getIkProblem returns a copy of the problem description used to construct this instance
-
Context::Ptr getContext()
getContext returns the context object used to construct this instance
-
Context::ConstPtr getContext() const
getContext returns the context object used to construct this instance
-
const std::map<std::string, Eigen::VectorXd> &getSolution() const
getSolution returns a map containing all variables generated by the solver, together with the corresponding solution at the last call to update()
-
virtual const std::vector<std::string> &getTaskList() const
getTaskList returns the list of all defined tasks and constraints; returned elements may be used as arguments to getTask()
-
virtual int getCurrentSegmentId(const std::string &end_effector) const
If the specified task (arg #1) is performing a reaching motion, returns the index of the waypoint that is currently being processed. Otherwise, a negative value is returned.
- Parameters
Task – name
- Returns
A value between 0 and N-1 (-1 if task is not in reaching phase)
-
virtual bool update(double time, double period)
Update function. It must be called periodically inside the user control loop.
- Parameters
time – current time [s]
period – period between last call and current one [s]
- Returns
true if no errors occurred
-
virtual bool reset(double time)
Reset all cartesian references to current model pose. It also resets time.
- Parameters
time – Current time
-
virtual bool resetWorld(const Eigen::Affine3d &w_T_new_world)
Reset the world frame and call reset().
- Parameters
w_T_new_world – is the new world pose w.r.t. old world
-
virtual TaskDescription::Ptr getTask(const std::string &task_name)
getTask returns a shared pointer to the task or constraint with given name, if it exists. It returns a null shared pointer otherwise. From CartesI/O v2.0 on, the recommended way to interact with tasks and constraints is to use the returned task handle, casted to the appropriate type (e.g. ‘CartesianTask’) via std::dynamic_pointer_task<>()
- Parameters
task_name –
- Returns
a shared pointer to the task or constraint
Public Static Functions
-
static Ptr MakeInstance(std::string solver_name, ProblemDescription ik_problem, Context::Ptr context)
MakeInstance dynamically loads an implementation of CartesIO from a shared object, or plugin.
- Parameters
solver_name – is the plugin name
ik_problem – is a description of the problem to be solved
context – holds some data structures used by CartesIO, such as the robot model.
- Returns
a shared pointer to the requested object
-
CartesianInterfaceImpl(ProblemDescription ik_problem, Context::Ptr context)