-
Notifications
You must be signed in to change notification settings - Fork 285
Description
Description
We need to add a CLI parameter for the ros2 bag record parameter to be able to set up compression threads priority.
Related Issues
- Follow up on Add option to set compression threads priority #1457
Completion Criteria
The CLI parameter for compression threads priority exists and is covered by unit tests.
Implementation Notes / Suggestions
We already have the corresponding member variable RecordOptions::compression_threads_priority which matches to the
CompressionOptions::thread_priority in the ReaderWriterFactory::make_writer(..) method.
This is going to be a relatively low-effort and straightforward task since changes are expected to be only at the ros2bag and maybe rosbag2_py packages. Perhaps without breaking API/ABI compatibility, and it will be possible to backport to the Jazzy branch.
Testing Notes / Suggestions
We will need to add new or modify existing test in the ros2bag/test/test_recorder_args_parser.py to verify the correctness of the CLI parameter parser with the new CLI option.
Also, it will be great to add one integration test to the ros2bag/test/test_record.py to simply start the rosbag2 recorder with the newly added parameter and verify the debug output in the console. To facilitate debug output verification in the test will need to add some ROSBAG2_COMPRESSION_LOG_INFO_STREAM(..) or ROSBAG2_COMPRESSION_LOG_DEBUG_STREAM(..) output in the constructor of the and run SequentialCompressionWriter::SequentialCompressionWriter(..)ros2 bag record with corresponding --loglevel parameter from integration test. Note. This is supposed to be just a sanity check that the recorder can start with the settled-up CLI option. No need to publish messages and do a real recording with verification.
Update:
Actually will be better to add debug output to the void SequentialCompressionWriter::compression_thread_fn()
rosbag2/rosbag2_compression/src/rosbag2_compression/sequential_compression_writer.cpp
Lines 112 to 117 in cbef00f
| // Every thread needs to have its own compression context for thread safety. | |
| auto compressor = compression_factory_->create_compressor( | |
| compression_options_.compression_format); | |
| rcpputils::check_true(compressor != nullptr, "Could not create compressor."); | |
| while (true) { |
Somewhere before
while (true) { loop