Code Monkey home page Code Monkey logo

soma's Introduction

SOMA

Semantic Object Map (SOMA) package. SOMA can include objects, regions of interest (ROI) and trajectories. It is based on Mongodb for storing high-level data obtained from perceptual pipeline of a robot. The extracted data could be stored along with spatial and temporal information which can be later used for building high-level queries with spatio-temporal constraints.

Prerequisites

  • MongoDB (>=2.6)
  • ROS mongodb_store package
  • ROS navigation stack (only map server)
  • Qt5 (sudo apt-get install qtbase5-dev)

Getting started (general steps)

  1. Start the ros core:

    $ roscore
    
  2. Launch the ROS datacentre:

    $ roslaunch mongodb_store mongodb_store.launch db_path:=<path_to_db>
    

By default, the SOMA data are stored in somadata database. The collections under this database are object for SOMA objects, roi for SOMA rois and map for 2D occupancy maps.

SOMA map manager

  1. SOMA is based on the assumption that all the data are with respect to 2D global map frame. So it is mandatory to publish a 2D map using SOMA map manager before using SOMA. This node is used for storing, reading and publishing 2D map:
$ rosrun soma_map_manager soma_map_manager_node.py --mapname <map_name>

If there are any stored 2D occupancy maps in the datacenter, the name of the map could be inputted as an argument to the map manager. Alternatively, user can choose the map to be published from the outputted list. If there are no stored maps, it will wait for a 2D map to be published from map_server. Run the map_server with a 2D map:

$ rosrun map_server map_server <map.yaml>

where map.yaml specifies the map you want to load. After running the map_server, you should save the published map using the SOMA map manager.

  1. If you want to check the published map, start RVIZ, add a Map display type and subscribe to the soma/map topic:
$ rosrun rviz rviz

SOMA ROI manager

  1. If you want to create SOMA ROIs, run the SOMA ROI manager:

    $ rosrun soma_roi_manager soma_roi_node.py <config_name>
    

where config_name denotes an object configuration name. By default, the configuration file soma_roi_manager/config/default.json is used to initialize the list of available ROI types. Alternatively, the following command can be used to use a different configuration file:

```
$ rosrun soma_roi_manager soma_roi.py -t /path/to/config/file <config>
```

2D map information will be gathered from soma/map_info service of SOMA map manager. 6. In RVIZ, add an InteractiveMarker display type, and subscribe to the /soma_roi/update topic: 7. Add, delete, modify ROIs in RVIZ using the interactive marker and the context menu (right-mouse-click)

marker

ROS Services

The other nodes can communicate with SOMA using the SOMA service calls. In order to use these services, one should run the soma data manager:

SOMA data manager

  1. Run the soma data manager:
$ rosrun soma_manager data_manager_node.py
--object_collection_name <collection_name> --object_db_name <db_name>

The parameters db_name and collection_name are optional which can be used to define the database and collection name for data storage.

SOMA query manager

  1. Run the soma query manager:
$ rosrun soma_query_manager query_manager_node
<object_db_name> <object_collection_name> <roi_db_name> <roi_collection_name>

By default the data is stored under default db and collections :

object ROI map
db_name somadata somadata somadata
collection_name object roi map

Object insertion

One or multiple SOMA objects can be inserted using the SOMA service call /soma/insert_objects. The unique mongodb ids and a boolean value are returned. The boolean return value determines whether the request was successfully completed or not.

Object deletion

One or multiple SOMA objects can be deleted using the SOMA service call /soma/delete_objects. The SOMA object ids are used for deletion. The boolean return value determines whether the request was successfully completed or not.

Object update

A SOMA object can be updated using the SOMA service call /soma/update_object. The boolean return value determines whether the request was successfully completed or not.

Object query

SOMA objects could be queried using SOMA service call /soma/query_objects. The query request should be filled according to the spatio-temporal constraints. The results are returned based on the query type and constraints.

ROI query

SOMA ROIs could be queried using SOMA service call /soma/query_rois. The query request should be filled according to the spatio-temporal constraints. The results are returned based on the query type and constraints.

soma's People

Contributors

cburbridge avatar hawesie avatar hkaraoguz avatar jayyoung avatar kunzel avatar marc-hanheide avatar nilsbore avatar raresambrus avatar strands-jenkins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soma's Issues

when does this update mongodb?

@kunzel When does the soma manager update mongodb?

I deleted an object in rviz, and it was removed from the mongodb soma message store. But it remained in the geospatial message store. This caused me an issue because I obtain the objects from geo store, and the x, y coordinates from the message store.

Geospatial_store can not access mongodb remotely

I got an error from geospatial_store which tells me that it can not connect to localhost:62345.

[ERROR] [WallTime: 1429726545.957402] Exception in your execute callback: could not connect to localhost:62345: [Errno 111] Connection refused
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/python2.7/dist-packages/actionlib/simple_action_server.py", line 299, in executeLoop
    self.execute_callback(goal)
  File "/home/strands/g4s_ws/src/trajectory_behaviours/relational_learner/scripts/OfflineLearning_action.py", line 29, in execute
    if not self.cond(): ol.learn()
  File "/home/strands/g4s_ws/src/trajectory_behaviours/relational_learner/scripts/learn_traj_behaviours.py", line 160, in learn
    r = run_all()
  File "/home/strands/g4s_ws/src/trajectory_behaviours/relational_learner/scripts/learn_traj_behaviours.py", line 58, in run_all
    gs = GeoSpatialStoreProxy('geospatial_store','soma')
  File "/home/strands/g4s_ws/src/soma/soma_geospatial_store/src/soma_geospatial_store/geospatial_store.py", line 43, in __init__
    self._client = pymongo.MongoClient(host,port)
  File "/usr/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 352, in __init__
    raise ConnectionFailure(str(e))
ConnectionFailure: could not connect to localhost:62345: [Errno 111] Connection refused

This is wrong since it is supposed to access mongodb in other computer remotely (from bobl to bob).

Merging 2.0 branch into the master branch

Hi all,

Is it possible to merge 2.0 into the master branch?
In that way, we can re-release soma with its newer version.
I dont think anybody still uses the old version of soma.

Error in RVIZ

There is an error when running both soma_manager and soma_roi in RVIZ.
It says

Error getting time of latest transform between /map and map: (error code: 1)

Usually, running mongodb and map_server is enough to make soma and soma_roi run properly.
@PDuckworth encounters the same problem.
Any idea why?

Find roi for waypoint

I want to lookup what ROIs cover a given waypoint, which would involve listing the ROIs and checking is_inside. I notice there are functions for this stuff already...what is the best way to do it, and should I include it in SOMA or make it separate?

Little bug on update branch with map manager

One for @hkaraoguz I think! seems like just a tiny logic error somewhere. I ran:

jxy@DOPPLEGANGER:~/soma_ws$` roslaunch soma_manager soma2_local.launch map_name:=aloof

Then I got

[ INFO] [1476960944.631418854]: Waiting for SOMA Map Service...
[INFO] [WallTime: 1476960944.684978] Running SOMA map manager
No maps are found in DB. Listening map_server for a map...
Map is received. Please enter a name for storing it in the database: [INFO] [WallTime: 1476960944.824152] Running SOMA data manager (dbname: soma2data, collection_name: soma2)
Waiting for the map info from soma_map_manager
[ERROR] [WallTime: 1476960949.942048] No 'soma/map_info' service, Quitting...
[soma_data_manager_node-2] process has finished cleanly
log file: /home/jxy/.ros/log/2d2d8b4c-96b3-11e6-9c5f-1c872c60d569/soma_data_manager_node-2*.log

But it was still listening for input from line 4 there, it seems... So I typed the name of my map

aloof
you entered aloof
map is now being published on soma/map topic
[ INFO] [1476960968.022460250]: Received map info. Map Name: aloof, Map Unique ID: 5808a2c70b226751c422fc71
[ INFO] [1476960968.022917305]: SOMA Query Service Ready.

Which worked, and then I ran the launch file again and everything was fine and it all worked. It looks like the system should be waiting after it asks for the map name, but it doesn't, and then just runs on looking for the soma/map_info topic, can't find it (because that doesn't come up until you give it the map name, I guess?) then crashes. The map was actually already in the db, I think, which is why I passed it as a parameter, but I guess it wasn't found for some reason? It might be because I created the map under the previous branch, which had lots of stuff named with "soma2", so could just be an issue with collection names.

Pose vs location in geospatial proxy

Code like the following is in GeoSpatialStoreProxy but as far as I see the documents in the store don't have pose fields, therefore this will always return None.

 def obj_coords(self, soma_id, soma_map, soma_config):
        """Returns the map coordinates of a soma_id object"""
        query = {  "map":  soma_map,
                   "config": soma_config,
                   "id": soma_id
                } 

        res = self.find_projection(query, {"pose": 1})

        if res.count() == 0:
            return None
        return res[0]['pose']['position']['x'], res[0]['pose']['position']['y'], \
            res[0]['pose']['position']['z']

New ROI objects created when editing existing ROIs?

In the latest commit on the update branch, is this the right behaviour? I add a new ROI, and then every time I edit it by moving one of the vertices, a brand new ROI object is entered into the database with the same ID as the old one, but with the new vertices and a more recent timestamp, rather than (what I would expect, and how it worked in the past) updating the old ROI object.

Am I doing something wrong? This makes it hard to do what I have been doing before-- getting all the ROIs from the database, picking one, and seeing if a given point is in that ROI. I guess this is for learning dynamic ROIs online that might change over time? But I think there should be a service to just return the set of most up-to-date ROIs for everything. Maybe there is and I am just using the wrong service call?

@hkaraoguz ?

rosservice /soma/query_objects

A query for all objects in a region fails if no object ids or type info is given. I think, it is the case because a type query with an empty string ("") is added by default.

@hkaraoguz, can you confirm this? And can we remove this? Or is there a reason for this behavior?

lars@xps15:~$ rosservice call /soma/query_objects "query_type: 0
uselowertime: false
useuppertime: false
usedates: false
useweekday: false
useroi: true
lowerhour: 0
upperhour: 0
lowerminutes: 0
upperminutes: 0
lowerdate: 0
upperdate: 0
weekday: 0
objectids: []
objecttypes: ['']
roi_id: '1'
config: ''" 
timedatelimits: []
types: []
ids: []
unique_ids: []
objects: []
queryjson: { "geoloc" : { "$geoWithin" : { "$geometry" : { "coordinates" : [ [ [ -3.470230539903696e-05, 1.899294748852753e-05 ], [ -3.532057527877441e-05, 5.444035780044487e-05 ], [ 3.768879300025674e-05, 5.349052088376993e-05 ], [ 3.537138304920973e-05, 1.808334768327313e-05 ], [ -3.470230539903696e-05, 1.899294748852753e-05 ] ] ], "type" : "Polygon" } } }, "$or" : [ { "type" : "" } ] }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.