ALVisualCompass API

NAOqi Vision - Overview | API

Namespace : AL

#include <alproxies/alvisualcompassproxy.h>

Events lists

Methods

void ALVisualCompassProxy::enableReferenceRefresh(const bool& refresh)

Determines if the reference image is taken again at subscribe or not. If not, the reference image is not reset at next subscribe.

Parameters:
  • refresh – true / false.
AL::ALValue ALVisualCompassProxy::getCurrentImage()

Returns an AL::ALValue containing the current image used to compute the deviation.

Returns:AL::ALValue formatted like the output of ALVideoDeviceProxy::getImageRemote().
AL::ALValue ALVisualCompassProxy::getMatchingQuality()

Returns the reliability of the matching and the compass deviation computations. It gives both the number of matches and the percentage of inliers for the model. The number of matches must be at least greater than 4 and the percentage over 50% for the matching to be significant.

Returns:Quality with the following format:
  • quality[0]: float. Percentage of model inliers amongst matched keypoints. Between 0.0f and 1.0f, must be over 0.5f to be significant.
  • quality[1]: int. Number of keypoints that were matched.
AL::ALValue ALVisualCompassProxy::getReferenceImage()

Returns an AL::ALValue containing the image used as a reference.

Returns:AL::ALValue formatted like the output of ALVideoDeviceProxy::getImageRemote().
int ALVisualCompassProxy::getReferenceQuality()

Returns the number of reference keypoints which were extracted from the reference image.

Returns:Number of reference keypoints.
void ALVisualCompassProxy::subscribe(const std::string& name)

Subscribes to ALVisualCompass. This causes the module to start writing information to ALMemory in “VisualCompassDeviation”. This can be accessed in ALMemory using ALMemoryProxy::getData().

Parameters:
  • name – Name to identify the subscriber
void ALVisualCompassProxy::unsubscribe(const std::string& name)

Unsubscribes to ALVisualCompass. This causes the module to stop writing information to ALMemory in “VisualCompassDeviation”.

Parameters:

Methods inherited from ALVisionExtractor

int ALVisualCompassProxy::getActiveCamera()
Returns:Index of the active camera (0: top camera, 1: bottom camera)
int ALVisualCompassProxy::getFrameRate()
Returns:Current extractor framerate in frames per second (range: 1-30 fps)
int ALVisualCompassProxy::getResolution()
Returns:Index of the current resolution (0: QQVGA, 1: QVGA, 2: VGA, 3: 4VGA)
bool ALVisualCompassProxy::isPaused()
Returns:True if the extractor is paused (subscribed but not running).
bool ALVisualCompassProxy::isProcessing()
Returns:True if the extractor is processing images (at least one subscriber).
bool ALVisualCompassProxy::setActiveCamera(const int& cameraId)

Sets the camera from which the processed images will be taken. This does not change the active camera for other modules.

Parameters:
  • cameraId – Index of the desired camera.
Returns:

True if the active camera has been successfully set.

Warning

If you use this function, the active camera of this module will not be linked to the “default” camera of the robot anymore. This means that the function setParam(kCameraSelectID) will not affect the active camera of this module. If you want the module to follow the “default” camera again, you can use the function ALVisualCompassProxy::setActiveCamera(-1).

bool ALVisualCompassProxy::setFrameRate(const int& framerate)

Sets the extractor framerate (the number of processes per second).

Parameters:
  • framerate – Desired framerate: must be between 1 and 30.
Returns:

True if the framerate has been successfully changed.

bool ALVisualCompassProxy::setResolution(const int& resolution)

Sets the resolution of the image to be processed.

Parameters:
  • resolution – Desired resolution. 0: QQVGA, 1: QVGA, 2: VGA, 3: 4VGA.
Returns:

True if the resolution has been successfully changed.

Events

Event: "Deviation"
callback(std::string eventName, AL::ALValue value, std::string subscriberIdentifier)

Note

The full name of this event is VisualCompass/Deviation in ALMemory

Raised each time the deviation of the current image from the compass is computed. The event is formatted as follows:

VisualCompass/Deviation = [
DeviationInfo,
RobotPosition,
TimeStamp
]

DeviationInfo contains the deviation along Z axis (theta angle for the robot pose) and Y axis.

DeviationInfo = [
  YAxisDeviation,
  ZAxisDeviation,
]

RobotPosition contains the robot position in WORLD_SPACE when the image was taken.

RobotPosition = [
  X,
  Y,
  Theta
]

TimeStamp: this field is the time stamp of the image that was used to compute the deviation.

TimeStamp =
[
  TimeStamp_Seconds,
  Timestamp_Microseconds
]
Event: "Match"
callback(std::string eventName, AL::ALValue value, std::string subscriberIdentifier)

Note

The full name of this event is VisualCompass/Match in ALMemory.

Raised each time the deviation of the current image from the compass is computed. The event is formatted as follows:

VisualCompass/Match =
[
  ReferenceKeypoints,
  CurrentKeypoints,
  Matches,
  Inliers
]

ReferenceKeypoints is the list of keypoints extracted from the reference image. CurrentKeypoints is the list of keypoints extracted from the current processed image. Both are a list of Keypoint where:

Keypoint =
[
  [X, Y],
  Size,
  Angle,
  Response,
  Octave
]

X and Y are the coordinates of the center of the keypoints in image coordinates, Size is the size of the keypoint, Angle is the keypoint orientation, Response is the keypoint strength, and Octave is the keypoint scale.

Matches is the list of the matches between the keypoints. Each Match is:

Match =
[
  ReferenceIndex,
  CurrentIndex,
  Distance
]

ReferenceIndex is the index of the matched keypoint in the reference list, CurrentIndex is the index of the matched keypoint in the current list, and Distance is the distance between the two keypoints.

Inliers is the list of the match indexes for each direction (Y and Z axis) which correspond to inliers for the Ransac: these are the indexes of the coherent matches used to compute the deviation.

Inliers =
[
   InliersWy = [Idx0, Idx1, ...],
   InliersWz = [Idx0, Idx1, ...]
]