Skip to content
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

Message listener for recording #1075

Open
emersonknapp opened this issue Aug 20, 2022 · 2 comments
Open

Message listener for recording #1075

emersonknapp opened this issue Aug 20, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@emersonknapp
Copy link
Collaborator

Description

Allow user to register a callback with the Recorder that will be called on every new recorded message. This need comes out of rqt_bag workflows. See #558 for full discussion.

Related Issues

Split from #558

Completion Criteria

  • Add a user-provided callback to Recorder that can be called on every new message recorded
  • Expose this API to Python client as well

Implementation Notes / Suggestions

** If you have ideas about how this feature might be accomplished, put them here. Note that this is just a suggestion to the implementer, so feel free to speculate. **

Testing Notes / Suggestions

** All features in this project need tests. Please give some input on cases that will need to be tested - and how the testing might be implemented. **

@emersonknapp emersonknapp added the enhancement New feature or request label Aug 20, 2022
@emersonknapp emersonknapp self-assigned this Aug 31, 2022
@MichaelOrlov
Copy link
Contributor

@emersonknapp I am afraid that callback from each new message to the python API and then to the rqt_bag will hit performance of the entire recording process.
I think it would be better to gather needed statistics inside recorder and provide getters API to it. Perhaps we can use atomic variables without mutexes.
The idea is that rqt_bag will call statistic's getter API periodically instead of subscribing to the callbacks for each message write.

@emersonknapp
Copy link
Collaborator Author

emersonknapp commented Sep 2, 2022

Well, rqt_bag uses a much more inefficient method - when a message comes in, it triggers a separate thread to ask the actual open bagfile for messages in a timestamp range, and uses those results to populate the timeline. I'm not saying this is good, but a callback would be a strict improvement on running a read query on the bag that is being written, for every new message.

EDIT: note this is how ROS 1 version works - rosbag.Bag type supports making read queries into the bag while it is open for writing. rqt_bag calls Bag._get_entries in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants