ros2bag.api package

Module contents

class ros2bag.api.SplitLineFormatter(prog, indent_increment=2, max_help_position=24, width=None)

Bases: HelpFormatter

Extend argparse HelpFormatter to allow for explicit newlines in help string.

ros2bag.api.add_multi_bag_input_arg(parser: ArgumentParser, required: bool = False) None

Add option for list of input bags.

Parameters:
  • parser – the parser

  • required – whether this option should be required

ros2bag.api.add_standard_multi_reader_args(parser: ArgumentParser) None

Add arguments for multiple input bags.

Parameters:

parser – the parser

ros2bag.api.add_standard_reader_args(parser: ArgumentParser) None

Add arguments for one input bag.

Parameters:

parser – the parser

ros2bag.api.add_writer_storage_plugin_extensions(parser: ArgumentParser) None
ros2bag.api.check_not_negative_float(value: Any) float

Argparse validator to verify that a value is a float and that not negative.

ros2bag.api.check_not_negative_int(arg: str) int

Argparse validator to verify that a value is a int and not negative.

ros2bag.api.check_path_exists(value: Any) str

Argparse validator to verify a path exists.

ros2bag.api.check_positive_float(value: Any) float

Argparse validator to verify that a value is a float and positive.

ros2bag.api.convert_service_to_service_event_topic(services)
ros2bag.api.convert_yaml_to_qos_profile(qos_profile_dict: Dict) Dict[str, rclpy.qos.QoSProfile]

Convert a YAML file to use rclpy’s QoSProfile.

ros2bag.api.create_bag_directory(uri: str) str | None

Create a directory.

ros2bag.api.dict_to_duration(time_dict: Dict[str, int] | None) rclpy.duration.Duration

Convert a QoS duration profile from YAML into an rclpy Duration.

ros2bag.api.input_bag_arg_to_storage_options(input_arg: List[List[str]], storage_config_file: str | None = None) List[rosbag2_py.StorageOptions]

Convert input bag argument value(s) to list of StorageOptions.

Raises ValueError if validation fails, including: 1. Bag path existence 2. Storage ID 3. Storage config file existence

Parameters:
  • input_arg – the values of the input argument

  • storage_config_file – the storage config file, if any

ros2bag.api.interpret_dict_as_qos_profile(qos_profile_dict: Dict) rclpy.qos.QoSProfile

Sanitize a user provided dict of a QoS profile and verify all keys are valid.

ros2bag.api.print_error(string: str) str
ros2bag.api.print_warn(string: str) str