<> <> ## AUTOGENERATED DON'T DELETE ## CategoryPackage = Overview = This package provides an interface to the Cassandra database system, which can be used to store any types of ROS-messages in column families, similar to 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, explore your data afterwards by using Cassandra's CQL capabilities. = Installation = First of all you need to download and install CassandraDB manually form apache: http://cassandra.apache.org/download/ Then change the Cassandra partitioner to "ByteOrdered", which can be set in cassandra-install/conf/cassandra.yaml search for section partitioner and change it to the following: partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner ByteOrdered partitioner is required to retrieve requested data ordered, otherwise it will appear. For more information, have look on the documentation on http://www.datastax.com/docs/1.2/cluster_architecture/partitioners Secondly, you will have to install pycassa, an python interface for CassandraDB. The project is hosted on: pycassa.github.com/pycassa/ All information including installation, documentation, or a tutorial, are there available. == First run == 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: {{{ $ bin/cassandra -f }}} The option -f hinders Cassandra to start a deamon in backgroud, for more information and help visit : http://wiki.apache.org/cassandra/GettingStarted 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, camera-settings can be changed in the launch-file. First of all run {{{ $ roslaunch cassandra_ros recordCamera.launch }}} a window with the camera-stream should appear, furthermore this starts cassandraBag.py, a service which stores this stream in a CassandraDB. If you abort, recording will stop automatically. By running: {{{ $ roslaunch cassandra_ros replayCamera.launch }}} the recorded stream will be replayed. If you could see yourself, everything seems to be correct installed and configured. By running: {{{ $ roslaunch cassandra_ros deleteCamera.launch }}} the column-family, in which the stream was stored, gets deleted. The service cassandra_ros/node/bag/cassandraBag.py was in this case responsible for handling topics, if you want to use it as a command-line tool, see section … == Suggestions == There are a some graphical user interfaces available for Cassandra, which simplify the interaction with Cassandra. Using these it is quite easy to check, weather storing was successful or not, or to graphically explore your data. We recommend the usage of the following tools: === Cassandra Cluster Admin: === A php-tool similar to phpmyadmin and available under: https://github.com/sebgiroux/Cassandra-Cluster-Admin === Cassandra-Gui: === A simple java-tool, which can be downloaded from: http://code.google.com/a/apache-extras.org/p/cassandra-gui/ === Others: === Check the following link: http://wiki.apache.org/cassandra/Administration%20Tools = Tutorial = == Philosophy == 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 GUIs. Each topic is stored within its own column-family, one message per row. 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 to bother with hash-values, using our interface you can still work with topic-names, everything is hidden. All meta information about a topic, including type, storage-format, 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 meta-information, what reduces the amount of additional effort, but forbids to change the comment-field manually. Everything is handled within the background. == Basic Interface == There are only 2 classes, you need to be aware of, if you want to store and access ros-messages within Cassandra. *RosCassandra, which can be seen as the management-interface to Cassandra in a ROS typical manner. *CassandraTopic is required to handle the access to every topic/colum-family. Let us start by connecting to Cassandra: {{{#!python numbers=off import rospy import roslib; roslib.load_manifest("cassandra_ros") import RosCassandra as rc rospy.init_node('CassandraTest') # in most cases this is the standard configuration host = 'localhost' port = 9160 # that is nearly enough, only a keyspace is missing rosCas = rc.RosCassandra(host, port) # check if the keyspace exits if not rosCas.connectToKeyspace('test'): # if not, create one rosCas.createKeyspace('test') # connect again rosCas.connectToKeyspace('test') }}} Thats it, now we are connected. In the next step we will create a new topic/column-family: {{{#!python numbers=off # this is the datatype we will store from std_msgs.msg import String topic = 'test_topic' key_format='time' # this means, that we will use a timestamp as primary # key, other formats are 'hash' or 'msg_part' format = 'binary' # the format that is used for conversation, # other formats are 'string', 'ros', or 'yaml', # at first we create the new topic with the following command rosCas.addTopic(topic, format, 'String', 'std_msgs', key_format, None, # >/<>