# importRosbag
Import rosbag data - pure python - standalone - no ROS installation required.
The importRosbag function imports a .rosbag file. Use the 'filePathOrName'
parameter to supply the path. e.g.
```
from importRosbag.importRosbag import importRosbag
topics = importRosbag(filePathOrName='path/to/data.bag')
```
A rosbag consists of a set of topics, each of which has a set of messages.
A topic has a name, which was defined by the creator, and a message type, which
is standard and defines the content of each message.
This function uses the topic types to interpret the messages from each topic,
yielding one dict for each topic. Each of these dicts contains an iterable for
each data field.
By default this function unpacks all topics for which it has a message type
definition, but you can use one of the following keyword params to limit which
topics are intepretted:
* 'listTopics' = True - no unpacking - just returns a list of the topics contained in the file and their associated types - use this to quickly inspect the contents of a bag;
* 'importTopics' = <list of strings> - only imports the listed topics;
* 'importTypes' = <list of strings> - only imports the listed types.
Example usage:
```
# Import everything
topics = importRosbag(filePathOrName='path/to/data.bag')
# Or just list the topics in the bag
topics = importRosbag(filePathOrName='path/to/data.bag', listTopics=True)
# Or just import one particular topic
importTopics = ['/dvs/camera_info']
topics = importRosbag(filePathOrName='path/to/data.bag', importTopics=importTopics)
# Or just import two particular types - Note that slash and underscore are interchangable
importTypes = ['esim_msgs_OpticFlow', 'geometry_msgs/PoseStamped']
topics = importRosbag(filePathOrName='path/to/data.bag', importTypes=importTypes)
```
Message types supported are a selection of standard message types, plus a couple
related to event-based sensors:
Standard:
* geometry_msgs/PoseStamped
* geometry_msgs/Transform
* geometry_msgs/TransformStamped
* geometry_msgs/TwistStamped
* sensor_msgs/CameraInfo
* sensor_msgs/Image
* sensor_msgs/Imu
* sensor_msgs/PointCloud2
* tf/tfMessage
Specialised:
* dvs_msgs/EventArray
* esim_msgs/OpticFlow
The method of importation is honed to the particular needs of the author,
sometimes ignoring certain fields, grouping data in particular ways etc.
For example, from the CameraInfo message type we import only a single message
because we're not currently interested in autocalibration or its results.
However this code should serve as a model for anyone who wishes to import rosbags.
Although it's possible to import messages programmatically given only the message
definition files, we have chosen not to do this, because if we did it we would
anyway want to take the resulting data and pick out the bits we wanted.
Timestamps: We convert timestamps to 64-bit floats. This won't work for you if you
care about sub-microsecond precision, for any timestamps encoded as unix time.
Quaternions: Attention! If you import any of the types which encode rotations as
quaternions, e.g. PoseStamped/Transform/TransformStamped/tfMessage: we import
quaternions in the form w,x,y,z, which is the convention in certain software,
like blender; however, in the rosbag, the native form is x,y,z,w.
Dependencies:
* numpy
* tqdm
Raw data
{
"_id": null,
"home_page": "https://github.com/event-driven-robotics/importRosbag",
"name": "importRosbag",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ros,rosbag,bag,rpg,dvs,rpg_dvs_ros,event,event camera,event-based,event-driven,dynamic vision sensor,neuromorphic,aer,address-event representationspiking neural network,davis,atis,celex",
"author": "Sim Bamford",
"author_email": "simbamford@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d6/9b/fd50cf899b702e7f75e424bc06ff51945cae79f0cdd80faad8d7ba5f4b39/importRosbag-1.0.4.tar.gz",
"platform": null,
"description": "# importRosbag\nImport rosbag data - pure python - standalone - no ROS installation required.\n\nThe importRosbag function imports a .rosbag file. Use the 'filePathOrName' \nparameter to supply the path. e.g. \n\n```\nfrom importRosbag.importRosbag import importRosbag\n\ntopics = importRosbag(filePathOrName='path/to/data.bag')\n```\n\nA rosbag consists of a set of topics, each of which has a set of messages.\nA topic has a name, which was defined by the creator, and a message type, which\nis standard and defines the content of each message. \nThis function uses the topic types to interpret the messages from each topic, \nyielding one dict for each topic. Each of these dicts contains an iterable for \neach data field.\n\nBy default this function unpacks all topics for which it has a message type \ndefinition, but you can use one of the following keyword params to limit which \ntopics are intepretted:\n\n* 'listTopics' = True - no unpacking - just returns a list of the topics contained in the file and their associated types - use this to quickly inspect the contents of a bag;\n* 'importTopics' = <list of strings> - only imports the listed topics;\n* 'importTypes' = <list of strings> - only imports the listed types.\n\nExample usage:\n\n```\n# Import everything\ntopics = importRosbag(filePathOrName='path/to/data.bag')\n\n# Or just list the topics in the bag\ntopics = importRosbag(filePathOrName='path/to/data.bag', listTopics=True)\n\n# Or just import one particular topic\nimportTopics = ['/dvs/camera_info']\ntopics = importRosbag(filePathOrName='path/to/data.bag', importTopics=importTopics)\n\n# Or just import two particular types - Note that slash and underscore are interchangable\nimportTypes = ['esim_msgs_OpticFlow', 'geometry_msgs/PoseStamped']\ntopics = importRosbag(filePathOrName='path/to/data.bag', importTypes=importTypes)\n```\n\nMessage types supported are a selection of standard message types, plus a couple \nrelated to event-based sensors:\n\nStandard:\n\n* geometry_msgs/PoseStamped\n* geometry_msgs/Transform\n* geometry_msgs/TransformStamped\n* geometry_msgs/TwistStamped\n* sensor_msgs/CameraInfo\n* sensor_msgs/Image\n* sensor_msgs/Imu\n* sensor_msgs/PointCloud2\n* tf/tfMessage\n\nSpecialised:\n\n* dvs_msgs/EventArray\n* esim_msgs/OpticFlow\n\nThe method of importation is honed to the particular needs of the author, \nsometimes ignoring certain fields, grouping data in particular ways etc. \nFor example, from the CameraInfo message type we import only a single message \nbecause we're not currently interested in autocalibration or its results.\nHowever this code should serve as a model for anyone who wishes to import rosbags.\nAlthough it's possible to import messages programmatically given only the message \ndefinition files, we have chosen not to do this, because if we did it we would \nanyway want to take the resulting data and pick out the bits we wanted. \n\nTimestamps: We convert timestamps to 64-bit floats. This won't work for you if you \ncare about sub-microsecond precision, for any timestamps encoded as unix time. \n\nQuaternions: Attention! If you import any of the types which encode rotations as\nquaternions, e.g. PoseStamped/Transform/TransformStamped/tfMessage: we import \nquaternions in the form w,x,y,z, which is the convention in certain software, \nlike blender; however, in the rosbag, the native form is x,y,z,w. \n\n\nDependencies:\n\n* numpy\n* tqdm\n\n",
"bugtrack_url": null,
"license": "gpl",
"summary": "Standalone rosbag loader for python3",
"version": "1.0.4",
"project_urls": {
"Download": "https://github.com/event-driven-robotics/importRosbag/archive/v1.0.tar.gz",
"Homepage": "https://github.com/event-driven-robotics/importRosbag"
},
"split_keywords": [
"ros",
"rosbag",
"bag",
"rpg",
"dvs",
"rpg_dvs_ros",
"event",
"event camera",
"event-based",
"event-driven",
"dynamic vision sensor",
"neuromorphic",
"aer",
"address-event representationspiking neural network",
"davis",
"atis",
"celex"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c4ce04f383b0e250846ab1702caf1d71e6291b56351f98244a78862d072fc4a6",
"md5": "6b5b317c96cf02a0a211fc93b798bb12",
"sha256": "843db058e85d23ef7376ea47490bf453cd8b31ea880b24edf2408f2ff4e2eb51"
},
"downloads": -1,
"filename": "importRosbag-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b5b317c96cf02a0a211fc93b798bb12",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 28577,
"upload_time": "2023-09-03T08:29:07",
"upload_time_iso_8601": "2023-09-03T08:29:07.689060Z",
"url": "https://files.pythonhosted.org/packages/c4/ce/04f383b0e250846ab1702caf1d71e6291b56351f98244a78862d072fc4a6/importRosbag-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d69bfd50cf899b702e7f75e424bc06ff51945cae79f0cdd80faad8d7ba5f4b39",
"md5": "7b71b6fd4fcc725caeec325dfb35974f",
"sha256": "8f09a153a14cfa563810d6b5c3f26153c9320f81f0d82a6671bf8b5cd49350aa"
},
"downloads": -1,
"filename": "importRosbag-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "7b71b6fd4fcc725caeec325dfb35974f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13197,
"upload_time": "2023-09-03T08:29:09",
"upload_time_iso_8601": "2023-09-03T08:29:09.540926Z",
"url": "https://files.pythonhosted.org/packages/d6/9b/fd50cf899b702e7f75e424bc06ff51945cae79f0cdd80faad8d7ba5f4b39/importRosbag-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-03 08:29:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "event-driven-robotics",
"github_project": "importRosbag",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "importrosbag"
}