Commit 0eec2286 authored by andre-dietrich's avatar andre-dietrich
parents 89c0251f d24c4e64
...@@ -19,6 +19,16 @@ MongoDB. But in contrast to MongoDB you are able to choose the format you would ...@@ -19,6 +19,16 @@ MongoDB. But in contrast to MongoDB you are able to choose the format you would
like to store your messages. You can choose between various formats and thus, like to store your messages. You can choose between various formats and thus,
explore your data afterwards by using Cassandra's CQL capabilities. explore your data afterwards by using Cassandra's CQL capabilities.
## Media
[![YouTube](http://img.youtube.com/vi/lQczBtVmomc/0.jpg)](http://www.youtube.com/watch?v=lQczBtVmomc "click to watch")
[![YouTube](http://img.youtube.com/vi/tfczj1jb3B4/0.jpg)](http://www.youtube.com/watch?v=tfczj1jb3B4 "click to watch")
[![YouTube](http://img.youtube.com/vi/czLQ-yxBYC4/0.jpg)](http://www.youtube.com/watch?v=czLQ-yxBYC4 "click to watch")
[![YouTube](http://img.youtube.com/vi/y6LqLNB4VDk/0.jpg)](http://www.youtube.com/watch?v=y6LqLNB4VDk "click to watch")
## Installation ## Installation
First of all you need to download and install CassandraDB manually form apache: First of all you need to download and install CassandraDB manually form apache:
...@@ -50,7 +60,7 @@ available. ...@@ -50,7 +60,7 @@ available.
First of all you will need start Cassandra, what is done in most cases by going First of all you will need start Cassandra, what is done in most cases by going
into the folder, where Cassandra was installed and than by typing in: into the folder, where Cassandra was installed and than by typing in:
```bash ``` bash
$ bin/cassandra -f $ bin/cassandra -f
``` ```
The option -f hinders Cassandra to start a deamon in backgroud, for more The option -f hinders Cassandra to start a deamon in backgroud, for more
...@@ -60,7 +70,7 @@ We added three simple launch-files, with which you can test, if your ...@@ -60,7 +70,7 @@ We added three simple launch-files, with which you can test, if your
installation was successful. You will need a webcam to run these examples, installation was successful. You will need a webcam to run these examples,
camera-settings can be changed in the launch-file. First of all run camera-settings can be changed in the launch-file. First of all run
```bash ``` bash
$ roslaunch cassandra_ros recordCamera.launch $ roslaunch cassandra_ros recordCamera.launch
``` ```
a window with the camera-stream should appear, furthermore this starts a window with the camera-stream should appear, furthermore this starts
...@@ -68,25 +78,25 @@ cassandraBag.py, a service which stores this stream in a CassandraDB. If you ...@@ -68,25 +78,25 @@ cassandraBag.py, a service which stores this stream in a CassandraDB. If you
abort, recording will stop automatically. If this does not work, or you see the abort, recording will stop automatically. If this does not work, or you see the
message: message:
``` ``` plain
Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) Not starting RPC server as requested. Use JMX (StorageService->startRPCServer())
or nodetool (enablethrift) to start it ... or nodetool (enablethrift) to start it ...
``` ```
then simply run: then simply run:
```bash ``` bash
$ sudo nodetool (enablethrift) $ sudo nodetool (enablethrift)
``` ```
By running: By running:
```bash ``` bash
$ roslaunch cassandra_ros replayCamera.launch $ roslaunch cassandra_ros replayCamera.launch
``` ```
the previous recorded stream will be replayed. If you could see yourself, the previous recorded stream will be replayed. If you could see yourself,
everything seems to be correct installed and configured. By running: everything seems to be correct installed and configured. By running:
```bash ``` bash
$ roslaunch cassandra_ros deleteCamera.launch $ roslaunch cassandra_ros deleteCamera.launch
``` ```
the column-family, in which the stream was stored, gets deleted. The service the column-family, in which the stream was stored, gets deleted. The service
...@@ -119,22 +129,20 @@ http://wiki.apache.org/cassandra/Administration%20Tools ...@@ -119,22 +129,20 @@ http://wiki.apache.org/cassandra/Administration%20Tools
## Philosophy ## Philosophy
These are some design-principles we made for data handling, which might a bit 1. These are some design-principles we made for data handling, which might a bit
confusing, if you examine your data with other tools or one of the recommended confusing, if you examine your data with other tools or one of the
GUIs. recommended GUIs.
2. Each topic is stored within its own column-family, one message per row.
Each topic is stored within its own column-family, one message per row. 3. Due to the maximum column-family-name-length of 42 Bytes, we use the
hash-value of the topic-name as the column-family-name. But you do not need
Due to the maximum column-family-name-length of 42 Bytes, we use the hash-value to bother with hash-values, using our interface you can still work with
of the topic-name as the column-family-name. But you do not need to bother with topic-names, everything is hidden.
hash-values, using our interface you can still work with topic-names, everything 4. All meta information about a topic, including type, storage-format,
is hidden. key-format, etc. are stored within the comment-field of every column-family.
No other column-family is required or has to be updated to store
All meta information about a topic, including type, storage-format, key-format, meta-information, what reduces the amount of additional effort, but forbids
etc. are stored within the comment-field of every column-family. No other to change the comment-field manually. Everything is handled within the
column-family is required or has to be updated to store meta-information, what background.
reduces the amount of additional effort, but forbids to change the comment-field
manually. Everything is handled within the background.
## Basic Interface ## Basic Interface
...@@ -145,7 +153,7 @@ required to handle the access to every topic/colum-family. ...@@ -145,7 +153,7 @@ required to handle the access to every topic/colum-family.
## Let us start by connecting to Cassandra: ## Let us start by connecting to Cassandra:
```python ``` python
import rospy import rospy
import roslib; roslib.load_manifest("cassandra_ros") import roslib; roslib.load_manifest("cassandra_ros")
import RosCassandra.RosCassandra as rc import RosCassandra.RosCassandra as rc
...@@ -170,7 +178,7 @@ rosCas.connectToKeyspace('test') ...@@ -170,7 +178,7 @@ rosCas.connectToKeyspace('test')
Thats it, now we are connected. In the next step we will create a new Thats it, now we are connected. In the next step we will create a new
topic/column-family: topic/column-family:
```python ``` python
# this is the datatype we will store # this is the datatype we will store
from std_msgs.msg import String from std_msgs.msg import String
topic = 'test_topic' topic = 'test_topic'
...@@ -197,7 +205,7 @@ rosCas.getAllTopics() ...@@ -197,7 +205,7 @@ rosCas.getAllTopics()
``` ```
In the next step we will start to insert some messages into the database In the next step we will start to insert some messages into the database
```python ``` python
# get the topic-containerros # get the topic-containerros
topicContainer = rosCas.getTopic(topic) topicContainer = rosCas.getTopic(topic)
...@@ -258,7 +266,7 @@ storing. But currently it is also possible to store messages as "strings", ...@@ -258,7 +266,7 @@ storing. But currently it is also possible to store messages as "strings",
"yaml", or "ros" format. The type of conversion is defined at the creation of a "yaml", or "ros" format. The type of conversion is defined at the creation of a
topic-container: topic-container:
```python ``` python
rosCas.addTopic(topic, rosCas.addTopic(topic,
format, # exactly in here ... 'string', 'yaml', 'ros', 'binary' format, # exactly in here ... 'string', 'yaml', 'ros', 'binary'
'String', 'String',
...@@ -273,7 +281,7 @@ therefore translated into a linar form and column are strongly typed, according ...@@ -273,7 +281,7 @@ therefore translated into a linar form and column are strongly typed, according
to the defined message formats. A Message of type to the defined message formats. A Message of type
"geometry_msgs/TransformStamped": "geometry_msgs/TransformStamped":
```plain ``` plain
std_msgs/Header header std_msgs/Header header
uint32 seq uint32 seq
time stamp time stamp
...@@ -292,7 +300,7 @@ geometry_msgs/Transform transform ...@@ -292,7 +300,7 @@ geometry_msgs/Transform transform
``` ```
is then transformed into Cassandra format: is then transformed into Cassandra format:
```plain ``` plain
.header.seq : INT_TYPE .header.seq : INT_TYPE
.header.stamp : DATE_TYPE .header.stamp : DATE_TYPE
.header.frame_id : UTF8_TYPE .header.frame_id : UTF8_TYPE
...@@ -311,7 +319,7 @@ How does it work? If you take a look into cassandra_ros/lib ... you will see a ...@@ -311,7 +319,7 @@ How does it work? If you take a look into cassandra_ros/lib ... you will see a
couple of files in the form of CassandraTopic_'format'.py, which are all couple of files in the form of CassandraTopic_'format'.py, which are all
descendants of CassandraTopic_.py. And each of them overwrites the methods: descendants of CassandraTopic_.py. And each of them overwrites the methods:
```getColumnValidationClasses```: as the name suggests, is used to define the `getColumnValidationClasses`: as the name suggests, is used to define the
column validation classes of the column-family * encode is used to encode the column validation classes of the column-family * encode is used to encode the
ROS message into a Cassandra storable format * and decode translates it back, ROS message into a Cassandra storable format * and decode translates it back,
from Cassandra to ROS. from Cassandra to ROS.
...@@ -331,14 +339,14 @@ will have to generate at first secondary indexes. Because this might be ...@@ -331,14 +339,14 @@ will have to generate at first secondary indexes. Because this might be
expensive and not required for every part of a message, this has to be done expensive and not required for every part of a message, this has to be done
manually, as follows: manually, as follows:
```python ``` python
# this will automatically generate the appropriate index # this will automatically generate the appropriate index
rosCas.createIndex(topic, '.data') rosCas.createIndex(topic, '.data')
``` ```
For an automatic translation of topics, use the following method, this will For an automatic translation of topics, use the following method, this will
replace topicnames with their hash-value. replace topicnames with their hash-value.
```python ``` python
# will return everything # will return everything
rosCas.exequteCQL('SELECT * FROM "test_topic"') rosCas.exequteCQL('SELECT * FROM "test_topic"')
...@@ -369,40 +377,40 @@ If you already checked, if your package is working, than you already had used ...@@ -369,40 +377,40 @@ If you already checked, if your package is working, than you already had used
cassandraBag. This is a simple service, which stores and replays messages cassandraBag. This is a simple service, which stores and replays messages
similar to rosbag. Simply start the application with: similar to rosbag. Simply start the application with:
```bash ``` bash
$ roslaunch cassandra_ros cassandraBag.launch $ roslaunch cassandra_ros cassandraBag.launch
``` ```
You can also change some of the parameters in the launch-file. Storing and You can also change some of the parameters in the launch-file. Storing and
replaying or deleting topics requires to use the following command-line tool: replaying or deleting topics requires to use the following command-line tool:
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py $ rosrun cassandra_ros cassandraBag-cli.py
``` ```
To get a list of all currently stored topics, use the parameter 'list': To get a list of all currently stored topics, use the parameter 'list':
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py list $ rosrun cassandra_ros cassandraBag-cli.py list
``` ```
Use record to store online messages, while option -f denotes the storage-format Use record to store online messages, while option -f denotes the storage-format
rosrun cassandra_ros cassandraBag-cli.py record -f string start topic and use rosrun cassandra_ros cassandraBag-cli.py record -f string start topic and use
record stop to finish recoring record stop to finish recoring
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py record stop topic $ rosrun cassandra_ros cassandraBag-cli.py record stop topic
``` ```
You can bag as many topics as Cassandra supports in parallel and stop and run You can bag as many topics as Cassandra supports in parallel and stop and run
recording dynamically recording dynamically
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py play start /usb_cam/image_raw/compressed $ rosrun cassandra_ros cassandraBag-cli.py play start /usb_cam/image_raw/compressed
``` ```
and if you want to delete some topics use delete, for more help, just run and if you want to delete some topics use delete, for more help, just run
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py -h $ rosrun cassandra_ros cassandraBag-cli.py -h
``` ```
or something like, which will support you with some command-line options ... or something like, which will support you with some command-line options ...
```bash ``` bash
$ rosrun cassandra_ros cassandraBag-cli.py play $ rosrun cassandra_ros cassandraBag-cli.py play
``` ```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment