Reading a bagfile from the cloud location

Install bagpy

[1]:
!pip install bagpy
Collecting bagpy
  Downloading https://files.pythonhosted.org/packages/a0/8b/e06b8c3bd12838dcb062562d1c76efd92f9d7a372cc1775c69dff9d5f9d9/bagpy-0.4-py2.py3-none-any.whl
Requirement already satisfied: ipython in /usr/local/lib/python3.6/dist-packages (from bagpy) (5.5.0)
Collecting bitstring>=3.1.6
  Downloading https://files.pythonhosted.org/packages/c3/fc/ffac2c199d2efe1ec5111f55efeb78f5f2972456df6939fea849f103f9f5/bitstring-3.1.7.tar.gz (195kB)
     |████████████████████████████████| 204kB 6.5MB/s
Collecting py3rosmsgs
  Downloading https://files.pythonhosted.org/packages/35/86/df7c6d74d076b80a360fa1ccf2687502a01527435ab825e9b64caec0ec4e/py3rosmsgs-1.16-py2.py3-none-any.whl (1.1MB)
     |████████████████████████████████| 1.1MB 12.8MB/s
Collecting pymdown-extensions
  Downloading https://files.pythonhosted.org/packages/08/a1/087c5f2028098ae16526080f185fa437912624ab5f89f02a138b0b9857be/pymdown_extensions-8.0.1-py2.py3-none-any.whl (206kB)
     |████████████████████████████████| 215kB 24.9MB/s
Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from bagpy) (3.2.2)
Requirement already satisfied: seaborn>=0.9.0 in /usr/local/lib/python3.6/dist-packages (from bagpy) (0.11.0)
Requirement already satisfied: pathlib in /usr/local/lib/python3.6/dist-packages (from bagpy) (1.0.1)
Collecting sphinx-autodoc-typehints
  Downloading https://files.pythonhosted.org/packages/82/24/7b0a565c99df8b2b7da14b553d601e446f7fe57bc2d8cd42851c4da9c1ae/sphinx_autodoc_typehints-1.11.0-py3-none-any.whl
Collecting pyserial>=3.4
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
     |████████████████████████████████| 194kB 34.5MB/s
Collecting rinohtype
  Downloading https://files.pythonhosted.org/packages/25/d9/14b2d7e76c0bf207fd95125afeddf0849a947cee7d2477f91a1234f364aa/rinohtype-0.4.2-py3-none-any.whl (598kB)
     |████████████████████████████████| 604kB 29.7MB/s
Collecting ytsphinx
  Downloading https://files.pythonhosted.org/packages/56/5d/241dc6484c78b90e4fa7e2ae560ca0a273136e2144239de092d64cfb33a6/ytsphinx-1.2.1.dev20200430-py2.py3-none-any.whl
Requirement already satisfied: pyyaml in /usr/local/lib/python3.6/dist-packages (from bagpy) (3.13)
Collecting pycryptodomex
  Downloading https://files.pythonhosted.org/packages/e1/47/d3ead950b09799b4c8816f6c62fbe09991932baadb1a7c372ed8ef0e8fbe/pycryptodomex-3.9.8-cp36-cp36m-manylinux1_x86_64.whl (13.7MB)
     |████████████████████████████████| 13.7MB 254kB/s
Collecting mkdocs
  Downloading https://files.pythonhosted.org/packages/5d/89/ed04b217404bbba031c4e2e084f36ef840b8663fce0b80302b547e651e4d/mkdocs-1.1.2-py3-none-any.whl (6.4MB)
     |████████████████████████████████| 6.4MB 47.4MB/s
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from bagpy) (1.18.5)
Collecting m2r2
  Downloading https://files.pythonhosted.org/packages/b4/b1/b26f53614f1f6efd9ec4729990c49b483983284346e517216b13643b7bcf/m2r2-0.2.5-py3-none-any.whl
Collecting recommonmark
  Downloading https://files.pythonhosted.org/packages/94/de/334aaf73df8c0e77fb07f883d1e274344526196c137ef3479cb5e5aef086/recommonmark-0.6.0-py2.py3-none-any.whl
Collecting sphinx-rtd-theme
  Downloading https://files.pythonhosted.org/packages/c3/86/1addf25a238bbd8466bb099f23d9a9f13494b22b37b44f6c41a778b8730f/sphinx_rtd_theme-0.5.0-py2.py3-none-any.whl (10.8MB)
     |████████████████████████████████| 10.8MB 48.6MB/s
Collecting rospkg
  Downloading https://files.pythonhosted.org/packages/db/f5/055fd15c610452adb1915172365394564ebdf251a764320bcb40d4118df1/rospkg-1.2.8-py3-none-any.whl
Collecting sphinx-bootstrap-theme
  Downloading https://files.pythonhosted.org/packages/a9/b8/ebcd1a7c579eb85929bbfd54617c5c484ba8cd78e4d3499d749e64b5ad3b/sphinx-bootstrap-theme-0.7.1.tar.gz (1.2MB)
     |████████████████████████████████| 1.2MB 41.9MB/s
Collecting sphinx-markdown-parser
  Downloading https://files.pythonhosted.org/packages/7a/0e/63e90ae67eeeb6a5969deeccf0ac0d0c8d3252b9ce2eca7bd0a53aa3a651/sphinx_markdown_parser-0.2.4-py2.py3-none-any.whl
Requirement already satisfied: Sphinx in /usr/local/lib/python3.6/dist-packages (from bagpy) (1.8.5)
Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (2.6.1)
Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (0.8.1)
Requirement already satisfied: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (4.8.0)
Requirement already satisfied: traitlets>=4.2 in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (4.3.3)
Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (4.4.2)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (0.7.5)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (1.0.18)
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.6/dist-packages (from ipython->bagpy) (50.3.0)
Collecting gnupg
  Downloading https://files.pythonhosted.org/packages/96/6c/21f99b450d2f0821ff35343b9a7843b71e98de35192454606435c72991a8/gnupg-2.3.1.tar.gz (100kB)
     |████████████████████████████████| 102kB 11.2MB/s
Requirement already satisfied: Markdown>=3.2 in /usr/local/lib/python3.6/dist-packages (from pymdown-extensions->bagpy) (3.2.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->bagpy) (1.2.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->bagpy) (2.8.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->bagpy) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->bagpy) (2.4.7)
Requirement already satisfied: scipy>=1.0 in /usr/local/lib/python3.6/dist-packages (from seaborn>=0.9.0->bagpy) (1.4.1)
Requirement already satisfied: pandas>=0.23 in /usr/local/lib/python3.6/dist-packages (from seaborn>=0.9.0->bagpy) (1.1.2)
Requirement already satisfied: docutils in /usr/local/lib/python3.6/dist-packages (from rinohtype->bagpy) (0.16)
Collecting rinoh-typeface-texgyrepagella>=0.1.1
  Downloading https://files.pythonhosted.org/packages/84/44/c27695119e6ad918358d44a87f8543cab6240f1f768068dd32ba1b65d92e/rinoh_typeface_texgyrepagella-0.1.1-py3-none-any.whl (321kB)
     |████████████████████████████████| 327kB 48.1MB/s
Collecting rinoh-typeface-texgyrecursor>=0.1.1
  Downloading https://files.pythonhosted.org/packages/12/21/1b46f0a50dfea435f90f29595d2e0b3d3c15a31b35bdde725942c83f2644/rinoh_typeface_texgyrecursor-0.1.1-py3-none-any.whl (242kB)
     |████████████████████████████████| 245kB 50.3MB/s
Collecting rinoh-typeface-dejavuserif
  Downloading https://files.pythonhosted.org/packages/20/24/5c62e77cba623a40022deb8fde932481015c96830616b706f6fe1755f84b/rinoh_typeface_dejavuserif-0.1.1-py3-none-any.whl (1.7MB)
     |████████████████████████████████| 1.7MB 51.0MB/s
Requirement already satisfied: pip in /usr/local/lib/python3.6/dist-packages (from rinohtype->bagpy) (19.3.1)
Collecting rinoh-typeface-texgyreheros>=0.1.1
  Downloading https://files.pythonhosted.org/packages/98/0d/b428d4cf5ad3bd6848b617570d5dcb061b3f66a68b72e96bf2a7909a2300/rinoh_typeface_texgyreheros-0.1.1-py3-none-any.whl (523kB)
     |████████████████████████████████| 532kB 44.1MB/s
Requirement already satisfied: tornado>=5.0 in /usr/local/lib/python3.6/dist-packages (from mkdocs->bagpy) (5.1.1)
Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python3.6/dist-packages (from mkdocs->bagpy) (2.11.2)
Collecting livereload>=2.5.1
  Downloading https://files.pythonhosted.org/packages/bd/60/6640b819e858562ef6684abac60593b7369fe0a8a064df426d3ab0ab894d/livereload-2.6.3.tar.gz
Requirement already satisfied: click>=3.3 in /usr/local/lib/python3.6/dist-packages (from mkdocs->bagpy) (7.1.2)
Collecting lunr[languages]==0.5.8
  Downloading https://files.pythonhosted.org/packages/15/a4/3043c019613a1d60abb6e150b7665761bdd236a0d915d447d21c4415fddd/lunr-0.5.8-py2.py3-none-any.whl (2.3MB)
     |████████████████████████████████| 2.3MB 40.0MB/s
Requirement already satisfied: mistune in /usr/local/lib/python3.6/dist-packages (from m2r2->bagpy) (0.8.4)
Collecting commonmark>=0.8.1
  Downloading https://files.pythonhosted.org/packages/b1/92/dfd892312d822f36c55366118b95d914e5f16de11044a27cf10a7d71bbbf/commonmark-0.9.1-py2.py3-none-any.whl (51kB)
     |████████████████████████████████| 51kB 6.3MB/s
Collecting catkin-pkg
  Downloading https://files.pythonhosted.org/packages/32/36/4e418a15c6b0334503f57ff59ccb11a7a3f99c5937d725846110ae1c752d/catkin_pkg-0.4.23-py3-none-any.whl (74kB)
     |████████████████████████████████| 81kB 10.1MB/s
Collecting distro
  Downloading https://files.pythonhosted.org/packages/25/b7/b3c4270a11414cb22c6352ebc7a83aaa3712043be29daa05018fd5a5c956/distro-1.5.0-py2.py3-none-any.whl
Collecting yapf>=0.28.0
  Downloading https://files.pythonhosted.org/packages/c1/5d/d84677fe852bc5e091739acda444a9b6700ffc6b11a21b00dd244c8caef0/yapf-0.30.0-py2.py3-none-any.whl (190kB)
     |████████████████████████████████| 194kB 52.4MB/s
Collecting unify>=0.5
  Downloading https://files.pythonhosted.org/packages/e9/92/f7ab4a788a3efbf83cddeb0f78595fcddd690ef0f55371a525d0f7c237ad/unify-0.5.tar.gz
Collecting pydash>=4.7.5
  Downloading https://files.pythonhosted.org/packages/05/fc/19b89da8a38a89f4403451a4ed2a05e16f804e6c71e4d5eaedb9d56366c3/pydash-4.8.0-py2.py3-none-any.whl (84kB)
     |████████████████████████████████| 92kB 10.6MB/s
Requirement already satisfied: babel!=2.0,>=1.3 in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (2.8.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (1.15.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (0.7.12)
Requirement already satisfied: imagesize in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (1.2.0)
Requirement already satisfied: sphinxcontrib-websupport in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (1.2.4)
Requirement already satisfied: packaging in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (20.4)
Requirement already satisfied: snowballstemmer>=1.1 in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (2.0.0)
Requirement already satisfied: requests>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from Sphinx->bagpy) (2.23.0)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect; sys_platform != "win32"->ipython->bagpy) (0.6.0)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython->bagpy) (0.2.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython->bagpy) (0.2.5)
Requirement already satisfied: psutil>=1.2.1 in /usr/local/lib/python3.6/dist-packages (from gnupg->py3rosmsgs->bagpy) (5.4.8)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from Markdown>=3.2->pymdown-extensions->bagpy) (2.0.0)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.23->seaborn>=0.9.0->bagpy) (2018.9)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.6/dist-packages (from Jinja2>=2.10.1->mkdocs->bagpy) (1.1.1)
Requirement already satisfied: future>=0.16.0 in /usr/local/lib/python3.6/dist-packages (from lunr[languages]==0.5.8->mkdocs->bagpy) (0.16.0)
Requirement already satisfied: nltk>=3.2.5; python_version > "2.7" and extra == "languages" in /usr/local/lib/python3.6/dist-packages (from lunr[languages]==0.5.8->mkdocs->bagpy) (3.2.5)
Collecting untokenize
  Downloading https://files.pythonhosted.org/packages/f7/46/e7cea8159199096e1df52da20a57a6665da80c37fb8aeb848a3e47442c32/untokenize-0.1.1.tar.gz
Requirement already satisfied: sphinxcontrib-serializinghtml in /usr/local/lib/python3.6/dist-packages (from sphinxcontrib-websupport->Sphinx->bagpy) (1.1.4)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.0.0->Sphinx->bagpy) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests>=2.0.0->Sphinx->bagpy) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests>=2.0.0->Sphinx->bagpy) (2020.6.20)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.0.0->Sphinx->bagpy) (1.24.3)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata; python_version < "3.8"->Markdown>=3.2->pymdown-extensions->bagpy) (3.2.0)
Building wheels for collected packages: bitstring, sphinx-bootstrap-theme, gnupg, livereload, unify, untokenize
  Building wheel for bitstring (setup.py) ... done
  Created wheel for bitstring: filename=bitstring-3.1.7-cp36-none-any.whl size=37949 sha256=a8680bfbba371d9a12102cba0b87b3a67e6147e5405eea163dc37219be2e974e
  Stored in directory: /root/.cache/pip/wheels/b8/27/f0/8373e26b7de57db03dc18aaaebdd8c26a99da882416f762979
  Building wheel for sphinx-bootstrap-theme (setup.py) ... done
  Created wheel for sphinx-bootstrap-theme: filename=sphinx_bootstrap_theme-0.7.1-cp36-none-any.whl size=1250224 sha256=e49c5ce30f8e5a9ca0faf97c8601a1b418c390faf29947352f5d1f6532df010d
  Stored in directory: /root/.cache/pip/wheels/71/28/10/e04d1ab1110dbde7f436dd159ed5ee35113f66536df6d99a79
  Building wheel for gnupg (setup.py) ... done
  Created wheel for gnupg: filename=gnupg-2.3.1-cp36-none-any.whl size=94608 sha256=9c4bd3b286963aba7c859b2603e027739290641d5c5cbbf8a9f382d20c02fd24
  Stored in directory: /root/.cache/pip/wheels/a8/7c/24/75dde86fabe7aa24e6e8146f20eccb2579c09ca6ad611a2630
  Building wheel for livereload (setup.py) ... done
  Created wheel for livereload: filename=livereload-2.6.3-py2.py3-none-any.whl size=24713 sha256=06a3770b212d2911f5875a313f1eb73f7dec4b75f9b2294fbd710a3fb6a9639a
  Stored in directory: /root/.cache/pip/wheels/f2/a1/fa/00775311351a48f78b4a0e40588eefdd6f2731cc8115d6957d
  Building wheel for unify (setup.py) ... done
  Created wheel for unify: filename=unify-0.5-cp36-none-any.whl size=5234 sha256=f977a71f1dd3340580394d282478e6b3fa10181f6f45fc6c88dff5e49fea31a9
  Stored in directory: /root/.cache/pip/wheels/27/fd/56/87cba898ae96b3fb66294877b91288441bac0e39d030a01942
  Building wheel for untokenize (setup.py) ... done
  Created wheel for untokenize: filename=untokenize-0.1.1-cp36-none-any.whl size=2898 sha256=9950c561b85c76e7473d6d0568653cec04628b9fe26020dc19ce520d29266621
  Stored in directory: /root/.cache/pip/wheels/f4/a0/63/012f35213063bcd1d92a1bb5f4a570fec73e2a0a335a9a7295
Successfully built bitstring sphinx-bootstrap-theme gnupg livereload unify untokenize
ERROR: sphinx-autodoc-typehints 1.11.0 has requirement Sphinx>=3.0, but you'll have sphinx 1.8.5 which is incompatible.
ERROR: sphinx-markdown-parser 0.2.4 has requirement pyyaml>=5.1.2, but you'll have pyyaml 3.13 which is incompatible.
ERROR: sphinx-markdown-parser 0.2.4 has requirement sphinx>=2.2.0, but you'll have sphinx 1.8.5 which is incompatible.
Installing collected packages: bitstring, pyserial, gnupg, py3rosmsgs, pymdown-extensions, sphinx-autodoc-typehints, rinoh-typeface-texgyrepagella, rinoh-typeface-texgyrecursor, rinoh-typeface-dejavuserif, commonmark, recommonmark, rinoh-typeface-texgyreheros, rinohtype, ytsphinx, pycryptodomex, livereload, lunr, mkdocs, m2r2, sphinx-rtd-theme, catkin-pkg, distro, rospkg, sphinx-bootstrap-theme, yapf, untokenize, unify, pydash, sphinx-markdown-parser, bagpy
Successfully installed bagpy-0.4 bitstring-3.1.7 catkin-pkg-0.4.23 commonmark-0.9.1 distro-1.5.0 gnupg-2.3.1 livereload-2.6.3 lunr-0.5.8 m2r2-0.2.5 mkdocs-1.1.2 py3rosmsgs-1.16 pycryptodomex-3.9.8 pydash-4.8.0 pymdown-extensions-8.0.1 pyserial-3.4 recommonmark-0.6.0 rinoh-typeface-dejavuserif-0.1.1 rinoh-typeface-texgyrecursor-0.1.1 rinoh-typeface-texgyreheros-0.1.1 rinoh-typeface-texgyrepagella-0.1.1 rinohtype-0.4.2 rospkg-1.2.8 sphinx-autodoc-typehints-1.11.0 sphinx-bootstrap-theme-0.7.1 sphinx-markdown-parser-0.2.4 sphinx-rtd-theme-0.5.0 unify-0.5 untokenize-0.1.1 yapf-0.30.0 ytsphinx-1.2.1.dev20200430
[2]:
import bagpy
from bagpy import bagreader
import pandas as pd
import seaborn as sea
import matplotlib.pyplot as plt
import numpy as np
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.

Get the sample bag files

[3]:
!wget https://data.ouster.io/sample-data-1.13/OS1-64/OS1-64_city1.bag
--2020-10-12 20:43:01--  https://data.ouster.io/sample-data-1.13/OS1-64/OS1-64_city1.bag
Resolving data.ouster.io (data.ouster.io)... 172.67.72.60, 104.26.15.246, 104.26.14.246, ...
Connecting to data.ouster.io (data.ouster.io)|172.67.72.60|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4758061988 (4.4G) [application/octet-stream]
Saving to: ‘OS1-64_city1.bag’

OS1-64_city1.bag    100%[===================>]   4.43G  46.1MB/s    in 60s

2020-10-12 20:44:02 (75.2 MB/s) - ‘OS1-64_city1.bag’ saved [4758061988/4758061988]

Read the bag file

[4]:
b = bagreader('OS1-64_city1.bag')
[INFO]  Successfully created the data folder OS1-64_city1.

Check available topics

[5]:
b.topic_table
[5]:
Topics Types Message Count Frequency
0 /os1_cloud_node/imu sensor_msgs/Imu 5999 100.203163
1 /os1_cloud_node/points sensor_msgs/PointCloud2 601 9.989316
2 /os1_node/imu_packets ouster_ros/PacketMsg 5999 100.111083
3 /os1_node/lidar_packets ouster_ros/PacketMsg 76805 21076.904523
4 /rosout rosgraph_msgs/Log 2 44.002350
5 /rosout_agg rosgraph_msgs/Log 2 44.107390

Decode messages on every topic

[7]:
data = b.message_by_topic('/os1_cloud_node/imu')
print("File saved: {}".format(data))
File saved: OS1-64_city1/os1_cloud_node-imu.csv

Read the data in pandas DataFrame

[9]:
df_imu = pd.read_csv(data)
df_imu
[9]:
Time header.seq header.stamp.secs header.stamp.nsecs header.frame_id orientation.x orientation.y orientation.z orientation.w orientation_covariance_0 orientation_covariance_1 orientation_covariance_2 orientation_covariance_3 orientation_covariance_4 orientation_covariance_5 orientation_covariance_6 orientation_covariance_7 orientation_covariance_8 angular_velocity.x angular_velocity.y angular_velocity.z angular_velocity_covariance_0 angular_velocity_covariance_1 angular_velocity_covariance_2 angular_velocity_covariance_3 angular_velocity_covariance_4 angular_velocity_covariance_5 angular_velocity_covariance_6 angular_velocity_covariance_7 angular_velocity_covariance_8 linear_acceleration.x linear_acceleration.y linear_acceleration.z linear_acceleration_covariance_0 linear_acceleration_covariance_1 linear_acceleration_covariance_2 linear_acceleration_covariance_3 linear_acceleration_covariance_4 linear_acceleration_covariance_5 linear_acceleration_covariance_6 linear_acceleration_covariance_7 linear_acceleration_covariance_8
0 1.573857e+09 58468 674 304318020 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.009987 -0.004527 0.019574 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.237026 1.115698 8.379706 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
1 1.573857e+09 58469 674 314318050 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.008655 -0.012650 0.018376 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.423774 1.189918 8.793903 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
2 1.573857e+09 58470 674 324318430 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.009321 -0.020906 0.012117 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.325611 1.113304 8.585607 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
3 1.573857e+09 58471 674 334318030 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.005593 -0.009055 0.013049 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.117316 1.185130 8.384494 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
4 1.573857e+09 58472 674 344318430 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.007191 0.004128 0.017044 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 0.011971 1.312023 8.834604 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
5994 1.573857e+09 64462 734 244317440 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -0.007457 0.011185 0.007989 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.972046 1.082179 8.556877 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
5995 1.573857e+09 64463 734 254317500 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -0.003462 0.002663 0.012916 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.828394 1.177947 8.401254 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
5996 1.573857e+09 64464 734 264317830 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -0.001598 -0.013183 0.013715 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.746991 1.187524 8.501810 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
5997 1.573857e+09 64465 734 274317440 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.001065 -0.007989 0.012916 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.620098 1.067814 8.482656 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01
5998 1.573857e+09 64466 734 284317440 /os1_imu 0.0 0.0 0.0 0.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -0.004128 0.002264 0.008655 0.0006 0.0 0.0 0.0 0.0006 0.0 0.0 0.0 0.0006 -0.766145 1.221043 8.633491 0.01 0.0 0.0 0.0 0.01 0.0 0.0 0.0 0.01

5999 rows × 42 columns

Plot

[11]:
fig, ax = bagpy.create_fig(10)
ax[0].scatter(x = 'Time', y = 'orientation.x', data  = df_imu, s= 1, label = 'orientation.x')
ax[1].scatter(x = 'Time', y = 'orientation.y', data  = df_imu, s= 1, label ='orientation.y')
ax[2].scatter(x = 'Time', y = 'orientation.z', data  = df_imu, s= 1, label = 'orientation.z')
ax[3].scatter(x = 'Time', y = 'orientation.w', data  = df_imu, s= 1, label ='orientation.w')
ax[4].scatter(x = 'Time', y = 'angular_velocity.x', data  = df_imu, s= 1, label = 'angular_velocity.x')
ax[5].scatter(x = 'Time', y = 'angular_velocity.y', data  = df_imu, s= 1, label = 'angular_velocity.y')
ax[6].scatter(x = 'Time', y = 'angular_velocity.z', data  = df_imu, s= 1, label = 'angular_velocity.z')
ax[7].scatter(x = 'Time', y = 'linear_acceleration.x', data  = df_imu, s= 1, label = 'linear_acceleration.x')
ax[8].scatter(x = 'Time', y = 'linear_acceleration.y', data  = df_imu, s= 1, label = 'linear_acceleration.y')
ax[9].scatter(x = 'Time', y = 'linear_acceleration.z', data  = df_imu, s= 1, label = 'linear_acceleration.z')
for axis in ax:
    axis.legend()
    axis.set_xlabel('Time')

plt.show()
_images/Reading_bagfiles_from_cloud_15_0.png
[12]:
data = b.message_by_topic('/rosout_agg')
df_rosout = pd.read_csv(data)
df_rosout
[12]:
Time header.seq header.stamp.secs header.stamp.nsecs header.frame_id level name msg file function line topics
0 1.573857e+09 11 1573857271 484865238 NaN 2 /record_1573856971468545184 Closing drive1-os1-64_2019-11-15-14-33-31_4.bag. /tmp/binarydeb/ros-melodic-rosbag-1.14.3/src/r... Recorder::stopWriting 398 []
1 1.573857e+09 12 1573857271 508070115 NaN 2 /record_1573856971468545184 Recording to drive1-os1-64_2019-11-15-14-34-31... /tmp/binarydeb/ros-melodic-rosbag-1.14.3/src/r... Recorder::startWriting 394 []
[ ]: