ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I receive mongo_ros import error because is no longer included in ros-groovy-warehouse_ros package.
Developers recommend using PyMongo, so I have to adapt my code for the new interface with database. The main changes that I have to do are the following:
Change imports:
import pymongo
from pymongo import MongoClient
Different way to set up the collection:
self.pyMongoClient = MongoClient('localhost', 27017)
self.db = self.pyMongoClient['trajectory_db']
self.coll = self.db['trajectories']
With mongo_ros I can create a collection of ros msg like JointTrajectory, so I can insert robot trajectories without any manipulation, directly with 'insert' method:
self.coll.insert(trajectory, self.makeMetaData(traj_name))
With pymongo I don't know how to insert ros msg into database, encode/serialization errors were received. Then I have to develop encode/decode function to convert trajectory points in a serializable objects (array of arrays) and vice versa.
Summarizing, I have to change my insert method, otherwise only little changes are necessary.
Regards.