-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple bag player examples #1580
Conversation
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
This reverts commit 24f9565. Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
1f986a6
to
6b276b1
Compare
Signed-off-by: Sangtaek Lee <[email protected]>
Hi @MichaelOrlov, I think I screwed up with reviewers. Do you mind fixing it and reviewing this PR ? |
rosbag2_examples/rosbag2_examples_cpp/src/simple_bag_player.cpp
Outdated
Show resolved
Hide resolved
rosbag2_examples/rosbag2_examples_cpp/src/simple_bag_player.cpp
Outdated
Show resolved
Hide resolved
rosbag2_examples/rosbag2_examples_cpp/src/simple_bag_player.cpp
Outdated
Show resolved
Hide resolved
rosbag2_examples/rosbag2_examples_py/rosbag2_examples_py/simple_bag_player.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Sangtaek Lee <[email protected]>
@sangteak601 @fujitatomoya I am curious how this PR overlaps with the existing tutorial and examples from https://docs.ros.org/en/rolling/Tutorials/Advanced/Reading-From-A-Bag-File-CPP.html ? |
that is what i found too. i was thinking that https://docs.ros.org/en/rolling/Tutorials/Advanced/Reading-From-A-Bag-File-CPP.html can also be updated to point the source code from this example. |
I would prefer to make them aligned as much as possible but in the tutorial preferable to have the full text with source code instead of just a link on it. Also, I think that in the examples still unclear point that if the message always shall be deserialized or not before publishing. cc: @sangteak601 |
@MichaelOrlov Thanks for the review. I will make a modification. Based on my knowledge(correct me if I'm wrong), we can also receive serialized messages directly. Therefore, perhaps we can modify the recorder example in a similar manner? |
Signed-off-by: Sangtaek Lee <[email protected]>
7da7fed
to
1f53c6a
Compare
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
@fujitatomoya @MichaelOrlov I have addressed issues. Do you mind taking another look? |
Signed-off-by: Sangtaek Lee <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm, but i have a few comments.
besides,
I would prefer to make them aligned as much as possible but in the tutorial preferable to have the full text with source code instead of just a link on it.
i do agree with this. we need to update https://github.com/ros2/ros2_documentation accordingly to align with these samples.
rosbag2_examples/rosbag2_examples_cpp/src/simple_bag_player.cpp
Outdated
Show resolved
Hide resolved
rosbag2_examples/rosbag2_examples_cpp/src/simple_bag_player.cpp
Outdated
Show resolved
Hide resolved
self.reader = rosbag2_py.SequentialReader() | ||
storage_options = rosbag2_py._storage.StorageOptions( | ||
uri=bag_filename, | ||
storage_id='sqlite3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i am not mistaken, this is intentionally enabled as sqlite3
? but this bag file can be also red from simple_bag_player.cpp
, because it reads the meta data from the bag file and use the appropriate storage plugin if available? just checking this because user does not meet the failure during the tutorial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was set as sqlite3
in simple_bag_recorder.py
. I don't know the reason exactly.
It is possible to read sqlite3
files from simple_bag_player.cpp
, but the opposite(reading mcap
files from simple_bag_player.py
) isn't.
Maybe we can delete storage_id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, i think that is okay with current code. this also includes an example how to specify the storage id, i think that is fine.
Signed-off-by: Sangtaek Lee <[email protected]>
Signed-off-by: Sangtaek Lee <[email protected]>
I will update the documentation once this is merged. |
: Node("simple_bag_player") | ||
{ | ||
declare_parameter("edit", false); | ||
message_needs_to_be_edit_before_send_ = get_parameter("edit").as_bool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment for the documentation. this needs to be described how to enable with command line parameter argument. so that user can understand we can publish either publishing serialized data as it is or editing data before publishing in the example.
publisher_->publish(*ros_msg); | ||
std::cout << ros_msg->data << "\n"; | ||
} else { | ||
publisher_->publish(*msg->serialized_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sangteak601 As far as I recall we need another type of publisher aka GenericPublisher
to be able to publish serialized data.
|
Fixes #1449.
Added simple bag player examples in cpp and Python. I also tried to read or write bag files without specifying topic types. However, it became too complicated and was no longer a "simple" example, so I decided not to push the changes.