{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rosbag2/pulls/comments/220847548","pull_request_review_id":159349877,"id":220847548,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDg0NzU0OA==","diff_hunk":"@@ -0,0 +1,134 @@\n+// Copyright 2018 Open Source Robotics Foundation, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#include <Python.h>\n+#include <string>\n+#include <vector>\n+\n+#include \"rosbag2_transport/rosbag2_transport.hpp\"\n+#include \"rosbag2_transport/record_options.hpp\"\n+#include \"rosbag2_transport/storage_options.hpp\"\n+\n+static PyObject *\n+rosbag2_transport_record(PyObject * Py_UNUSED(self), PyObject * args, PyObject * kwargs)\n+{\n+  rosbag2_transport::StorageOptions storage_options{};\n+  rosbag2_transport::RecordOptions record_options{};\n+\n+  static const char * kwlist[] = {\"uri\", \"storage_id\", \"all\", \"topics\", nullptr};\n+\n+  char * uri = nullptr;\n+  char * storage_id = nullptr;\n+  bool all = false;\n+  PyObject * topics = nullptr;\n+  if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"ss|bO\", const_cast<char **>(kwlist),\n+    &uri,\n+    &storage_id,\n+    &all,\n+    &topics))\n+  {\n+    return nullptr;\n+  }\n+\n+  storage_options.uri = std::string(uri);\n+  storage_options.storage_id = std::string(storage_id);\n+  record_options.all = all;\n+\n+  if (topics) {\n+    PyObject * topic_iterator = PyObject_GetIter(topics);\n+    if (topic_iterator != nullptr) {\n+      PyObject * topic;\n+      while ((topic = PyIter_Next(topic_iterator))) {\n+        record_options.topics.emplace_back(PyUnicode_AsUTF8(topic));\n+\n+        Py_DECREF(topic);\n+      }\n+      Py_DECREF(topic_iterator);\n+    }\n+  }\n+\n+  rosbag2_transport::Rosbag2Transport transport;\n+  transport.init();\n+  transport.record(storage_options, record_options);\n+  transport.shutdown();\n+\n+  Py_RETURN_NONE;\n+}\n+\n+static PyObject *\n+rosbag2_transport_play(PyObject * Py_UNUSED(self), PyObject * args, PyObject * kwargs)\n+{\n+  rosbag2_transport::PlayOptions play_options{};\n+  rosbag2_transport::StorageOptions storage_options{};\n+\n+  static const char * kwlist[] = {\"uri\", \"storage_id\", \"read_ahead_queue_size\", nullptr};\n+\n+  char * uri;\n+  char * storage_id;\n+  size_t read_ahead_queue_size;\n+  if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"ss|k\", const_cast<char **>(kwlist),","path":"rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp","position":80,"original_position":80,"commit_id":"8d4b0c7861d339d14fc8fcfc47f1f0b83d352d5f","original_commit_id":"8d4b0c7861d339d14fc8fcfc47f1f0b83d352d5f","user":{"login":"anhosi","id":29598664,"node_id":"MDQ6VXNlcjI5NTk4NjY0","avatar_url":"https://avatars3.githubusercontent.com/u/29598664?v=4","gravatar_id":"","url":"https://api.github.com/users/anhosi","html_url":"https://github.com/anhosi","followers_url":"https://api.github.com/users/anhosi/followers","following_url":"https://api.github.com/users/anhosi/following{/other_user}","gists_url":"https://api.github.com/users/anhosi/gists{/gist_id}","starred_url":"https://api.github.com/users/anhosi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anhosi/subscriptions","organizations_url":"https://api.github.com/users/anhosi/orgs","repos_url":"https://api.github.com/users/anhosi/repos","events_url":"https://api.github.com/users/anhosi/events{/privacy}","received_events_url":"https://api.github.com/users/anhosi/received_events","type":"User","site_admin":false},"body":"Only for non-optional keywords. Anything behind the `|` is optional. So the check below is necessary. It will return `false` if the mandatory arguments `uri` and `storage_id` are missing.","created_at":"2018-09-27T09:08:35Z","updated_at":"2018-09-27T09:08:35Z","html_url":"https://github.com/ros2/rosbag2/pull/38#discussion_r220847548","pull_request_url":"https://api.github.com/repos/ros2/rosbag2/pulls/38","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/comments/220847548"},"html":{"href":"https://github.com/ros2/rosbag2/pull/38#discussion_r220847548"},"pull_request":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/38"}},"in_reply_to_id":220836280},"pull_request":{"url":"https://api.github.com/repos/ros2/rosbag2/pulls/38","id":217015091,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MDE1MDkx","html_url":"https://github.com/ros2/rosbag2/pull/38","diff_url":"https://github.com/ros2/rosbag2/pull/38.diff","patch_url":"https://github.com/ros2/rosbag2/pull/38.patch","issue_url":"https://api.github.com/repos/ros2/rosbag2/issues/38","number":38,"state":"open","locked":false,"title":"Introduce rosbag2_transport layer and CLI","user":{"login":"Martin-Idel-SI","id":31658331,"node_id":"MDQ6VXNlcjMxNjU4MzMx","avatar_url":"https://avatars2.githubusercontent.com/u/31658331?v=4","gravatar_id":"","url":"https://api.github.com/users/Martin-Idel-SI","html_url":"https://github.com/Martin-Idel-SI","followers_url":"https://api.github.com/users/Martin-Idel-SI/followers","following_url":"https://api.github.com/users/Martin-Idel-SI/following{/other_user}","gists_url":"https://api.github.com/users/Martin-Idel-SI/gists{/gist_id}","starred_url":"https://api.github.com/users/Martin-Idel-SI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martin-Idel-SI/subscriptions","organizations_url":"https://api.github.com/users/Martin-Idel-SI/orgs","repos_url":"https://api.github.com/users/Martin-Idel-SI/repos","events_url":"https://api.github.com/users/Martin-Idel-SI/events{/privacy}","received_events_url":"https://api.github.com/users/Martin-Idel-SI/received_events","type":"User","site_admin":false},"body":"This PR does a number of things:\r\n\r\n- Introduce `rosbag2_transport` to make `rosbag2` independent of any subscription/publishing code and therefore `rclcpp` or `rcl`\r\n- Make `rosbag2` a thin wrapper around `rosbag2_storage` (for now). Later on, `rosbag2` can be used by other tooling\r\n- Introduce first CLI versions: `ros2 bag play <filename>` and `ros2 bag record <topic names>` as well as `ros2 bag record --all`. The two verbs and the given options are fully functional.\r\n\r\nThis PR improves testing:\r\n- Added a new package `rosbag2_tests` containing e2e-testing: We start `ros2 bag record/play` commands in separate processes\r\n- Make tests in `rosbag2_transport` not rely on particular storage, which decreases dependencies\r\n- Conform to naming conventions: All tests start with `test`, all other files don't.\r\n\r\nThis PR should also improve test stability to basically as much as we can\r\n- We always start any publishers or subscribers before the real test starts to make discovery easier\r\n- We start publishers and subscribers single threaded, we only ever use another thread for spinning\r\n- Any test failures which we have now seen (very rare as in <1% of all runs) must be related to discovery being too slow. There is nothing much we can do about it instead of wait longer.\r\n\r\n**To discuss:**\r\nThere are a few duplicate files in testing (they are named the same to make it easy to spot). How should we go about this problem?\r\n- Should we create additional testing libraries in each package which provides headers/objects which are potentially interesting in other tests?\r\n- Or should we create another package `rosbag2_test_commons` which all packages might depend on as a pure testing dependency?","created_at":"2018-09-20T15:28:50Z","updated_at":"2018-09-27T09:08:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45bc4624bb6ef8d21e67394d0bb078c3955f6602","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1009719493,"node_id":"MDU6TGFiZWwxMDA5NzE5NDkz","url":"https://api.github.com/repos/ros2/rosbag2/labels/in%20review","name":"in review","color":"388be2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rosbag2/pulls/38/commits","review_comments_url":"https://api.github.com/repos/ros2/rosbag2/pulls/38/comments","review_comment_url":"https://api.github.com/repos/ros2/rosbag2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rosbag2/issues/38/comments","statuses_url":"https://api.github.com/repos/ros2/rosbag2/statuses/8d4b0c7861d339d14fc8fcfc47f1f0b83d352d5f","head":{"label":"bsinno:rosbag2_transport","ref":"rosbag2_transport","sha":"8d4b0c7861d339d14fc8fcfc47f1f0b83d352d5f","user":{"login":"bsinno","id":9215699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyMTU2OTk=","avatar_url":"https://avatars3.githubusercontent.com/u/9215699?v=4","gravatar_id":"","url":"https://api.github.com/users/bsinno","html_url":"https://github.com/bsinno","followers_url":"https://api.github.com/users/bsinno/followers","following_url":"https://api.github.com/users/bsinno/following{/other_user}","gists_url":"https://api.github.com/users/bsinno/gists{/gist_id}","starred_url":"https://api.github.com/users/bsinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsinno/subscriptions","organizations_url":"https://api.github.com/users/bsinno/orgs","repos_url":"https://api.github.com/users/bsinno/repos","events_url":"https://api.github.com/users/bsinno/events{/privacy}","received_events_url":"https://api.github.com/users/bsinno/received_events","type":"Organization","site_admin":false},"repo":{"id":128929461,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg5Mjk0NjE=","name":"rosbag2","full_name":"bsinno/rosbag2","private":false,"owner":{"login":"bsinno","id":9215699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkyMTU2OTk=","avatar_url":"https://avatars3.githubusercontent.com/u/9215699?v=4","gravatar_id":"","url":"https://api.github.com/users/bsinno","html_url":"https://github.com/bsinno","followers_url":"https://api.github.com/users/bsinno/followers","following_url":"https://api.github.com/users/bsinno/following{/other_user}","gists_url":"https://api.github.com/users/bsinno/gists{/gist_id}","starred_url":"https://api.github.com/users/bsinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsinno/subscriptions","organizations_url":"https://api.github.com/users/bsinno/orgs","repos_url":"https://api.github.com/users/bsinno/repos","events_url":"https://api.github.com/users/bsinno/events{/privacy}","received_events_url":"https://api.github.com/users/bsinno/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bsinno/rosbag2","description":null,"fork":true,"url":"https://api.github.com/repos/bsinno/rosbag2","forks_url":"https://api.github.com/repos/bsinno/rosbag2/forks","keys_url":"https://api.github.com/repos/bsinno/rosbag2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsinno/rosbag2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsinno/rosbag2/teams","hooks_url":"https://api.github.com/repos/bsinno/rosbag2/hooks","issue_events_url":"https://api.github.com/repos/bsinno/rosbag2/issues/events{/number}","events_url":"https://api.github.com/repos/bsinno/rosbag2/events","assignees_url":"https://api.github.com/repos/bsinno/rosbag2/assignees{/user}","branches_url":"https://api.github.com/repos/bsinno/rosbag2/branches{/branch}","tags_url":"https://api.github.com/repos/bsinno/rosbag2/tags","blobs_url":"https://api.github.com/repos/bsinno/rosbag2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsinno/rosbag2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsinno/rosbag2/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsinno/rosbag2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsinno/rosbag2/statuses/{sha}","languages_url":"https://api.github.com/repos/bsinno/rosbag2/languages","stargazers_url":"https://api.github.com/repos/bsinno/rosbag2/stargazers","contributors_url":"https://api.github.com/repos/bsinno/rosbag2/contributors","subscribers_url":"https://api.github.com/repos/bsinno/rosbag2/subscribers","subscription_url":"https://api.github.com/repos/bsinno/rosbag2/subscription","commits_url":"https://api.github.com/repos/bsinno/rosbag2/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsinno/rosbag2/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsinno/rosbag2/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsinno/rosbag2/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsinno/rosbag2/contents/{+path}","compare_url":"https://api.github.com/repos/bsinno/rosbag2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsinno/rosbag2/merges","archive_url":"https://api.github.com/repos/bsinno/rosbag2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsinno/rosbag2/downloads","issues_url":"https://api.github.com/repos/bsinno/rosbag2/issues{/number}","pulls_url":"https://api.github.com/repos/bsinno/rosbag2/pulls{/number}","milestones_url":"https://api.github.com/repos/bsinno/rosbag2/milestones{/number}","notifications_url":"https://api.github.com/repos/bsinno/rosbag2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsinno/rosbag2/labels{/name}","releases_url":"https://api.github.com/repos/bsinno/rosbag2/releases{/id}","deployments_url":"https://api.github.com/repos/bsinno/rosbag2/deployments","created_at":"2018-04-10T12:31:03Z","updated_at":"2018-09-20T02:13:26Z","pushed_at":"2018-09-26T15:32:51Z","git_url":"git://github.com/bsinno/rosbag2.git","ssh_url":"git@github.com:bsinno/rosbag2.git","clone_url":"https://github.com/bsinno/rosbag2.git","svn_url":"https://github.com/bsinno/rosbag2","homepage":null,"size":345,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"bc822f134ef6dfc90628111ca5445fd5243471c4","user":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":127306752,"node_id":"MDEwOlJlcG9zaXRvcnkxMjczMDY3NTI=","name":"rosbag2","full_name":"ros2/rosbag2","private":false,"owner":{"login":"ros2","id":3979232,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5NzkyMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/3979232?v=4","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ros2/rosbag2","description":null,"fork":false,"url":"https://api.github.com/repos/ros2/rosbag2","forks_url":"https://api.github.com/repos/ros2/rosbag2/forks","keys_url":"https://api.github.com/repos/ros2/rosbag2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rosbag2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rosbag2/teams","hooks_url":"https://api.github.com/repos/ros2/rosbag2/hooks","issue_events_url":"https://api.github.com/repos/ros2/rosbag2/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rosbag2/events","assignees_url":"https://api.github.com/repos/ros2/rosbag2/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rosbag2/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rosbag2/tags","blobs_url":"https://api.github.com/repos/ros2/rosbag2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rosbag2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rosbag2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rosbag2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rosbag2/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rosbag2/languages","stargazers_url":"https://api.github.com/repos/ros2/rosbag2/stargazers","contributors_url":"https://api.github.com/repos/ros2/rosbag2/contributors","subscribers_url":"https://api.github.com/repos/ros2/rosbag2/subscribers","subscription_url":"https://api.github.com/repos/ros2/rosbag2/subscription","commits_url":"https://api.github.com/repos/ros2/rosbag2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rosbag2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rosbag2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rosbag2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rosbag2/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rosbag2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rosbag2/merges","archive_url":"https://api.github.com/repos/ros2/rosbag2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rosbag2/downloads","issues_url":"https://api.github.com/repos/ros2/rosbag2/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rosbag2/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rosbag2/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rosbag2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rosbag2/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rosbag2/releases{/id}","deployments_url":"https://api.github.com/repos/ros2/rosbag2/deployments","created_at":"2018-03-29T14:54:57Z","updated_at":"2018-09-20T01:41:11Z","pushed_at":"2018-09-26T15:32:53Z","git_url":"git://github.com/ros2/rosbag2.git","ssh_url":"git@github.com:ros2/rosbag2.git","clone_url":"https://github.com/ros2/rosbag2.git","svn_url":"https://github.com/ros2/rosbag2","homepage":null,"size":178,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":20,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/38"},"html":{"href":"https://github.com/ros2/rosbag2/pull/38"},"issue":{"href":"https://api.github.com/repos/ros2/rosbag2/issues/38"},"comments":{"href":"https://api.github.com/repos/ros2/rosbag2/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rosbag2/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rosbag2/statuses/8d4b0c7861d339d14fc8fcfc47f1f0b83d352d5f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"anhosi"}}