robokudo.io.storage

Classes

Storage

This class holds the main interface code between RoboKudo and the MongoDB database.

Module Contents

class robokudo.io.storage.Storage(db_name)

This class holds the main interface code between RoboKudo and the MongoDB database. The latter can be used to store perceived data and also CAS views that you have specified. Here we also handle the conversion between concrete, non-standard classes (o3d data, RK types) and the representation that MongoDB can store (mainly Dict).

BLACKLISTED_TYPES
is_blacklisted()

Check if an object is of a blacklisted type.

static instantiate_mongo_client()
class Reader(db_name)
db_reader
reset_cursor()
collection_has_frames()
cursor_has_frames()
get_next_frame() dict | None
class ListReader(db_name)

Database Model class that reads all matching records into a list which is used to iterate over the data. This allows to easily combine the reading of DB records in conjunction with the way the CollectionReader is checking for new data.

db_reader
index = None
data = []
reset_cursor()
cursor_has_frames()
get_next_frame() dict | None
db_name
client
db
drop_database()
static nd_array_to_numpy_binary(arr)
static numpy_binary_to_nd_array(bin)
static ros_cam_info_to_mongo(cam_info)
static ros_cam_info_from_mongo(mongo_cam_info)
static camera_intrinsic_to_mongo(camera_intrinsic: open3d.camera.PinholeCameraIntrinsic) Dict[str, int | float]
static camera_intrinsic_from_mongo(camera_intrinsic_dict: Dict[str, int | float]) open3d.camera.PinholeCameraIntrinsic
static rk_stamped_transform_to_mongo(stamped_transform)
static rk_stamped_transform_from_mongo(stamped_transform_dict)
view_configuration
store_views_in_mongo(cas_dict: Dict) None

Store the views present in cas.views. Please note that this method will change cas. So make a deepcopy if you want to leave your true CAS untouched! :param cas_dict: CAS as a dictionary to persist

load_views_from_mongo_in_cas(cas_document: Dict) None
load_annotations_from_mongo_in_cas(cas_document: Dict, cas: robokudo.cas.CAS) None

Restore the annotations from the database and insert them into the CAS. If no (pickled) annotations are available, cas will be untouched.

Parameters:
  • cas_document – A dict representing a frame of a CAS in the database

  • cas – The ‘robokudo.cas.CAS’ instance where the annotations shall be inserted to

generate_dict_from_real_cas(cas: robokudo.cas.CAS) Dict

Generate dict that we can put in mongo from CAS :param cas: Input CAS that should be used to create a dict-representation of it. :return: A dict with references to parts of the input CAS.

store_cas_dict(cas_dict: Dict)