logging_tutlesim
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
logging_tutlesim [2013/06/25 13:13] – bokal | logging_tutlesim [2016/05/19 09:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
==== Logging the data ==== | ==== Logging the data ==== | ||
Start the turtlesim and log all the topics using the following sets of commands | Start the turtlesim and log all the topics using the following sets of commands | ||
- | rosrun turtlesim | + | rosrun turtlesim |
- | rosrun turtlesim | + | rosrun turtlesim |
- | rosrun | + | rosrun |
# use Ctrl + C to stop | # use Ctrl + C to stop | ||
| | ||
Line 25: | Line 25: | ||
| | ||
| | ||
- | > | + | # see the list of items stored using the following |
+ | > db.getCollectionNames() | ||
+ | [ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | # further commands are given in standard mongo cheatsheets | ||
+ | > | ||
+ | |||
+ | === Via a python API === | ||
+ | The full documentation of the python API is available online at [[http:// | ||
+ | import pymongo | ||
+ | mclient = pymongo.Connection() | ||
+ | db = mclient[' | ||
+ | # get the collections | ||
+ | db.collection_names() | ||
+ | [u' | ||
+ | command_velocity' | ||
+ | # show all the data in the database | ||
+ | docs = db[' | ||
+ | for d in docs: | ||
+ | print d | ||
+ | # this displays a long list with elements like these | ||
+ | {u' | ||
+ | 440479278564, | ||
+ | bjectId(' | ||
+ | ded': 1372164044.44448} | ||
+ | {u' | ||
+ | 440479278564, | ||
+ | bjectId(' | ||
+ | ded': 1372164044.460494} | ||
+ | |||
+ | # querying can be done directly on these. e.g. | ||
+ | q = db[' | ||
+ | q.count() | ||
+ | 1 # which is exactly the last recording as shown in the data snippet above | ||
+ | |||
+ | |||
+ | | ||
logging_tutlesim.1372165994.txt.gz · Last modified: 2016/05/19 09:18 (external edit)