YARP
Yet Another Robot Platform
CartesianControl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_CARTESIANCONTROL_H
11 #define YARP_DEV_CARTESIANCONTROL_H
12 
13 #include <yarp/os/Bottle.h>
14 #include <yarp/os/Stamp.h>
15 #include <yarp/dev/api.h>
16 #include <yarp/sig/Vector.h>
17 
22 namespace yarp {
23  namespace dev {
24  struct CartesianEventParameters;
25  struct CartesianEventVariables;
26  class CartesianEvent;
27  class ICartesianControl;
28  }
29 }
30 
31 
38 {
49  std::string type;
50 
57 };
58 
59 
66 {
71  std::string type;
72 
77  double time;
78 
84 };
85 
86 
94 {
95 public:
99  virtual ~CartesianEvent() {}
100 
106 
112 
116  virtual void cartesianEventCallback() = 0;
117 };
118 
119 
129 {
130 public:
135 
148  virtual bool setTrackingMode(const bool f) = 0;
149 
156  virtual bool getTrackingMode(bool *f) = 0;
157 
171  virtual bool setReferenceMode(const bool f) = 0;
172 
180  virtual bool getReferenceMode(bool *f) = 0;
181 
188  virtual bool setPosePriority(const std::string &p) = 0;
189 
195  virtual bool getPosePriority(std::string &p) = 0;
196 
210  yarp::os::Stamp *stamp=NULL) = 0;
211 
226  virtual bool getPose(const int axis, yarp::sig::Vector &x,
228  yarp::os::Stamp *stamp=NULL) = 0;
229 
243  virtual bool goToPose(const yarp::sig::Vector &xd,
244  const yarp::sig::Vector &od,
245  const double t = 0.0) = 0;
246 
258  virtual bool goToPosition(const yarp::sig::Vector &xd,
259  const double t = 0.0) = 0;
260 
275  virtual bool goToPoseSync(const yarp::sig::Vector &xd,
276  const yarp::sig::Vector &od,
277  const double t = 0.0) = 0;
278 
291  virtual bool goToPositionSync(const yarp::sig::Vector &xd,
292  const double t = 0.0) = 0;
293 
308  virtual bool getDesired(yarp::sig::Vector &xdhat,
309  yarp::sig::Vector &odhat,
310  yarp::sig::Vector &qdhat) = 0;
311 
331  virtual bool askForPose(const yarp::sig::Vector &xd,
332  const yarp::sig::Vector &od,
333  yarp::sig::Vector &xdhat,
334  yarp::sig::Vector &odhat,
335  yarp::sig::Vector &qdhat) = 0;
336 
359  virtual bool askForPose(const yarp::sig::Vector &q0,
360  const yarp::sig::Vector &xd,
361  const yarp::sig::Vector &od,
362  yarp::sig::Vector &xdhat,
363  yarp::sig::Vector &odhat,
364  yarp::sig::Vector &qdhat) = 0;
365 
382  virtual bool askForPosition(const yarp::sig::Vector &xd,
383  yarp::sig::Vector &xdhat,
384  yarp::sig::Vector &odhat,
385  yarp::sig::Vector &qdhat) = 0;
386 
406  virtual bool askForPosition(const yarp::sig::Vector &q0,
407  const yarp::sig::Vector &xd,
408  yarp::sig::Vector &xdhat,
409  yarp::sig::Vector &odhat,
410  yarp::sig::Vector &qdhat) = 0;
411 
424  virtual bool getDOF(yarp::sig::Vector &curDof) = 0;
425 
441  virtual bool setDOF(const yarp::sig::Vector &newDof,
442  yarp::sig::Vector &curDof) = 0;
443 
455  virtual bool getRestPos(yarp::sig::Vector &curRestPos) = 0;
456 
471  virtual bool setRestPos(const yarp::sig::Vector &newRestPos,
472  yarp::sig::Vector &curRestPos) = 0;
473 
485  virtual bool getRestWeights(yarp::sig::Vector &curRestWeights) = 0;
486 
501  virtual bool setRestWeights(const yarp::sig::Vector &newRestWeights,
502  yarp::sig::Vector &curRestWeights) = 0;
503 
512  virtual bool getLimits(const int axis, double *min, double *max) = 0;
513 
523  virtual bool setLimits(const int axis, const double min, const double max) = 0;
524 
530  virtual bool getTrajTime(double *t) = 0;
531 
537  virtual bool setTrajTime(const double t) = 0;
538 
547  virtual bool getInTargetTol(double *tol) = 0;
548 
557  virtual bool setInTargetTol(const double tol) = 0;
558 
565  virtual bool getJointsVelocities(yarp::sig::Vector &qdot) = 0;
566 
581  yarp::sig::Vector &odot) = 0;
582 
592  virtual bool setTaskVelocities(const yarp::sig::Vector &xdot,
593  const yarp::sig::Vector &odot) = 0;
594 
606  virtual bool attachTipFrame(const yarp::sig::Vector &x,
607  const yarp::sig::Vector &o) = 0;
608 
618 
625  virtual bool removeTipFrame() = 0;
626 
633  virtual bool checkMotionDone(bool *f) = 0;
634 
645  virtual bool waitMotionDone(const double period = 0.1,
646  const double timeout = 0.0) = 0;
647 
655  virtual bool stopControl() = 0;
656 
666  virtual bool storeContext(int *id) = 0;
667 
678  virtual bool restoreContext(const int id) = 0;
679 
685  virtual bool deleteContext(const int id) = 0;
686 
693  virtual bool getInfo(yarp::os::Bottle &info) = 0;
694 
703  virtual bool registerEvent(yarp::dev::CartesianEvent &event) = 0;
704 
710  virtual bool unregisterEvent(yarp::dev::CartesianEvent &event) = 0;
711 
721  virtual bool tweakSet(const yarp::os::Bottle &options) = 0;
722 
733  virtual bool tweakGet(yarp::os::Bottle &options) = 0;
734 };
735 
736 #endif // YARP_DEV_CARTESIANCONTROL_H
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::dev::ICartesianControl::attachTipFrame
virtual bool attachTipFrame(const yarp::sig::Vector &x, const yarp::sig::Vector &o)=0
Attach a tip frame to the end-effector.
yarp::dev::ICartesianControl::goToPose
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.
yarp::dev::CartesianEvent::cartesianEventCallback
virtual void cartesianEventCallback()=0
Event callback to be overridden by the user.
yarp::dev::ICartesianControl::getRestPos
virtual bool getRestPos(yarp::sig::Vector &curRestPos)=0
Get the current joints rest position.
yarp::dev::CartesianEventVariables::motionOngoingCheckPoint
double motionOngoingCheckPoint
Contain the motion check-point that raised a "motion-ongoing" event.
Definition: CartesianControl.h:83
Vector.h
contains the definition of a Vector type
yarp::dev::ICartesianControl
Interface for a cartesian controller.
Definition: CartesianControl.h:129
yarp::dev::CartesianEvent
Interface for a event notified by the cartesian controller.
Definition: CartesianControl.h:94
t
float t
Definition: FfmpegWriter.cpp:74
yarp::dev::ICartesianControl::getInfo
virtual bool getInfo(yarp::os::Bottle &info)=0
Return useful info on the operating state of the controller.
yarp::dev::ICartesianControl::getInTargetTol
virtual bool getInTargetTol(double *tol)=0
Return tolerance for in-target check.
yarp::dev::CartesianEventVariables
Structure for configuring a cartesian event.
Definition: CartesianControl.h:66
yarp::dev::ICartesianControl::setReferenceMode
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...
yarp::dev::ICartesianControl::setTrackingMode
virtual bool setTrackingMode(const bool f)=0
Set the controller in tracking or non-tracking mode.
yarp::dev::CartesianEvent::~CartesianEvent
virtual ~CartesianEvent()
Destructor.
Definition: CartesianControl.h:99
yarp::dev::ICartesianControl::setRestWeights
virtual bool setRestWeights(const yarp::sig::Vector &newRestWeights, yarp::sig::Vector &curRestWeights)=0
Set a new joints rest position.
yarp::dev::CartesianEventVariables::type
std::string type
The signature of the received event as filled by the event handler.
Definition: CartesianControl.h:71
yarp::dev::ICartesianControl::getPose
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.
yarp::dev::ICartesianControl::askForPosition
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.
yarp::dev::ICartesianControl::setPosePriority
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.
yarp::dev::CartesianEventVariables::time
double time
Contain the time instant of the source when the event took place, as filled by the event handler.
Definition: CartesianControl.h:77
yarp::dev::ICartesianControl::setTrajTime
virtual bool setTrajTime(const double t)=0
Set the duration of the trajectory.
yarp::sig::VectorOf< double >
yarp::dev::ICartesianControl::getReferenceMode
virtual bool getReferenceMode(bool *f)=0
Get the current controller reference mode.
yarp::dev::ICartesianControl::askForPosition
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.
yarp::dev::ICartesianControl::waitMotionDone
virtual bool waitMotionDone(const double period=0.1, const double timeout=0.0)=0
Wait until the current trajectory is terminated.
yarp::dev::ICartesianControl::getTrackingMode
virtual bool getTrackingMode(bool *f)=0
Get the current controller mode.
yarp::dev::ICartesianControl::getTipFrame
virtual bool getTipFrame(yarp::sig::Vector &x, yarp::sig::Vector &o)=0
Retrieve the tip frame currently attached to the end-effector.
yarp::dev::ICartesianControl::getPose
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.
yarp::dev::ICartesianControl::getTrajTime
virtual bool getTrajTime(double *t)=0
Get the current trajectory duration.
yarp::dev::ICartesianControl::stopControl
virtual bool stopControl()=0
Ask for an immediate stop motion.
yarp::dev::ICartesianControl::getJointsVelocities
virtual bool getJointsVelocities(yarp::sig::Vector &qdot)=0
Return joints velocities.
Stamp.h
yarp::dev::ICartesianControl::setDOF
virtual bool setDOF(const yarp::sig::Vector &newDof, yarp::sig::Vector &curDof)=0
Set a new DOF configuration for the limb.
yarp::dev::ICartesianControl::askForPose
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.
yarp::dev::ICartesianControl::setTaskVelocities
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.
yarp::dev::ICartesianControl::getLimits
virtual bool getLimits(const int axis, double *min, double *max)=0
Get the current range for the axis.
yarp::dev::ICartesianControl::askForPose
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.
yarp::dev::ICartesianControl::setInTargetTol
virtual bool setInTargetTol(const double tol)=0
Set tolerance for in-target check.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::CartesianEvent::cartesianEventVariables
yarp::dev::CartesianEventVariables cartesianEventVariables
The event handler fills this structure with useful information at run-time.
Definition: CartesianControl.h:111
yarp::dev::ICartesianControl::removeTipFrame
virtual bool removeTipFrame()=0
Remove the tip frame currently attached to the end-effector.
yarp::os::Stamp
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25
yarp::dev::ICartesianControl::getPosePriority
virtual bool getPosePriority(std::string &p)=0
Get the current pose priority.
yarp::dev::ICartesianControl::registerEvent
virtual bool registerEvent(yarp::dev::CartesianEvent &event)=0
Register an event.
yarp::dev::ICartesianControl::tweakSet
virtual bool tweakSet(const yarp::os::Bottle &options)=0
Tweak low-level controller's parameters.
yarp::dev::CartesianEventParameters
Structure for configuring a cartesian event.
Definition: CartesianControl.h:38
yarp::dev::ICartesianControl::tweakGet
virtual bool tweakGet(yarp::os::Bottle &options)=0
Return low-level controller's parameters.
yarp::dev::CartesianEventParameters::motionOngoingCheckPoint
double motionOngoingCheckPoint
The user specifies the motion check-point that raises a "motion-ongoing" event through this parameter...
Definition: CartesianControl.h:56
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::ICartesianControl::restoreContext
virtual bool restoreContext(const int id)=0
Restore the controller context previously stored.
yarp::dev::ICartesianControl::deleteContext
virtual bool deleteContext(const int id)=0
Delete a specified controller context.
yarp::dev::ICartesianControl::checkMotionDone
virtual bool checkMotionDone(bool *f)=0
Check once if the current trajectory is terminated.
yarp::dev::ICartesianControl::getDOF
virtual bool getDOF(yarp::sig::Vector &curDof)=0
Get the current DOF configuration of the limb.
yarp::dev::ICartesianControl::storeContext
virtual bool storeContext(int *id)=0
Store the controller context.
yarp::dev::ICartesianControl::goToPoseSync
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.
yarp::dev::ICartesianControl::setRestPos
virtual bool setRestPos(const yarp::sig::Vector &newRestPos, yarp::sig::Vector &curRestPos)=0
Set a new joints rest position.
yarp::dev::ICartesianControl::getDesired
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.
yarp::dev::ICartesianControl::getRestWeights
virtual bool getRestWeights(yarp::sig::Vector &curRestWeights)=0
Get the current joints rest weights.
api.h
yarp::dev::ICartesianControl::~ICartesianControl
virtual ~ICartesianControl()
Destructor.
yarp::dev::ICartesianControl::goToPositionSync
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.
Bottle.h
yarp::dev::ICartesianControl::getTaskVelocities
virtual bool getTaskVelocities(yarp::sig::Vector &xdot, yarp::sig::Vector &odot)=0
Return velocities of the end-effector in the task space.
yarp::dev::ICartesianControl::goToPosition
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.
yarp::dev::CartesianEvent::cartesianEventParameters
yarp::dev::CartesianEventParameters cartesianEventParameters
The user fills this structure to establish the event parameters.
Definition: CartesianControl.h:105
yarp::dev::CartesianEventParameters::type
std::string type
The signature of the event as specified by the user.
Definition: CartesianControl.h:49
yarp::dev::ICartesianControl::setLimits
virtual bool setLimits(const int axis, const double min, const double max)=0
Set new range for the axis.
yarp::dev::ICartesianControl::unregisterEvent
virtual bool unregisterEvent(yarp::dev::CartesianEvent &event)=0
Unregister an event.