YARP
Yet Another Robot Platform
GazeControl.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_GAZECONTROL_H
8 #define YARP_DEV_GAZECONTROL_H
9 
10 #include <string>
11 
12 #include <yarp/os/Bottle.h>
13 #include <yarp/os/Stamp.h>
14 #include <yarp/dev/api.h>
15 #include <yarp/sig/Vector.h>
16 
21 namespace yarp {
22  namespace dev {
23  struct GazeEventParameters;
24  struct GazeEventVariables;
25  class GazeEvent;
26  class IGazeControl;
27  }
28 }
29 
30 
37 {
56  std::string type;
57 
64 };
65 
66 
73 {
78  std::string type;
79 
84  double time;
85 
91 };
92 
93 
100 {
101 public:
105  virtual ~GazeEvent() {}
106 
112 
118 
122  virtual void gazeEventCallback() = 0;
123 };
124 
125 
135 {
136 public:
140  virtual ~IGazeControl();
141 
154  virtual bool setTrackingMode(const bool f) = 0;
155 
162  virtual bool getTrackingMode(bool *f) = 0;
163 
172  virtual bool setStabilizationMode(const bool f) = 0;
173 
180  virtual bool getStabilizationMode(bool *f) = 0;
181 
190  virtual bool getFixationPoint(yarp::sig::Vector &fp, yarp::os::Stamp *stamp = NULL) = 0;
191 
207  virtual bool getAngles(yarp::sig::Vector &ang, yarp::os::Stamp *stamp = NULL) = 0;
208 
216  virtual bool lookAtFixationPoint(const yarp::sig::Vector &fp) = 0;
217 
230  virtual bool lookAtAbsAngles(const yarp::sig::Vector &ang) = 0;
231 
245  virtual bool lookAtRelAngles(const yarp::sig::Vector &ang) = 0;
246 
262  virtual bool lookAtMonoPixel(const int camSel,
263  const yarp::sig::Vector &px,
264  const double z = 1.0) = 0;
265 
276  virtual bool lookAtMonoPixelWithVergence(const int camSel,
277  const yarp::sig::Vector &px,
278  const double ver) = 0;
279 
296  virtual bool lookAtStereoPixels(const yarp::sig::Vector &pxl,
297  const yarp::sig::Vector &pxr) = 0;
298 
306  virtual bool lookAtFixationPointSync(const yarp::sig::Vector &fp) = 0;
307 
320  virtual bool lookAtAbsAnglesSync(const yarp::sig::Vector &ang) = 0;
321 
335  virtual bool lookAtRelAnglesSync(const yarp::sig::Vector &ang) = 0;
336 
352  virtual bool lookAtMonoPixelSync(const int camSel,
353  const yarp::sig::Vector &px,
354  const double z = 1.0) = 0;
355 
366  virtual bool lookAtMonoPixelWithVergenceSync(const int camSel,
367  const yarp::sig::Vector &px,
368  const double ver) = 0;
369 
386  virtual bool lookAtStereoPixelsSync(const yarp::sig::Vector &pxl,
387  const yarp::sig::Vector &pxr) = 0;
388 
395  virtual bool getNeckTrajTime(double *t) = 0;
396 
403  virtual bool getEyesTrajTime(double *t) = 0;
404 
411  virtual bool getVORGain(double *gain) = 0;
412 
419  virtual bool getOCRGain(double *gain) = 0;
420 
427  virtual bool getSaccadesMode(bool *f) = 0;
428 
435  virtual bool getSaccadesInhibitionPeriod(double *period) = 0;
436 
443  virtual bool getSaccadesActivationAngle(double *angle) = 0;
444 
457  yarp::os::Stamp *stamp = NULL) = 0;
458 
471  yarp::os::Stamp *stamp = NULL) = 0;
472 
491  yarp::os::Stamp *stamp = NULL) = 0;
492 
504  virtual bool get2DPixel(const int camSel,
505  const yarp::sig::Vector &x,
506  yarp::sig::Vector &px) = 0;
507 
521  virtual bool get3DPoint(const int camSel,
522  const yarp::sig::Vector &px,
523  const double z,
524  yarp::sig::Vector &x) = 0;
525 
542  virtual bool get3DPointOnPlane(const int camSel,
543  const yarp::sig::Vector &px,
544  const yarp::sig::Vector &plane,
545  yarp::sig::Vector &x) = 0;
546 
558  virtual bool get3DPointFromAngles(const int mode,
559  const yarp::sig::Vector &ang,
560  yarp::sig::Vector &x) = 0;
561 
574  yarp::sig::Vector &ang) = 0;
575 
591  virtual bool triangulate3DPoint(const yarp::sig::Vector &pxl,
592  const yarp::sig::Vector &pxr,
593  yarp::sig::Vector &x) = 0;
594 
602  virtual bool getJointsDesired(yarp::sig::Vector &qdes) = 0;
603 
611  virtual bool getJointsVelocities(yarp::sig::Vector &qdot) = 0;
612 
625  virtual bool getStereoOptions(yarp::os::Bottle &options) = 0;
626 
636  virtual bool setNeckTrajTime(const double t) = 0;
637 
644  virtual bool setEyesTrajTime(const double t) = 0;
645 
654  virtual bool setVORGain(const double gain) = 0;
655 
664  virtual bool setOCRGain(const double gain) = 0;
665 
675  virtual bool setSaccadesMode(const bool f) = 0;
676 
683  virtual bool setSaccadesInhibitionPeriod(const double period) = 0;
684 
691  virtual bool setSaccadesActivationAngle(const double angle) = 0;
692 
710  virtual bool setStereoOptions(const yarp::os::Bottle &options) = 0;
711 
719  virtual bool bindNeckPitch(const double min, const double max) = 0;
720 
730  virtual bool blockNeckPitch(const double val) = 0;
731 
739  virtual bool blockNeckPitch() = 0;
740 
748  virtual bool bindNeckRoll(const double min, const double max) = 0;
749 
759  virtual bool blockNeckRoll(const double val) = 0;
760 
768  virtual bool blockNeckRoll() = 0;
769 
777  virtual bool bindNeckYaw(const double min, const double max) = 0;
778 
788  virtual bool blockNeckYaw(const double val) = 0;
789 
797  virtual bool blockNeckYaw() = 0;
798 
806  virtual bool blockEyes(const double ver) = 0;
807 
813  virtual bool blockEyes() = 0;
814 
823  virtual bool getNeckPitchRange(double *min, double *max) = 0;
824 
833  virtual bool getNeckRollRange(double *min, double *max) = 0;
834 
843  virtual bool getNeckYawRange(double *min, double *max) = 0;
844 
854  virtual bool getBlockedVergence(double *ver) = 0;
855 
860  virtual bool clearNeckPitch() = 0;
861 
866  virtual bool clearNeckRoll() = 0;
867 
872  virtual bool clearNeckYaw() = 0;
873 
878  virtual bool clearEyes() = 0;
879 
892  virtual bool getNeckAngleUserTolerance(double *angle) = 0;
893 
900  virtual bool setNeckAngleUserTolerance(const double angle) = 0;
901 
908  virtual bool checkMotionDone(bool *f) = 0;
909 
920  virtual bool waitMotionDone(const double period=0.1, const double timeout=0.0) = 0;
921 
927  virtual bool checkSaccadeDone(bool *f) = 0;
928 
939  virtual bool waitSaccadeDone(const double period=0.1, const double timeout=0.0) = 0;
940 
945  virtual bool stopControl() = 0;
946 
956  virtual bool storeContext(int *id) = 0;
957 
968  virtual bool restoreContext(const int id) = 0;
969 
975  virtual bool deleteContext(const int id) = 0;
976 
983  virtual bool getInfo(yarp::os::Bottle &info) = 0;
984 
993  virtual bool registerEvent(yarp::dev::GazeEvent &event) = 0;
994 
1000  virtual bool unregisterEvent(yarp::dev::GazeEvent &event) = 0;
1001 
1011  virtual bool tweakSet(const yarp::os::Bottle &options) = 0;
1012 
1023  virtual bool tweakGet(yarp::os::Bottle &options) = 0;
1024 };
1025 
1026 #endif // YARP_DEV_GAZECONTROL_H
float t
contains the definition of a Vector type
Interface for a event notified by the gaze controller.
Definition: GazeControl.h:100
yarp::dev::GazeEventVariables gazeEventVariables
The event handler fills this structure with useful information at run-time.
Definition: GazeControl.h:117
yarp::dev::GazeEventParameters gazeEventParameters
The user fills this structure to establish the event parameters.
Definition: GazeControl.h:111
virtual void gazeEventCallback()=0
Event callback to be overridden by the user.
virtual ~GazeEvent()
Destructor.
Definition: GazeControl.h:105
Interface for a gaze controller.
Definition: GazeControl.h:135
virtual bool lookAtMonoPixel(const int camSel, const yarp::sig::Vector &px, const double z=1.0)=0
Move the gaze to a location specified by a pixel within the image plane.
virtual bool lookAtMonoPixelWithVergenceSync(const int camSel, const yarp::sig::Vector &px, const double ver)=0
Move the gaze to a location specified by a pixel within the image plane using the vergence.
virtual bool lookAtRelAngles(const yarp::sig::Vector &ang)=0
Move the gaze to a specified gazing angles configuration given in the relative reference frame.
virtual bool getVORGain(double *gain)=0
Get the current gain used to weigh the vestibulo-ocular reflex (VOR).
virtual bool getStereoOptions(yarp::os::Bottle &options)=0
Return the current options used by the stereo approach.
virtual bool clearEyes()=0
Unblock the eyes.
virtual bool setNeckTrajTime(const double t)=0
Set the duration of the trajectory for the neck actuators.
virtual bool getJointsVelocities(yarp::sig::Vector &qdot)=0
Get the joints velocities commanded by the controller.
virtual bool setEyesTrajTime(const double t)=0
Set the duration of the trajectory for the eyes actuators.
virtual ~IGazeControl()
Destructor.
virtual bool tweakSet(const yarp::os::Bottle &options)=0
Tweak low-level controller's parameters.
virtual bool getTrackingMode(bool *f)=0
Get the current controller mode.
virtual bool triangulate3DPoint(const yarp::sig::Vector &pxl, const yarp::sig::Vector &pxr, yarp::sig::Vector &x)=0
Triangulate two points given in the image planes to find the corresponding 3-d point in the space.
virtual bool lookAtFixationPointSync(const yarp::sig::Vector &fp)=0
Move the gaze to a specified fixation point in cartesian space.
virtual bool setStabilizationMode(const bool f)=0
Turn on/off the gaze stabilization.
virtual bool deleteContext(const int id)=0
Delete a specified controller context.
virtual bool stopControl()=0
Ask for an immediate stop of the motion.
virtual bool setVORGain(const double gain)=0
Set the gain used to weigh the vestibulo-ocular reflex (VOR).
virtual bool setSaccadesActivationAngle(const double angle)=0
Set the activation angle for saccadic movements.
virtual bool lookAtMonoPixelWithVergence(const int camSel, const yarp::sig::Vector &px, const double ver)=0
Move the gaze to a location specified by a pixel within the image plane using the vergence.
virtual bool get3DPoint(const int camSel, const yarp::sig::Vector &px, const double z, yarp::sig::Vector &x)=0
Get the 3-d point whose pixel projection and z-component in the camera frame are given.
virtual bool getHeadPose(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)=0
Get the current pose of the head frame.
virtual bool bindNeckPitch(const double min, const double max)=0
Bind the neck pitch within a specified range.
virtual bool getNeckYawRange(double *min, double *max)=0
Return the current neck yaw range.
virtual bool getJointsDesired(yarp::sig::Vector &qdes)=0
Get the joints target values where the controller is moving the system to.
virtual bool blockNeckRoll()=0
Block the neck roll at the current angle.
virtual bool lookAtRelAnglesSync(const yarp::sig::Vector &ang)=0
Move the gaze to a specified gazing angles configuration given in the relative reference frame.
virtual bool bindNeckYaw(const double min, const double max)=0
Bind the neck yaw within a specified range.
virtual bool getNeckAngleUserTolerance(double *angle)=0
Return the current tolerance defined by the user to gaze at the target with the neck,...
virtual bool getNeckTrajTime(double *t)=0
Get the current trajectory duration for the neck actuators.
virtual bool blockNeckYaw(const double val)=0
Block the neck yaw at a specified angle.
virtual bool clearNeckPitch()=0
Unblock the neck pitch.
virtual bool waitSaccadeDone(const double period=0.1, const double timeout=0.0)=0
Wait until the current saccade is terminated.
virtual bool getOCRGain(double *gain)=0
Get the current gain used to weigh the oculo-collic reflex (OCR).
virtual bool get3DPointFromAngles(const int mode, const yarp::sig::Vector &ang, yarp::sig::Vector &x)=0
Get the 3-d coordinates corresponding to the angular positions.
virtual bool setSaccadesMode(const bool f)=0
Enable/disable the use of very fast eyes movements (saccades).
virtual bool setTrackingMode(const bool f)=0
Set the controller in tracking or non-tracking mode.
virtual bool tweakGet(yarp::os::Bottle &options)=0
Return low-level controller's parameters.
virtual bool setOCRGain(const double gain)=0
Set the gain used to weigh the oculo-collic reflex (OCR).
virtual bool get3DPointOnPlane(const int camSel, const yarp::sig::Vector &px, const yarp::sig::Vector &plane, yarp::sig::Vector &x)=0
Get the 3-d point - whose pixel projection is given - that results from the projection into a plane s...
virtual bool getNeckRollRange(double *min, double *max)=0
Return the current neck roll range.
virtual bool setStereoOptions(const yarp::os::Bottle &options)=0
Update the options used by the stereo approach.
virtual bool blockEyes()=0
Block the eyes to look always straight ahead (the tilt can vary) with the current vergence angle.
virtual bool blockNeckYaw()=0
Block the neck yaw at the current angle.
virtual bool getBlockedVergence(double *ver)=0
Return the current vergence angle used to block the eyes.
virtual bool getSaccadesMode(bool *f)=0
Query whether the very fast eyes movements (saccades) will be employed or not.
virtual bool setSaccadesInhibitionPeriod(const double period)=0
Set the inhibition period for saccadic movements.
virtual bool getAnglesFrom3DPoint(const yarp::sig::Vector &x, yarp::sig::Vector &ang)=0
Get the absolute angular coordinates corresponding to the 3-d point.
virtual bool lookAtAbsAnglesSync(const yarp::sig::Vector &ang)=0
Move the gaze to a specified gazing angles configuration given in the absolute reference frame.
virtual bool getFixationPoint(yarp::sig::Vector &fp, yarp::os::Stamp *stamp=NULL)=0
Get the current fixation point.
virtual bool blockEyes(const double ver)=0
Block the eyes to look always straight ahead (the tilt can vary) with a specified vergence angle.
virtual bool checkMotionDone(bool *f)=0
Check once if the current trajectory is terminated.
virtual bool getAngles(yarp::sig::Vector &ang, yarp::os::Stamp *stamp=NULL)=0
Get the current gaze configuration in terms of azimuth and elevation angles wrt to the absolute refer...
virtual bool lookAtStereoPixels(const yarp::sig::Vector &pxl, const yarp::sig::Vector &pxr)=0
Move the gaze to a location specified by two pixels representing the same 3-d point as seen from with...
virtual bool getStabilizationMode(bool *f)=0
Get the current stabilization mode.
virtual bool lookAtAbsAngles(const yarp::sig::Vector &ang)=0
Move the gaze to a specified gazing angles configuration given in the absolute reference frame.
virtual bool lookAtFixationPoint(const yarp::sig::Vector &fp)=0
Move the gaze to a specified fixation point in cartesian space.
virtual bool blockNeckRoll(const double val)=0
Block the neck roll at a specified angle.
virtual bool restoreContext(const int id)=0
Restore the controller context previously stored.
virtual bool storeContext(int *id)=0
Store the controller context.
virtual bool getNeckPitchRange(double *min, double *max)=0
Return the current neck pitch range.
virtual bool getEyesTrajTime(double *t)=0
Get the current trajectory duration for the eyes actuators.
virtual bool registerEvent(yarp::dev::GazeEvent &event)=0
Register an event.
virtual bool blockNeckPitch(const double val)=0
Block the neck pitch at a specified angle.
virtual bool bindNeckRoll(const double min, const double max)=0
Bind the neck roll within a specified range.
virtual bool unregisterEvent(yarp::dev::GazeEvent &event)=0
Unregister an event.
virtual bool checkSaccadeDone(bool *f)=0
Check once if the saccade is terminated.
virtual bool get2DPixel(const int camSel, const yarp::sig::Vector &x, yarp::sig::Vector &px)=0
Get the 2-d pixel point - whose cartesian coordinates are given wrt the root reference frame - that r...
virtual bool getLeftEyePose(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)=0
Get the current pose of the left eye frame.
virtual bool getRightEyePose(yarp::sig::Vector &x, yarp::sig::Vector &o, yarp::os::Stamp *stamp=NULL)=0
Get the current pose of the right eye frame.
virtual bool blockNeckPitch()=0
Block the neck pitch at the current angle.
virtual bool lookAtStereoPixelsSync(const yarp::sig::Vector &pxl, const yarp::sig::Vector &pxr)=0
Move the gaze to a location specified by two pixels representing the same 3-d point as seen from with...
virtual bool getSaccadesInhibitionPeriod(double *period)=0
Get the current inhibition period for saccadic movements.
virtual bool setNeckAngleUserTolerance(const double angle)=0
Specify a new tolerance to gaze at the target with the neck.
virtual bool clearNeckRoll()=0
Unblock the neck roll.
virtual bool waitMotionDone(const double period=0.1, const double timeout=0.0)=0
Wait until the current trajectory is terminated.
virtual bool clearNeckYaw()=0
Unblock the neck yaw.
virtual bool getInfo(yarp::os::Bottle &info)=0
Return useful info on the operating state of the controller.
virtual bool lookAtMonoPixelSync(const int camSel, const yarp::sig::Vector &px, const double z=1.0)=0
Move the gaze to a location specified by a pixel within the image plane.
virtual bool getSaccadesActivationAngle(double *angle)=0
Get the current activation angle for saccadic movements.
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 gaze event.
Definition: GazeControl.h:37
double motionOngoingCheckPoint
The user specifies the motion check-point that raises a "motion-ongoing" event through this parameter...
Definition: GazeControl.h:63
std::string type
The signature of the event as specified by the user.
Definition: GazeControl.h:56
Structure for retrieving information from a gaze event.
Definition: GazeControl.h:73
double time
Contain the time instant of the source when the event took place, as filled by the event handler.
Definition: GazeControl.h:84
double motionOngoingCheckPoint
Contain the motion check-point that raised a "motion-ongoing" event.
Definition: GazeControl.h:90
std::string type
The signature of the received event as filled by the event handler.
Definition: GazeControl.h:78
#define YARP_dev_API
Definition: api.h:18