YARP
Yet Another Robot Platform
CartesianControl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_DEV_CARTESIANCONTROL_H
8 #define YARP_DEV_CARTESIANCONTROL_H
9 
10 #include <yarp/os/Bottle.h>
11 #include <yarp/os/Stamp.h>
12 #include <yarp/dev/api.h>
13 #include <yarp/sig/Vector.h>
14 
19 namespace yarp {
20  namespace dev {
21  struct CartesianEventParameters;
22  struct CartesianEventVariables;
23  class CartesianEvent;
24  class ICartesianControl;
25  }
26 }
27 
28 
35 {
46  std::string type;
47 
54 };
55 
56 
63 {
68  std::string type;
69 
74  double time;
75 
81 };
82 
83 
91 {
92 public:
96  virtual ~CartesianEvent() {}
97 
103 
109 
113  virtual void cartesianEventCallback() = 0;
114 };
115 
116 
126 {
127 public:
132 
145  virtual bool setTrackingMode(const bool f) = 0;
146 
153  virtual bool getTrackingMode(bool *f) = 0;
154 
168  virtual bool setReferenceMode(const bool f) = 0;
169 
177  virtual bool getReferenceMode(bool *f) = 0;
178 
185  virtual bool setPosePriority(const std::string &p) = 0;
186 
192  virtual bool getPosePriority(std::string &p) = 0;
193 
207  yarp::os::Stamp *stamp=NULL) = 0;
208 
223  virtual bool getPose(const int axis, yarp::sig::Vector &x,
225  yarp::os::Stamp *stamp=NULL) = 0;
226 
240  virtual bool goToPose(const yarp::sig::Vector &xd,
241  const yarp::sig::Vector &od,
242  const double t = 0.0) = 0;
243 
255  virtual bool goToPosition(const yarp::sig::Vector &xd,
256  const double t = 0.0) = 0;
257 
272  virtual bool goToPoseSync(const yarp::sig::Vector &xd,
273  const yarp::sig::Vector &od,
274  const double t = 0.0) = 0;
275 
288  virtual bool goToPositionSync(const yarp::sig::Vector &xd,
289  const double t = 0.0) = 0;
290 
305  virtual bool getDesired(yarp::sig::Vector &xdhat,
306  yarp::sig::Vector &odhat,
307  yarp::sig::Vector &qdhat) = 0;
308 
328  virtual bool askForPose(const yarp::sig::Vector &xd,
329  const yarp::sig::Vector &od,
330  yarp::sig::Vector &xdhat,
331  yarp::sig::Vector &odhat,
332  yarp::sig::Vector &qdhat) = 0;
333 
356  virtual bool askForPose(const yarp::sig::Vector &q0,
357  const yarp::sig::Vector &xd,
358  const yarp::sig::Vector &od,
359  yarp::sig::Vector &xdhat,
360  yarp::sig::Vector &odhat,
361  yarp::sig::Vector &qdhat) = 0;
362 
379  virtual bool askForPosition(const yarp::sig::Vector &xd,
380  yarp::sig::Vector &xdhat,
381  yarp::sig::Vector &odhat,
382  yarp::sig::Vector &qdhat) = 0;
383 
403  virtual bool askForPosition(const yarp::sig::Vector &q0,
404  const yarp::sig::Vector &xd,
405  yarp::sig::Vector &xdhat,
406  yarp::sig::Vector &odhat,
407  yarp::sig::Vector &qdhat) = 0;
408 
421  virtual bool getDOF(yarp::sig::Vector &curDof) = 0;
422 
438  virtual bool setDOF(const yarp::sig::Vector &newDof,
439  yarp::sig::Vector &curDof) = 0;
440 
452  virtual bool getRestPos(yarp::sig::Vector &curRestPos) = 0;
453 
468  virtual bool setRestPos(const yarp::sig::Vector &newRestPos,
469  yarp::sig::Vector &curRestPos) = 0;
470 
482  virtual bool getRestWeights(yarp::sig::Vector &curRestWeights) = 0;
483 
498  virtual bool setRestWeights(const yarp::sig::Vector &newRestWeights,
499  yarp::sig::Vector &curRestWeights) = 0;
500 
509  virtual bool getLimits(const int axis, double *min, double *max) = 0;
510 
520  virtual bool setLimits(const int axis, const double min, const double max) = 0;
521 
527  virtual bool getTrajTime(double *t) = 0;
528 
534  virtual bool setTrajTime(const double t) = 0;
535 
544  virtual bool getInTargetTol(double *tol) = 0;
545 
554  virtual bool setInTargetTol(const double tol) = 0;
555 
562  virtual bool getJointsVelocities(yarp::sig::Vector &qdot) = 0;
563 
578  yarp::sig::Vector &odot) = 0;
579 
589  virtual bool setTaskVelocities(const yarp::sig::Vector &xdot,
590  const yarp::sig::Vector &odot) = 0;
591 
603  virtual bool attachTipFrame(const yarp::sig::Vector &x,
604  const yarp::sig::Vector &o) = 0;
605 
615 
622  virtual bool removeTipFrame() = 0;
623 
630  virtual bool checkMotionDone(bool *f) = 0;
631 
642  virtual bool waitMotionDone(const double period = 0.1,
643  const double timeout = 0.0) = 0;
644 
652  virtual bool stopControl() = 0;
653 
663  virtual bool storeContext(int *id) = 0;
664 
675  virtual bool restoreContext(const int id) = 0;
676 
682  virtual bool deleteContext(const int id) = 0;
683 
690  virtual bool getInfo(yarp::os::Bottle &info) = 0;
691 
700  virtual bool registerEvent(yarp::dev::CartesianEvent &event) = 0;
701 
707  virtual bool unregisterEvent(yarp::dev::CartesianEvent &event) = 0;
708 
718  virtual bool tweakSet(const yarp::os::Bottle &options) = 0;
719 
730  virtual bool tweakGet(yarp::os::Bottle &options) = 0;
731 };
732 
733 #endif // YARP_DEV_CARTESIANCONTROL_H
float t
contains the definition of a Vector type
Interface for a event notified by the cartesian controller.
yarp::dev::CartesianEventVariables cartesianEventVariables
The event handler fills this structure with useful information at run-time.
yarp::dev::CartesianEventParameters cartesianEventParameters
The user fills this structure to establish the event parameters.
virtual ~CartesianEvent()
Destructor.
virtual void cartesianEventCallback()=0
Event callback to be overridden by the user.
Interface for a cartesian controller.
virtual bool setRestWeights(const yarp::sig::Vector &newRestWeights, yarp::sig::Vector &curRestWeights)=0
Set a new joints rest position.
virtual bool goToPose(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, const double t=0.0)=0
Move the end-effector to a specified pose (position and orientation) in cartesian space.
virtual bool tweakSet(const yarp::os::Bottle &options)=0
Tweak low-level controller's parameters.
virtual bool getRestWeights(yarp::sig::Vector &curRestWeights)=0
Get the current joints rest weights.
virtual bool setTrackingMode(const bool f)=0
Set the controller in tracking or non-tracking mode.
virtual bool stopControl()=0
Ask for an immediate stop motion.
virtual bool getTipFrame(yarp::sig::Vector &x, yarp::sig::Vector &o)=0
Retrieve the tip frame currently attached to the end-effector.
virtual bool getInTargetTol(double *tol)=0
Return tolerance for in-target check.
virtual bool getReferenceMode(bool *f)=0
Get the current controller reference mode.
virtual bool setDOF(const yarp::sig::Vector &newDof, yarp::sig::Vector &curDof)=0
Set a new DOF configuration for the limb.
virtual bool storeContext(int *id)=0
Store the controller context.
virtual bool getRestPos(yarp::sig::Vector &curRestPos)=0
Get the current joints rest position.
virtual bool askForPose(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)=0
Ask for inverting a given pose without actually moving there.
virtual bool setTaskVelocities(const yarp::sig::Vector &xdot, const yarp::sig::Vector &odot)=0
Set the reference velocities of the end-effector in the task space.
virtual bool goToPoseSync(const yarp::sig::Vector &xd, const yarp::sig::Vector &od, const double t=0.0)=0
Move the end-effector to a specified pose (position and orientation) in cartesian space.
virtual bool setLimits(const int axis, const double min, const double max)=0
Set new range for the axis.
virtual bool getDOF(yarp::sig::Vector &curDof)=0
Get the current DOF configuration of the limb.
virtual bool setTrajTime(const double t)=0
Set the duration of the trajectory.
virtual bool askForPose(const yarp::sig::Vector &q0, const yarp::sig::Vector &xd, const yarp::sig::Vector &od, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)=0
Ask for inverting a given pose without actually moving there.
virtual bool getTrackingMode(bool *f)=0
Get the current controller mode.
virtual bool askForPosition(const yarp::sig::Vector &q0, const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)=0
Ask for inverting a given position without actually moving there.
virtual bool setReferenceMode(const bool f)=0
Ask the controller to close the loop with the low-level joints set-points in place of the actual enco...
virtual bool getTrajTime(double *t)=0
Get the current trajectory duration.
virtual bool setInTargetTol(const double tol)=0
Set tolerance for in-target check.
virtual bool registerEvent(yarp::dev::CartesianEvent &event)=0
Register an event.
virtual bool goToPositionSync(const yarp::sig::Vector &xd, const double t=0.0)=0
Move the end-effector to a specified position in cartesian space, ignore the orientation.
virtual bool setRestPos(const yarp::sig::Vector &newRestPos, yarp::sig::Vector &curRestPos)=0
Set a new joints rest position.
virtual bool getPose(const int axis, yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)=0
Get the current pose of the specified link belonging to the kinematic chain.
virtual bool attachTipFrame(const yarp::sig::Vector &x, const yarp::sig::Vector &o)=0
Attach a tip frame to the end-effector.
virtual bool getTaskVelocities(yarp::sig::Vector &xdot, yarp::sig::Vector &odot)=0
Return velocities of the end-effector in the task space.
virtual bool getInfo(yarp::os::Bottle &info)=0
Return useful info on the operating state of the controller.
virtual ~ICartesianControl()
Destructor.
virtual bool checkMotionDone(bool *f)=0
Check once if the current trajectory is terminated.
virtual bool getJointsVelocities(yarp::sig::Vector &qdot)=0
Return joints velocities.
virtual bool removeTipFrame()=0
Remove the tip frame currently attached to the end-effector.
virtual bool deleteContext(const int id)=0
Delete a specified controller context.
virtual bool getLimits(const int axis, double *min, double *max)=0
Get the current range for the axis.
virtual bool setPosePriority(const std::string &p)=0
Ask the controller to weigh more either the position or the orientation while reaching in full pose.
virtual bool restoreContext(const int id)=0
Restore the controller context previously stored.
virtual bool getPose(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)=0
Get the current pose of the end-effector.
virtual bool goToPosition(const yarp::sig::Vector &xd, const double t=0.0)=0
Move the end-effector to a specified position in cartesian space, ignore the orientation.
virtual bool getPosePriority(std::string &p)=0
Get the current pose priority.
virtual bool unregisterEvent(yarp::dev::CartesianEvent &event)=0
Unregister an event.
virtual bool tweakGet(yarp::os::Bottle &options)=0
Return low-level controller's parameters.
virtual bool getDesired(yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)=0
Get the actual desired pose and joints configuration as result of kinematic inversion.
virtual bool askForPosition(const yarp::sig::Vector &xd, yarp::sig::Vector &xdhat, yarp::sig::Vector &odhat, yarp::sig::Vector &qdhat)=0
Ask for inverting a given position without actually moving there.
virtual bool waitMotionDone(const double period=0.1, const double timeout=0.0)=0
Wait until the current trajectory is terminated.
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:22
The main, catch-all namespace for YARP.
Definition: dirs.h:16
Structure for configuring a cartesian event.
double motionOngoingCheckPoint
The user specifies the motion check-point that raises a "motion-ongoing" event through this parameter...
std::string type
The signature of the event as specified by the user.
Structure for configuring a cartesian event.
double motionOngoingCheckPoint
Contain the motion check-point that raised a "motion-ongoing" event.
std::string type
The signature of the received event as filled by the event handler.
double time
Contain the time instant of the source when the event took place, as filled by the event handler.
#define YARP_dev_API
Definition: api.h:18