Accessing configuration data (MongoDB)¶
ROS provides an interface to MongoDB that is used in ReconCell to store persistent data. Since the simulation system is a deeply integrated part of the toolchain, VEROSIM supports access methods to these datasets.
The MongoDBManager
is used to configure which model elements should be stored or loaded in the MongoDB message store. For this introduction into the MongoDB functionalities, we will use a very simple model that only contains a pose list with a single cartesian pose and a MongoDBManager that was already added as shown in the following screenshot.
Simple load and store example¶
We will now use the MongoDBRef
extensions to load and store the position and orientation of the Cartesian pose. Since we intend to store the pose’s worldframe, you need to add a VSLibROS::MongoDBRefTransformStamped
extension.
All the MongoDBRef
extensions use their names to identify the parent’s property that shall be saved or loaded. Therefore, you need to set the extension’s name to worldFrame
.
Afterwards append your newly created and renamed MongoDBRef extension to the MongoDBManager’s references list. You could easily add more references to your model to store different properties. You can also save complete nodes or subtrees from the VEROSIM database to MongoDB. Place the respective MongoDBRef extensions and append them to the manager’s references list.
This is sufficient to load and store model data. The manager can now be advised to load or store all references. Usually, this functionality is used from internal services. To trigger load or store events manually, you can set the manager’s save
or load
properties to true.
To try this out, please move your Cartesian pose to any position without saving the model. Activate the save
property of the manager and reload your model (again without saving). When the model is loaded again, navigate to the manager and activate the load
property. We will instantly see that the pose moves to the previous position and orientation.
MongoDBRef Overview¶
MongoDBRefJointState
Store or load the joint state of a kinematic. This is useful to e.g. store calibration data for a robot that was modeled with DH parameters from the robot’s datasheet.
MongoDBRefTf2
Store or load a Tf2 transformation. Like the example above, Tf2 transform are another possibility to store frame data.
MongoDBRefTransformStamped
Store or load a time-stamped transformation. This is the preferred type to use for storing poses, since the ReconCell ecosystem relies on these heavily.
MongoDBRefJSIDMPDescriptor
Store or load a DMP. These must be created by the VSPluginKinematicsJSI::DMP::Provider. Other DMP types are incompatible.
MongoDBRefProperty
Serialize and store any VEROSIM property. You can store any property or node and storage will include the full subtree if necessary. Load and deserialize function analogously.