topic_store
ROS package used for serialising common ROS messages to a database or filesystem
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Keywords
Repository
ROS package used for serialising common ROS messages to a database or filesystem
Basic Info
Statistics
- Stars: 6
- Watchers: 2
- Forks: 12
- Open Issues: 7
- Releases: 0
Topics
Metadata Files
docs/README.md
Topic Store
Topic Store is a ROS package for storing ROS messages to a database or filesystem.
Unlike ROS bags Topic Store adds flexibility by serialising all messages into a data hierarchy that's easily searchable with database queries and allows for remote storage.
You can also use Topic Store as a standalone python package to read and write data without a ROS installation!
Installation
ROS
```bash
From source
cd catkinws/src git clone https://github.com/RaymondKirk/topicstore catkin build topic_store
From apt
sudo apt install ros-melodic-topic-store # you need to add the L-CAS ros source ```
Installing without ROS
You can install topic_store as an independent python2/3 package without a working ROS installation.
```bash
From source
git clone https://github.com/RaymondKirk/topicstore cd topicstore/src pip install --extra-index-url https://rospypi.github.io/simple/ -e .
From PyPi
pip install --extra-index-url https://rospypi.github.io/simple/ topic-store ```
To install other dependencies i.e. ros_numpy you can run the following
bash
pip install --extra-index-url https://rospypi.github.io/simple/ ros_numpy
Usage
Create a scenario file by following the documentation in scenarios or by following the example file default_config.yaml. The example below will save a history of all messages sent to the ros log topic.
```yaml
Save to /path/to/your/scenario/file.yaml. This collection behaviour will save your log history.
context: "saveroslogs"
storage: "method": "filesystem" "location": "default"
data: { "ros_msg": "/rosout", }
collection: method: "event" watch_topic: "/rosout" ```
If storage.method is database ensure that your database is accessible at the host/port in the config file found at
storage.config. To launch the default database roslaunch topic_store start_database.launch, the default
database creates/uses a Mongo 4.2 server instance in the default ${HOME}/.ros/topic_store/database
folder exposed on localhost:65530 (defined in storage.config of the scenario file).
Docker is a requirement to use a database backend to avoid conflicts with system mongo. A utility script is provided in
scripts/install_docker.sh if you do not have it installed.
Launch your data collection scenario!
roslaunch topic_store run_scenario.launch scenario_file:="/path/to/your/scenario/file.yaml"
Examples
Database data
The below example shows how to load and use files stored in a database.
```python import topic_store as ts
Read data
storage = ts.load("/path/to/scenario/file/containing/db/connection/info.yaml") for item in storage: print("As Python Dict", item.dict) # or item["key"] print("As ROS Msgs", item.msgs) # or item("key")
Write data
storage.insertone({"importantdata": "topic store is great!"}) ```
Filesystem data
The below example shows how to load and use .topic_store files, saved from when scenarios are ran with the
storage_method="filesystem" option.
```python import topic_store as ts
Read data
storage = ts.load("/path/to/file.topic_store") for item in storage: print("As Python Dict", item.dict) # or item["key"] print("As ROS Msgs", item.msgs) # or item("key")
Write data
storage.insertone({"importantdata": "topic store is great!"}) ```
Launch a database
When launching a data collection scenario where storage.method==database you must also launch the database or
ensure it's already running at the uri defined in the host/port parameters of the config file located at storage.config.
To launch a database prior to running a data collection scenario.
bash
roslaunch topic_store start_database.launch scenario_file:="/path/to/your/scenario/file.yaml"
Convert to ROS bags
Filesystem .topic_store files and database collections can be converted to ROS bags.
```bash
Convert filesystem files to rosbags
rosrun topicstore convert.py -i input.topicstore -o output.bag
Convert database collections to rosbags
Pass scenario file containing connection and collection info as the input
rosrun topicstore convert.py -i scenarioconfig.yaml -o output.bag ```
Convert between Filesystem and Database
Filesystem .topic_store files can be migrated to a MongoDB database. Pass the scenario file that contains the database
connection information as the output file.
bash
rosrun topic_store convert.py -i input.topic_store -o scenario_config.yaml
Database collections can be converted to a filesystem .topic_store file. Pass the scenario file that contains the database
connection information as the input file.
bash
rosrun topic_store convert.py -i scenario_config.yaml -o output.topic_store
Export from Mongodb query into rosbag/filesystem
Example call:
- With typical mongodb URI for SSL and authentication
- On database
ff_rasberryand collection2020_riseholme_framos_cameras - Specify database connection URI (
-i) with db nameauthSource=database - Including a query (
-q) for a specific document - Add projection to return only sub-documents (
-p)
bash
convert.py -i "mongodb://USER:PASS@HOST:PORT/?authSource=ff_rasberry&tls=true&tlsAllowInvalidCertificates=true" -c 2020_riseholme_framos_cameras -q '{"_id":"ObjectId(5f115ee6af915351df739757)"}' -p '{"cameras.top.color":1, "robot": 1}' -o out.bag
Storing high bandwidth image data
To store a lot of image data you will be limited to the IO of your machine. Topic Compression offers a compression solution to increase capture performance.
```bash
Install the ROS package
cd catkinws/src git clone https://github.com/RaymondKirk/topiccompression catkin build topic_compression
Compression/Decompression is chosen automatically so just pass the input topic name and optionally the out topic name
rosrun topiccompression run in:=/camera/colour/imageraw # out=/camera/colour/imageraw/compressed rosrun topiccompression run in:=/camera/depth/imageraw # out=/camera/depth/imageraw/compressed ```
Owner
- Name: Raymond
- Login: RaymondCM
- Kind: user
- Location: Lincoln, UK
- Company: @FruitCast
- Website: https://raymondcm.com
- Repositories: 43
- Profile: https://github.com/RaymondCM
Dr. Raymond Martin. Founder, FruitCast Ltd.
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| RaymondKirk | r****l@l****k | 220 |
| Peter Lightbody | p****0@g****m | 8 |
| Marc Hanheide | m****c@h****t | 4 |
| Riccardo Polvara | p****2@g****m | 2 |
| Nikos Tsagkopoulos | n****o@g****m | 1 |
| zotac | z****c@t****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 10
- Total pull requests: 22
- Average time to close issues: about 1 month
- Average time to close pull requests: 26 days
- Total issue authors: 5
- Total pull request authors: 5
- Average comments per issue: 2.0
- Average comments per pull request: 0.5
- Merged pull requests: 21
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- RaymondCM (6)
- ptoupas (1)
- pet1330 (1)
- rakovskij-stanislav (1)
- arsh09 (1)
Pull Request Authors
- RaymondCM (13)
- pet1330 (3)
- pulver22 (3)
- marc-hanheide (2)
- nikostsagk (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- numpy >=1.13.3
- pathlib >=1.0.1
- pymongo >=3.6.1
- pyyaml >=3.12
- rospkg >=1.2.6
- tqdm >=4.19.0
- actionlib *
- actionlib_msgs *
- genpy <=2000,>=0.6.14
- geometry_msgs *
- nav_msgs *
- pathlib *
- ros_numpy *
- rosbag *
- roslib *
- rospy *
- sensor_msgs *
- tqdm *
- actions/checkout v2 composite
- mongo 4.2