forked from ros2/rclcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override QoS Profiles in CLI - Playback (ros2#356)
* Add overrides to play verb Signed-off-by: Anas Abou Allaban <aabouallaban@pm.me>
- Loading branch information
Anas Abou Allaban
authored
Apr 13, 2020
1 parent
72a62ea
commit 7e35b10
Showing
7 changed files
with
158 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
rosbag2_bagfile_information: | ||
version: 4 | ||
storage_identifier: sqlite3 | ||
relative_file_paths: | ||
- empty_bag_0.db3 | ||
duration: | ||
nanoseconds: 0 | ||
starting_time: | ||
nanoseconds_since_epoch: 9223372036854775807 | ||
message_count: 0 | ||
topics_with_message_count: | ||
- topic_metadata: | ||
name: /parameter_events | ||
type: rcl_interfaces/msg/ParameterEvent | ||
serialization_format: cdr | ||
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 2147483647\n nsec: 4294967295\n lifespan:\n sec: 2147483647\n nsec: 4294967295\n liveliness: 1\n liveliness_lease_duration:\n sec: 2147483647\n nsec: 4294967295\n avoid_ros_namespace_conventions: false" | ||
message_count: 0 | ||
- topic_metadata: | ||
name: /rosout | ||
type: rcl_interfaces/msg/Log | ||
serialization_format: cdr | ||
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 1\n deadline:\n sec: 2147483647\n nsec: 4294967295\n lifespan:\n sec: 10\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 2147483647\n nsec: 4294967295\n avoid_ros_namespace_conventions: false" | ||
message_count: 0 | ||
compression_format: "" | ||
compression_mode: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import contextlib | ||
from pathlib import Path | ||
import re | ||
import unittest | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import ExecuteProcess | ||
import launch_testing | ||
import launch_testing.actions | ||
import launch_testing.asserts | ||
import launch_testing.markers | ||
import launch_testing.tools | ||
|
||
import pytest | ||
|
||
|
||
RESOURCES_PATH = Path(__file__).parent / 'resources' | ||
TEST_NODE = 'ros2bag_record_qos_profile_test_node' | ||
TEST_NAMESPACE = 'ros2bag_record_qos_profile' | ||
ERROR_STRING = r'\[ERROR] \[ros2bag]:' | ||
|
||
|
||
@pytest.mark.rostest | ||
@launch_testing.markers.keep_alive | ||
def generate_test_description(): | ||
return LaunchDescription([launch_testing.actions.ReadyToTest()]) | ||
|
||
|
||
class TestRos2BagPlay(unittest.TestCase): | ||
|
||
@classmethod | ||
def setUpClass(cls, launch_service, proc_info, proc_output): | ||
@contextlib.contextmanager | ||
def launch_bag_command(self, arguments, **kwargs): | ||
pkg_command_action = ExecuteProcess( | ||
cmd=['ros2', 'bag', *arguments], | ||
additional_env={'PYTHONUNBUFFERED': '1'}, | ||
name='ros2bag-cli', | ||
output='screen', | ||
**kwargs | ||
) | ||
with launch_testing.tools.launch_process( | ||
launch_service, pkg_command_action, proc_info, proc_output | ||
) as pkg_command: | ||
yield pkg_command | ||
cls.launch_bag_command = launch_bag_command | ||
|
||
def test_qos_simple(self): | ||
"""Test with a full QoS profile override for a single topic.""" | ||
profile_path = RESOURCES_PATH / 'qos_profile.yaml' | ||
bag_path = RESOURCES_PATH / 'empty_bag' | ||
arguments = ['play', '--qos-profile-overrides-path', profile_path.as_posix(), | ||
bag_path.as_posix()] | ||
with self.launch_bag_command(arguments=arguments) as bag_command: | ||
bag_command.wait_for_shutdown(timeout=5) | ||
expected_string_regex = re.compile(ERROR_STRING) | ||
matches = expected_string_regex.search(bag_command.output) | ||
assert not matches, print('ros2bag CLI did not produce the expected output') | ||
|
||
def test_qos_incomplete(self): | ||
"""Test a partially filled QoS profile for a single topic.""" | ||
profile_path = RESOURCES_PATH / 'incomplete_qos_profile.yaml' | ||
bag_path = RESOURCES_PATH / 'empty_bag' | ||
arguments = ['play', '--qos-profile-overrides-path', profile_path.as_posix(), | ||
bag_path.as_posix()] | ||
with self.launch_bag_command(arguments=arguments) as bag_command: | ||
bag_command.wait_for_shutdown(timeout=5) | ||
expected_string_regex = re.compile(ERROR_STRING) | ||
matches = expected_string_regex.search(bag_command.output) | ||
assert not matches, print('ros2bag CLI did not produce the expected output') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters