SoftBank Robotics documentation What's new in NAOqi 2.8?

ALWorldRepresentation API

Overview | API


Namespace : AL

#include <alproxies/alworldrepresentationproxy.h>

Method list

class ALWorldRepresentationProxy

Deprecated methods

Methods

int ALWorldRepresentationProxy::addAttributeToCategory(const std::string& categoryName, const std::string& attributeName, const AL::ALValue& attributeFields)

Add a new attribute to an existing category. The new category is added to the attribute with the specified fields. Each attribute is unique.

Parameters:
  • categoryName – Name of the category to modify.
  • attributeName – Name of the new attribute.
  • fields – Fields of the new attribute. Has the format [[FieldName, FieldType], ...]
Returns:

0 if success.

int ALWorldRepresentationProxy::clearObject(const std::string& objectName)

Remove an object and all its descendants from the world.

Parameters:
  • objectName – The name of the object to remove.
Returns:

0 if success.

int ALWorldRepresentationProxy::clearOldPositions(const std::string& databaseName, const int& maxAge)

Clear the stored positions (if relevant) of an object type which are older than a given number of seconds.

Parameters:
  • objectName – Name of the object.
  • maxAge – Number of seconds for which the position is outdated.
Returns:

0 if success.

int ALWorldRepresentationProxy::createObjectCategory(const std::string& categoryName, const bool& resetCategory)

Create a new object category, with the possibility to retrieved previously stored information on the category.

Parameters:
  • category – Name of the new category.
  • resetCategory – True if the content of the category is reset at the category creation.
Returns:

0 if success.

int ALWorldRepresentationProxy::deleteObjectAttribute(const std::string& objectName, const std::string& attributeName, const std::string& criterion)

Delete object attributes according to a given criterion (for example, with criterion=”LastSeen>42 OR Size < 1”).

Parameters:
  • objectName – Name of the object.
  • attributeName – Name of the attribute.
  • criterion – Criterion following the SQL criterion syntax.
Returns:

0 if success.

bool ALWorldRepresentationProxy::findObject(const std::string& objectName)

Check if an object is present.

std::vector<std::string> ALWorldRepresentationProxy::getChildrenNames(const std::string& objectName)

Get the objects which are direct children of the given object.

Parameters:
  • objectName – Name of the object.
Returns:

Vector of the object names.

std::string ALWorldRepresentationProxy::getObjectCategory(const std::string& objectName)

Get the category of an object.

Parameters:
  • objectName – Name of the object.
Returns:

Name of the the category (empty string if the object does not exist).

std::vector<std::string> ALWorldRepresentationProxy::getObjectNames()

Get the names of all objects from the world.

Returns:Vector of the object names.
AL::ALValue ALWorldRepresentationProxy::getObjectAttributes(const std::string& objectName)

Get all object attributes from an object.

Parameters:
  • objectName – Name of the object.
Returns:

List of all attributes [[AttributeName, AttributeFields] ] where AttributeFields = “(FieldName fieldtype, ...)”.

AL::ALValue ALWorldRepresentationProxy::getObjectLatestAttributes(const std::string& objectName, const int& latestCount)

Gets all the latest values for all attributes for a specific object.

Parameters:
  • objectName – Name of the query object
  • latestCount – Max number of values of the attributes (ordered by timestamp).
Returns:

All latests attributes value for each attribute with the following format [[AttributeName, [[field0Value, field1Value, ...]]], ]

AL::ALValue ALWorldRepresentationProxy::getObjectAttributeValues(const std::string& objectName, const std::string& attributeName, const int& latestCount)

Gets the latest values of a given attributes for a specific object.

Parameters:
  • objectName – Name of the query object.
  • attributeName – Name of the query attribute.
  • latestCount – Maximum number of values queried for the attributes (ordered by timestamp)
Returns:

All latests attribute values for the given attribute, with the following format [field0Value, field1Value, ...] following the attributes fields. Empty if the attribute or the object do not exist.

std::vector<std::string> ALWorldRepresentationProxy::getObjectsInCategory(const std::string& objectName)

Get all objects that belong to a given category.

Parameters:
  • categoryName – Name of the category.
Returns:

Vector of all object names.

std::string ALWorldRepresentationProxy::getObjectParentName(const std::string& objectName)

Get the parent object name of a given object, if applicable.

Parameters:
  • objectName – Name of the given object.
Returns:

Name of the parent object, or the object itself if it is the root.

AL::ALValue ALWorldRepresentationProxy::getPosition(const std::string& referenceName, const std::string& objectName)

Get the position of an object relative to another one with quaternion and translation.

Parameters:
  • referenceName – Name of the reference object.
  • objectName – Name of the object.
Returns:

[quaternion, translation] where quaternion = [w, x, y, z] and translation = [x, y, z]

std::vector<float> ALWorldRepresentationProxy::getPosition6D(const std::string& referenceName, const std::string& objectName)

Get the position of an object from the world relatively to another reference object in the world (with translation and Euler angles).

Parameters:
  • referenceName – Name of the reference object.
  • objectName – Name of the object.
Returns:

Position of the object relative to the reference object. This is a 6 dimensional vector containing [x, y, z, Wx, Wy, Wz] where Wx is the rotation around the X axis etc. Will be [0, 0, 0, 0, 0, 0] if one of the two objects does not exist.

std::vector<float> ALWorldRepresentationProxy::getPosition6DAtTime(const std::string& referenceName, const std::string& objectName, const int& secondsAgo, const int& interpType)
Parameters:
  • referenceName – Name of the reference object.
  • objectName – Name of the object.
  • secondsAgo – Age in seconds of the interpolated position.
  • interType – Type of interpolation. 0 is linear interpolation, 1 is Slerp interpolation.
Returns:

Position of the object relative to the reference object. This is a 6 dimensional vector containing [x, y, z, Wx, Wy, Wz] where Wx is the rotation around the X axis etc. Will be [0, 0, 0, 0, 0, 0] if one of the two objects does not exist.

std::string ALWorldRepresentationProxy::getRootName()
Returns:The name of the root object in the world representation.
int ALWorldRepresentationProxy::removeObjectCategory(const std::string& categoryName)

Completely remove a category and all objects belonging to this category.

Parameters:
  • categoryName – Name of the category to be removed.
Returns:

0 if success.

int ALWorldRepresentationProxy::save()

Save the graph and databases to the disk.

Returns:0 if success.
AL::ALValue ALWorldRepresentationProxy::select(const std::string& criterion, const std::string& categoryName, const std::string& attributeName, const std::string& fields)

Select attributes in a category which match a given criterion.

Parameters:
  • criterion – The criterion to match. The criterion is defined using SQL syntax for the WHERE clause (see here for example): it uses common operators on the field value. For example, a valid criterion is “Name=’Robert’ AND Age=42”.
  • categoryName – Name of the category.
  • attributeName – Name of the attribute.
  • fields – List of attribute fields that will be selected. “*” means all fields of the attribute, else the format must be “FieldName0, FieldName1, ...”.
Returns:

The attribute fields that match, with the following format: [Row0, Row1, ... ] where Rowi = [FieldValue0, FieldValue1, ...]. The field values are given in the order of the attribute definition when the selected fields are “*”, or else in the order given by the fields argument.

AL::ALValue ALWorldRepresentationProxy::selectWithOrder(const std::string& criterion, const std::string& orderBy, const std::string& categoryName, const std::string& attributeName, const std::string& fields)

Select attributes from a category which match a given criterion and order them according to one field value.

Parameters:
  • criterion

    The criterion to match. The criterion is defined using SQL syntax for the WHERE clause (see here for example): it uses common operators on the field value. For example, a valid criterion is “Name=’Robert’ AND Age=42”.

  • orderBy – The ordering, with the format “FieldName ASC” for ascending order and “FieldName DESC” for descending.
  • categoryName – Name of the category.
  • attributeName – Name of the attribute.
  • fields – List of fields that will be selected. “*” means all fields of the attribute, else the format must be “FieldName0, FieldName1, ...”.
Returns:

The attributes that match, with the following format: [Row0, Row1, ... ] where Rowi = [FieldValue0, FieldValue1, ...]. The field values are given in the order of the attribute definition when the selected fields are “*”, or else in the order given by the fields argument. The rows are ordered according to the field value.

int ALWorldRepresentationProxy::storeObject(const std::string& objectName, const std::string& parentName, const std::vector<float>& position6D, const std::string& categoryName, const AL::ALValue& attributes)

Store a new object.

Parameters:
  • objectName – Name of the new object. Must be unique.
  • parentName – Name of the parent object. Must exist.
  • position6D – Position of the new object relative to its parent.
  • categoryName – Name of the category of the object. Must exist.
  • attributes – Attributes of the object. Has a format [[attributeName, attributeFields], ... ] where attributeFields = [[FieldName, fieldvalue], ... ]
Returns:

0 if success.

int ALWorldRepresentationProxy::storeObjectWithReference(const std::string& objectName, const std::string& referenceName, const std::string& parentName, const std::vector<float>& position6D, const std::string& categoryName, const AL::ALValue& attributes)

Store a new object in the world, giving its position relative to a reference object and attaching it to a different parent object.

Parameters:
  • objectName – Name of the new object. Must be unique.
  • parentName – Name of the parent object. Must exist.
  • referenceName – Name of the reference object. Must exist.
  • position6D – Position of the new object relative to its parent.
  • categoryName – Name of the category of the object. Must exist.
  • attributes – Attributes of the object. Has a format [[attributeName, attributeFields], ... ] where attributeFields = [[FieldName, fieldvalue], ... ]
Returns:

0 if success.

int ALWorldRepresentationProxy::storeObjectAttribute(const std::string& objectName, const std::string& attributeName, const AL::ALValue& attributeFields)

Store a new attribute value of an object.

Parameters:
  • objectName – Name of the object.
  • attributeName – Name of the object attribute. Must be part of the object category.
  • attributeFields – Attribute value, with the format attributeFields = [[FieldName, fieldvalue], ... ]i
Returns:

0 if success.

int ALWorldRepresentationProxy::updatePosition(const std::string& objectName, const std::vector<float>& position6D, const bool& storePosition)

Update the position of an object relative to its parent.

Parameters:
  • objectName – Name of the object.
  • position6D – Position of the object relative to its parent ([x, y, z, Wx, Wy, Wz])
  • storePosition – Store the position in the position attribute of the object or not.
Returns:

0 if success.

int ALWorldRepresentationProxy::updatePositionWithReference(const std::string& objectName, const std::string& referenceName, const std::vector<float>& position6D, const bool& storePosition)

Update the position of an object relative to a reference object.

Parameters:
  • objectName – Name of the object.
  • position6D – Position of the object relative to the reference ([x, y, z, Wx, Wy, Wz])
  • storePosition – Store the position in the position attribute of the object or not.
Returns:

0 if success.

int ALWorldRepresentationProxy::updateAttribute(const std::string& objectName, const std::string& attributeName, const std::string& criterion, const AL::ALValue& attributeFields)

Update an attribute value of an object.

Parameters:
  • objectName – Name of an object.
  • attributeName – Name of the object attribute. Must be part of the object category.
  • criterion – Criterion the attribute must match to be updated. 1 for all.
  • attributeFields – Attribute value. attributeFields = [[FieldName, fieldvalue], ... ]
Returns:

0 if success.

void ALWorldRepresentationProxy::load()

Deprecated since version 1.22: unstable and inconclusive trial. Do not use.

void ALWorldRepresentationProxy::setObjectsLook(const std::string&, const ALValue&)

Deprecated since version 1.22: unstable and inconclusive trial. Do not use.

void ALWorldRepresentationProxy::startDisplaying()

Deprecated since version 1.22: unstable and inconclusive trial. Do not use.

void ALWorldRepresentationProxy::stopDisplaying()

Deprecated since version 1.22: unstable and inconclusive trial. Do not use.