pyicub.controllers.gaze

Module: gaze.py

This module provides a GazeController class to manage the gaze control of a robot using YARP. It includes functionalities to control gaze direction, block and clear eye and neck movements, and set parameters for gaze control.

Classes

GazeController(robot, logger)

Manages the gaze control of a robot using YARP.

GazeControllerPolyDriver(robot)

Manages the YARP PolyDriver for the gaze controller.

class pyicub.controllers.gaze.GazeControllerPolyDriver(robot)

Manages the YARP PolyDriver for the gaze controller.

__pid__

Process ID (unique identifier).

Type:

str

__props__

Properties for the YARP PolyDriver.

Type:

yarp.Property

__driver__

The YARP PolyDriver instance.

Type:

yarp.PolyDriver

property properties

Returns the properties of the YARP PolyDriver.

Returns:

yarp.Property – The properties of the YARP PolyDriver.

getDriver()

Returns the YARP PolyDriver instance.

Returns:

yarp.PolyDriver – The YARP PolyDriver instance.

class pyicub.controllers.gaze.GazeController(robot, logger)

Manages the gaze control of a robot using YARP.

__logger__

Logger instance for logging information.

Type:

Logger

__driver__

Instance of GazeControllerPolyDriver to manage the YARP PolyDriver.

Type:

GazeControllerPolyDriver

__mot_id__

Motion ID counter.

Type:

int

__IGazeControl__

Interface for gaze control.

Type:

IGazeControl

isValid()

Checks if the PolyDriver is valid.

Returns:

bool – True if the PolyDriver is valid, False otherwise.

init()

Initializes the gaze control interface and stops any ongoing control.

property PolyDriver

Returns: yarp.PolyDriver: The YARP PolyDriver instance.

property IGazeControl

Returns: IGazeControl: The gaze control interface.

blockEyes(vergence)

Blocks the eyes at the specified vergence.

Parameters:

vergence (float) – The vergence angle to block the eyes at.

blockNeck()

Blocks the neck movements.

clearEyes()

Clears the eye movements.

clearNeck()

Clears the neck movements.

lookAtAbsAngles(azi, ele, ver, waitMotionDone=True, timeout=0.0)

Commands the gaze controller to look at the specified absolute angles.

Parameters:
  • azi (float) – Azimuth angle in degrees.

  • ele (float) – Elevation angle in degrees.

  • ver (float) – Vergence angle in degrees.

  • waitMotionDone (bool, optional) – If True, the method will wait until the motion is completed.

  • timeout (float, optional) – Maximum time to wait for the motion to complete, in seconds. A value of 0.0 means no timeout.

lookAtRelAngles(azi, ele, ver, waitMotionDone=True, timeout=0.0)

Directs the gaze to the specified relative angles.

Parameters

azifloat

The azimuth angle in degrees.

elefloat

The elevation angle in degrees.

verfloat

The vergence angle in degrees.

waitMotionDonebool, optional

If True, the method waits until the motion is completed (default is True).

timeoutfloat, optional

The maximum time to wait for the motion to complete in seconds (default is 0.0, which means no timeout).

Returns

None

lookAtFixationPoint(x, y, z, waitMotionDone=True, timeout=0.0)

Directs the gaze to a specified fixation point in 3D space.

Parameters

xfloat

The x-coordinate of the fixation point.

yfloat

The y-coordinate of the fixation point.

zfloat

The z-coordinate of the fixation point.

waitMotionDonebool, optional

If True, the method waits until the motion is completed (default is True).

timeoutfloat, optional

The maximum time to wait for the motion to complete in seconds (default is 0.0).

Returns

None

reset()

Reset the gaze controller by clearing the eyes and neck positions.

This method calls clearEyes to reset the eye positions and clearNeck to reset the neck positions.

setParams(neck_tt, eyes_tt)
Parameters:
  • neck_tt (float) – Trajectory time for the neck.

  • eyes_tt (float) – Trajectory time for the eyes.

setTrackingMode(mode)
Parameters:

mode (bool) – True to enable tracking mode, False to disable.

waitMotionDone(period=0.1, timeout=0.0)
Parameters:
  • period (float) – Period to check the motion status.

  • timeout (float) – Timeout for waiting for the motion to complete.

Returns:

bool – True if the motion completed, False otherwise.

waitMotionOnset(speed_ref=0, period=0.1, max_attempts=50)