|
MemoryX is based on the ArmarX framework and provides a memory layer for robots. It depends on ArmarXCore and ArmarXGui and further Components of VisionX use MemoryX to store and update retrieved data. All information is stored using MongoDB as a backend.
As a first step MongoDB needs to be started before MemoryX can be used. This is done via the following script:
armarx memory start
If an error occurs during the execution of this script follow the given advice and run
armarx memory repair
If MongoDB is started for the first time no databases will be available. To work with ARMAR-III, you therefore have to first import a memory snapshot with the kitchen and object models into the MongoDB. To do so, execute the following command:
${MemoryX_DIR}/build/bin/mongoimport.sh ${ArmarX_DIR}/ArmarXDB/data/ArmarXDB/dbexport/memdb
At ${ArmarX_DIR}/ArmarXDB/data/ArmarXDB/dbexport/memdb the standard library is stored as JSON text files.
The export of a current database in the mongoDB is also easily possible: Use the following command to export the database memdb to the directory ${ArmarX_DIR}/ArmarXDB/data/ArmarXDB/dbexport/memdb.
${MemoryX_DIR}/build/bin/mongoexport.sh memdb ${ArmarX_DIR}/ArmarXDB/data/ArmarXDB/dbexport/memdb
This directory and the current database collections are already checked in into git. To commit the database to git, just commit the contents of the directory ${ArmarX_DIR}/ArmarXDB/data/ArmarXDB/dbexport/memdb after export. Each database should be exported into a separate directory, because the importer reads alls files from the given directory.
The MongoDB Shell can be used for quick interactions with MongoDB. It can be started with the following script:
${MemoryX_DIR}/build/bin/mongo.sh
The following commands are helpful to check available databases and their collections:
show dbs # list all available databases use <dbname> # use <dbname> as a basis for all further queries show collections # list all available collections in the currently active database db.<collection>.findOne() # select one item from <collection> and display its JSON data
An easy-to-use GUI for accessing and querying MongoDB is RoboMongo.
With robomongo it is easy to depict and edit the current content of the database (see below).
Altogether, the following three memory types are provided:
The information associated with these memory types are stored in different collections. After the memdb.zip snapshot has been loaded into MongoDB the following collections among others can be found in the memdb database:
The collections prefixed with Prior_ contain prior knowledge data such as objects, kitchen visualisation information, links to *.iv files and so on.
An object in the Prior_Objects collection can be examined with the db.Prior_Objects.findOne() query. It reveals that an object in this collection contains the attributes for (stored in "attr"):
CommonStorage is a wrapper for MongoDB and can be used to store and retrieve arbitrary data. CommonStorageTest shows some testcases on how CommonStorage can be used.
CommonPlacesTest contains example code on how to use the CommonPlaces memory.