Skip to content

Commit 0fcc839

Browse files
roncapatmorlov-apexaiMichaelOrlov
authored
Make Player and Recorder Composable (#902) (#1419)
* Squasgh to ease rebase Signed-off-by: Patrick Roncagliolo <[email protected]> * Remove TODO for keyboard handlers Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Change structure Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * QoS parsing Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Uncrustify Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Draft comparison of passed vs parsed params Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix shared_from_this() issue, param file & paths Signed-off-by: roncapat <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Fixes after rebase Signed-off-by: Patrick Roncagliolo <[email protected]> * Fixes to handle durations Signed-off-by: Patrick Roncagliolo <[email protected]> * Better test output Signed-off-by: Patrick Roncagliolo <[email protected]> * Drafting record param test Signed-off-by: Patrick Roncagliolo <[email protected]> * Fixing recorder issues Signed-off-by: Patrick Roncagliolo <[email protected]> * Fixes Signed-off-by: Patrick Roncagliolo <[email protected]> * Draft component load test Signed-off-by: Patrick Roncagliolo <[email protected]> * Composition tests working Signed-off-by: Patrick Roncagliolo <[email protected]> * Uncrustify Signed-off-by: Patrick Roncagliolo <[email protected]> * Cpplint Signed-off-by: Patrick Roncagliolo <[email protected]> * Cpplint Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix play_offset bug Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix storage defaults bug Signed-off-by: Patrick Roncagliolo <[email protected]> * Get rid of temporal conversion crutches using map<string, Rosbag2QoS> Signed-off-by: Michael Orlov <[email protected]> * Use const ref to node in the options getter functions - Also made a style clean up in getter functions Signed-off-by: Michael Orlov <[email protected]> * Cleanups in get_storage(/play/record)_options functions Signed-off-by: Michael Orlov <[email protected]> * Move RosBag2RecordTestFixture insight test_record_params.cpp Signed-off-by: Michael Orlov <[email protected]> * Rename overrides.yaml to the qos_profile_overrides.yaml file Signed-off-by: Michael Orlov <[email protected]> * Rename params_player.yaml to the player_node_params.yaml Signed-off-by: Michael Orlov <[email protected]> * Rename params_recorder.yaml to the recorder_node_params.yaml Signed-off-by: Michael Orlov <[email protected]> * Replace Rosbag2Duration by rclcpp::Duration Signed-off-by: Michael Orlov <[email protected]> * Cleanup in functions which are getting values from node parameters - Address issues in duration and integer parameters conversion - Introduce `declare_integer_node_params(..)` and `get_duration_from_node_param(..)` helper functions Signed-off-by: Michael Orlov <[email protected]> * Bugfix. Adjust min-max ranges for get_duration_from_node_param(..) - Also add expected range to the exception message Signed-off-by: Michael Orlov <[email protected]> * Initial comparisons Signed-off-by: Patrick Roncagliolo <[email protected]> * Move component manager in fixture Signed-off-by: Patrick Roncagliolo <[email protected]> * Uncrustify Signed-off-by: Patrick Roncagliolo <[email protected]> * Remove residual AMENT_DEPS after merge Signed-off-by: Patrick Roncagliolo <[email protected]> * Complete test_play_params Signed-off-by: Patrick Roncagliolo <[email protected]> * Finish param tests Signed-off-by: Patrick Roncagliolo <[email protected]> * Uncrustify Signed-off-by: Patrick Roncagliolo <[email protected]> * Cleanups in player/recorder parameters and load components tests Signed-off-by: Michael Orlov <[email protected]> * Renames in player/recorder parameters and load components tests Signed-off-by: Michael Orlov <[email protected]> * Namespaced parameters Signed-off-by: Patrick Roncagliolo <[email protected]> * Fix load_composable_components test Signed-off-by: Patrick Roncagliolo <[email protected]> * Automatically start playback in "composable" Player constructor - Added doxygen comments for Player's constructors Signed-off-by: Michael Orlov <[email protected]> * Add integration test for composable player - Integration test will check that player can automatically play file after composition Signed-off-by: Michael Orlov <[email protected]> * Add missing dependencies to the mock_player.hpp Signed-off-by: Michael Orlov <[email protected]> * Automatically start recording in "composable" Recorder constructor - Added doxygen comments for Recorder's constructors Signed-off-by: Michael Orlov <[email protected]> * Adopt existent tests for auto starting recording after composition - Add default "cdr" value for rmw_serialization_format node parameter Signed-off-by: Michael Orlov <[email protected]> * Add integration test for composable recorder - Test verify that recorder can automatically start recording after composition and record messages Signed-off-by: Michael Orlov <[email protected]> * Add missed parameters prefixes after rebase Signed-off-by: Michael Orlov <[email protected]> * Fix for failing test with wrong check for playback_until_timestamp Signed-off-by: Michael Orlov <[email protected]> * Fix for failing tests with wrong parameters deduction - Adjust max bagfile size and duration due to the bug in the rc_yaml_param_parcer/parser.c Need to use srtoll() instead of the strol() in parser Signed-off-by: Michael Orlov <[email protected]> * Close recorder before trying to delete temp files on test destruction Signed-off-by: Michael Orlov <[email protected]> * Update rosbag2_transport/test/rosbag2_transport/composition_manager_test_fixture.hpp Signed-off-by: Patrick Roncagliolo <[email protected]> * Update rosbag2_transport/test/rosbag2_transport/test_composable_recorder.cpp Signed-off-by: Patrick Roncagliolo <[email protected]> * Update rosbag2_transport/CMakeLists.txt Signed-off-by: Patrick Roncagliolo <[email protected]> * Update rosbag2_transport/CMakeLists.txt Signed-off-by: Patrick Roncagliolo <[email protected]> * Address warnings from Windows CI job in composable player and recorder Signed-off-by: Michael Orlov <[email protected]> * Update rosbag2_transport/src/rosbag2_transport/config_options_from_node_params.cpp Co-authored-by: Michael Orlov <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> * Update rosbag2_transport/test/rosbag2_transport/test_composable_player.cpp Co-authored-by: Michael Orlov <[email protected]> Signed-off-by: Patrick Roncagliolo <[email protected]> --------- Signed-off-by: Patrick Roncagliolo <[email protected]> Signed-off-by: roncapat <[email protected]> Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]>
1 parent 0f3ebfe commit 0fcc839

24 files changed

+1553
-74
lines changed

rosbag2_storage/include/rosbag2_storage/qos.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#ifndef ROSBAG2_STORAGE__QOS_HPP_
1616
#define ROSBAG2_STORAGE__QOS_HPP_
1717

18-
#include <map>
1918
#include <string>
2019
#include <vector>
20+
#include <unordered_map>
2121

2222
#include "rclcpp/node_interfaces/node_graph_interface.hpp"
2323
#include "rclcpp/qos.hpp"
@@ -179,11 +179,11 @@ struct ROSBAG2_STORAGE_PUBLIC convert<std::vector<rclcpp::QoS>>
179179
};
180180

181181
template<>
182-
struct ROSBAG2_STORAGE_PUBLIC convert<std::map<std::string, rosbag2_storage::Rosbag2QoS>>
182+
struct ROSBAG2_STORAGE_PUBLIC convert<std::unordered_map<std::string, rclcpp::QoS>>
183183
{
184-
static Node encode(const std::map<std::string, rosbag2_storage::Rosbag2QoS> & rhs);
184+
static Node encode(const std::unordered_map<std::string, rclcpp::QoS> & rhs);
185185
static bool decode(
186-
const Node & node, std::map<std::string, rosbag2_storage::Rosbag2QoS> & rhs, int version = 9);
186+
const Node & node, std::unordered_map<std::string, rclcpp::QoS> & rhs, int version = 9);
187187
};
188188
} // namespace YAML
189189

rosbag2_storage/include/rosbag2_storage/yaml.hpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# pragma warning(pop)
3131
#endif
3232

33+
#include "rclcpp/duration.hpp"
3334
#include "rosbag2_storage/bag_metadata.hpp"
3435
#include "rosbag2_storage/qos.hpp"
3536

@@ -41,7 +42,7 @@ template<typename T>
4142
void optional_assign(const Node & node, std::string field, T & assign_to)
4243
{
4344
if (node[field]) {
44-
assign_to = node[field].as<T>();
45+
YAML::convert<T>::decode(node[field], assign_to);
4546
}
4647
}
4748

@@ -66,6 +67,41 @@ struct convert<std::unordered_map<std::string, std::string>>
6667
}
6768
};
6869

70+
template<>
71+
struct convert<rclcpp::Duration>
72+
{
73+
static Node encode(const rclcpp::Duration & duration)
74+
{
75+
Node node;
76+
node["sec"] = duration.nanoseconds() / 1000000000;
77+
node["nsec"] = duration.nanoseconds() % 1000000000;
78+
return node;
79+
}
80+
81+
static bool decode(const Node & node, rclcpp::Duration & duration)
82+
{
83+
duration = rclcpp::Duration(node["sec"].as<int32_t>(), node["nsec"].as<uint32_t>());
84+
return true;
85+
}
86+
};
87+
88+
template<>
89+
struct convert<std::chrono::milliseconds>
90+
{
91+
static Node encode(const std::chrono::milliseconds & duration)
92+
{
93+
Node node;
94+
node["milliseconds"] = duration.count();
95+
return node;
96+
}
97+
98+
static bool decode(const Node & node, std::chrono::milliseconds & duration)
99+
{
100+
duration = std::chrono::milliseconds(node["milliseconds"].as<std::chrono::milliseconds::rep>());
101+
return true;
102+
}
103+
};
104+
69105
template<>
70106
struct convert<rosbag2_storage::TopicMetadata>
71107
{

rosbag2_storage/src/rosbag2_storage/qos.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <string>
1616
#include <vector>
1717

18-
1918
#include "rosbag2_storage/qos.hpp"
2019
#include "rosbag2_storage/logging.hpp"
2120
#include "rmw/qos_string_conversions.h"
@@ -275,8 +274,8 @@ bool convert<std::vector<rclcpp::QoS>>::decode(
275274
return true;
276275
}
277276

278-
Node convert<std::map<std::string, rosbag2_storage::Rosbag2QoS>>::encode(
279-
const std::map<std::string, rosbag2_storage::Rosbag2QoS> & rhs)
277+
Node convert<std::unordered_map<std::string, rclcpp::QoS>>::encode(
278+
const std::unordered_map<std::string, rclcpp::QoS> & rhs)
280279
{
281280
Node node{NodeType::Sequence};
282281
for (const auto & [key, value] : rhs) {
@@ -285,17 +284,21 @@ Node convert<std::map<std::string, rosbag2_storage::Rosbag2QoS>>::encode(
285284
return node;
286285
}
287286

288-
bool convert<std::map<std::string, rosbag2_storage::Rosbag2QoS>>::decode(
289-
const Node & node, std::map<std::string, rosbag2_storage::Rosbag2QoS> & rhs, int version)
287+
bool convert<std::unordered_map<std::string, rclcpp::QoS>>::decode(
288+
const Node & node, std::unordered_map<std::string, rclcpp::QoS> & rhs, int version)
290289
{
291290
if (!node.IsMap()) {
292291
return false;
293292
}
294293

295294
rhs.clear();
296295
for (const auto & element : node) {
297-
rhs[element.first.as<std::string>()] = decode_for_version<rosbag2_storage::Rosbag2QoS>(
298-
element.second, version);
296+
// Using rosbag2_storage::Rosbag2QoS for decoding because rclcpp::QoS is not default
297+
// constructable. Note: It is safe to use upcast when inserting into the unordered_map
298+
rhs.insert(
299+
{element.first.as<std::string>(),
300+
decode_for_version<rosbag2_storage::Rosbag2QoS>(element.second, version)
301+
});
299302
}
300303
return true;
301304
}

rosbag2_transport/CMakeLists.txt

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ find_package(ament_cmake_ros REQUIRED)
3131
find_package(keyboard_handler REQUIRED)
3232
find_package(rcl REQUIRED)
3333
find_package(rclcpp REQUIRED)
34+
find_package(rclcpp_components REQUIRED)
3435
find_package(rcutils REQUIRED)
3536
find_package(rmw REQUIRED)
3637
find_package(rosbag2_compression REQUIRED)
@@ -44,17 +45,20 @@ find_package(yaml_cpp_vendor REQUIRED)
4445
add_library(${PROJECT_NAME} SHARED
4546
src/rosbag2_transport/bag_rewrite.cpp
4647
src/rosbag2_transport/player.cpp
48+
src/rosbag2_transport/play_options.cpp
4749
src/rosbag2_transport/reader_writer_factory.cpp
4850
src/rosbag2_transport/recorder.cpp
4951
src/rosbag2_transport/record_options.cpp
50-
src/rosbag2_transport/topic_filter.cpp)
52+
src/rosbag2_transport/topic_filter.cpp
53+
src/rosbag2_transport/config_options_from_node_params.cpp)
5154
target_include_directories(${PROJECT_NAME} PUBLIC
5255
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
5356
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>)
5457
target_link_libraries(${PROJECT_NAME}
5558
keyboard_handler::keyboard_handler
5659
rcl::rcl
5760
rclcpp::rclcpp
61+
${rclcpp_components_TARGETS}
5862
rcutils::rcutils
5963
rmw::rmw
6064
rosbag2_compression::rosbag2_compression
@@ -65,6 +69,12 @@ target_link_libraries(${PROJECT_NAME}
6569
yaml-cpp
6670
)
6771

72+
rclcpp_components_register_node(
73+
${PROJECT_NAME} PLUGIN "rosbag2_transport::Player" EXECUTABLE player)
74+
75+
rclcpp_components_register_node(
76+
${PROJECT_NAME} PLUGIN "rosbag2_transport::Recorder" EXECUTABLE recorder)
77+
6878
# Causes the visibility macros to use dllexport rather than dllimport,
6979
# which is appropriate when building the dll but not consuming it.
7080
target_compile_definitions(${PROJECT_NAME} PRIVATE "ROSBAG2_TRANSPORT_BUILDING_LIBRARY")
@@ -89,6 +99,7 @@ ament_export_libraries(${PROJECT_NAME})
8999
ament_export_targets(export_${PROJECT_NAME})
90100

91101
ament_export_dependencies(
102+
rclcpp_components
92103
keyboard_handler
93104
rosbag2_cpp
94105
rosbag2_compression
@@ -109,6 +120,10 @@ function(create_tests_for_rmw_implementation)
109120
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common
110121
${SKIP_TEST})
111122

123+
rosbag2_transport_add_gmock(test_composable_player
124+
test/rosbag2_transport/test_composable_player.cpp
125+
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common)
126+
112127
rosbag2_transport_add_gmock(test_play_loop
113128
test/rosbag2_transport/test_play_loop.cpp
114129
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common
@@ -203,10 +218,15 @@ function(create_tests_for_rmw_implementation)
203218
test/rosbag2_transport/test_record_services.cpp
204219
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common)
205220

206-
rosbag2_transport_add_gmock(test_component_parameters
207-
test/rosbag2_transport/test_composable_recorder.cpp
221+
rosbag2_transport_add_gmock(test_composable_recorder
222+
test/rosbag2_transport/test_composable_recorder.cpp
208223
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common)
209224

225+
rosbag2_transport_add_gmock(test_load_composable_components
226+
test/rosbag2_transport/test_load_composable_components.cpp
227+
LINK_LIBS rosbag2_transport ${test_msgs_TARGETS} rosbag2_test_common::rosbag2_test_common
228+
${rclcpp_components_TARGETS})
229+
210230
if(${rmw_implementation} MATCHES "rmw_cyclonedds(.*)")
211231
ament_add_test_label(test_play_services__rmw_cyclonedds_cpp xfail)
212232
endif()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2023 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_
16+
#define ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_
17+
18+
#include <memory>
19+
20+
#include "rclcpp/node.hpp"
21+
#include "rosbag2_transport/play_options.hpp"
22+
#include "rosbag2_transport/record_options.hpp"
23+
#include "rosbag2_storage/storage_options.hpp"
24+
25+
namespace rosbag2_transport
26+
{
27+
rosbag2_transport::PlayOptions
28+
get_play_options_from_node_params(rclcpp::Node & node);
29+
30+
rosbag2_transport::RecordOptions
31+
get_record_options_from_node_params(rclcpp::Node & node);
32+
33+
rosbag2_storage::StorageOptions
34+
get_storage_options_from_node_params(rclcpp::Node & node);
35+
} // namespace rosbag2_transport
36+
37+
#endif // ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_

rosbag2_transport/include/rosbag2_transport/play_options.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
#ifndef ROSBAG2_TRANSPORT__PLAY_OPTIONS_HPP_
1616
#define ROSBAG2_TRANSPORT__PLAY_OPTIONS_HPP_
1717

18+
#include <chrono>
1819
#include <cstddef>
1920
#include <string>
2021
#include <unordered_map>
2122
#include <vector>
2223

2324
#include "keyboard_handler/keyboard_handler.hpp"
24-
#include "rclcpp/duration.hpp"
25-
#include "rclcpp/time.hpp"
26-
#include "rclcpp/qos.hpp"
25+
#include "rclcpp/rclcpp.hpp"
26+
#include "rosbag2_storage/yaml.hpp"
27+
#include "rosbag2_transport/visibility_control.hpp"
2728

2829
namespace rosbag2_transport
2930
{
@@ -103,4 +104,15 @@ struct PlayOptions
103104

104105
} // namespace rosbag2_transport
105106

107+
namespace YAML
108+
{
109+
template<>
110+
struct ROSBAG2_TRANSPORT_PUBLIC convert<rosbag2_transport::PlayOptions>
111+
{
112+
static Node encode(const rosbag2_transport::PlayOptions & play_options);
113+
static bool decode(const Node & node, rosbag2_transport::PlayOptions & play_options);
114+
};
115+
116+
} // namespace YAML
117+
106118
#endif // ROSBAG2_TRANSPORT__PLAY_OPTIONS_HPP_

rosbag2_transport/include/rosbag2_transport/player.hpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,52 @@ class Player : public rclcpp::Node
8080
ROSBAG2_TRANSPORT_PUBLIC
8181
static constexpr callback_handle_t invalid_callback_handle = 0;
8282

83+
/// \brief Constructor and entry point for the composable player.
84+
/// Will call Player(node_name, node_options) constructor with node_name = "rosbag2_player".
85+
/// \param node_options Node options which will be used during construction of the underlying
86+
/// node.
87+
ROSBAG2_TRANSPORT_PUBLIC
88+
explicit Player(const rclcpp::NodeOptions & node_options);
89+
90+
/// \brief Default constructor and entry point for the composable player.
91+
/// Will construct Player class and initialize play_options, storage_options from node
92+
/// parameters. At the end will call Player::play() to automatically start playback in a
93+
/// separate thread.
94+
/// \param node_name Name for the underlying node.
95+
/// \param node_options Node options which will be used during construction of the underlying
96+
/// node.
8397
ROSBAG2_TRANSPORT_PUBLIC
8498
explicit Player(
8599
const std::string & node_name = "rosbag2_player",
86100
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions());
87101

102+
/// \brief Constructor which will construct Player class with provided parameters and default
103+
/// rosbag2_cpp::reader and KeyboardHandler classes.
104+
/// \note The KeyboardHandler class will be initialized with parameter which is disabling
105+
/// signal handlers in it.
106+
/// \param storage_options Storage options which will be applied to the rosbag2_cpp::reader
107+
/// after construction.
108+
/// \param play_options Playback settings for Player class.
109+
/// \param node_name Name for the underlying node.
110+
/// \param node_options Node options which will be used during construction of the underlying
111+
/// node.
88112
ROSBAG2_TRANSPORT_PUBLIC
89113
Player(
90114
const rosbag2_storage::StorageOptions & storage_options,
91115
const rosbag2_transport::PlayOptions & play_options,
92116
const std::string & node_name = "rosbag2_player",
93117
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions());
94118

119+
/// \brief Constructor which will construct Player class with provided parameters and default
120+
/// KeyboardHandler class initialized with parameter which is disabling signal handlers in it.
121+
/// \param reader Unique pointer to the rosbag2_cpp::Reader class which will be moved to the
122+
/// internal instance of the Player class during construction.
123+
/// \param storage_options Storage options which will be applied to the rosbag2_cpp::reader
124+
/// after construction.
125+
/// \param play_options Playback settings for Player class.
126+
/// \param node_name Name for the underlying node.
127+
/// \param node_options Node options which will be used during construction of the underlying
128+
/// node.
95129
ROSBAG2_TRANSPORT_PUBLIC
96130
Player(
97131
std::unique_ptr<rosbag2_cpp::Reader> reader,
@@ -100,6 +134,16 @@ class Player : public rclcpp::Node
100134
const std::string & node_name = "rosbag2_player",
101135
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions());
102136

137+
/// \brief Constructor which will construct Player class with provided parameters.
138+
/// \param keyboard_handler Keyboard handler class uses to handle user input from keyboard.
139+
/// \param reader Unique pointer to the rosbag2_cpp::Reader class which will be moved to the
140+
/// internal instance of the Player class during construction.
141+
/// \param storage_options Storage options which will be applied to the rosbag2_cpp::reader
142+
/// after construction.
143+
/// \param play_options Playback settings for Player class.
144+
/// \param node_name Name for the underlying node.
145+
/// \param node_options Node options which will be used during construction of the underlying
146+
/// node.
103147
ROSBAG2_TRANSPORT_PUBLIC
104148
Player(
105149
std::unique_ptr<rosbag2_cpp::Reader> reader,
@@ -109,6 +153,7 @@ class Player : public rclcpp::Node
109153
const std::string & node_name = "rosbag2_player",
110154
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions());
111155

156+
/// \brief Default destructor.
112157
ROSBAG2_TRANSPORT_PUBLIC
113158
virtual ~Player();
114159

@@ -237,6 +282,16 @@ class Player : public rclcpp::Node
237282
ROSBAG2_TRANSPORT_PUBLIC
238283
size_t get_number_of_registered_on_play_msg_post_callbacks();
239284

285+
ROSBAG2_TRANSPORT_PUBLIC
286+
/// \brief Getter for the currently stored storage options
287+
/// \return Copy of the currently stored storage options
288+
const rosbag2_storage::StorageOptions & get_storage_options();
289+
290+
ROSBAG2_TRANSPORT_PUBLIC
291+
/// \brief Getter for the currently stored play options
292+
/// \return Copy of the currently stored play options
293+
const rosbag2_transport::PlayOptions & get_play_options();
294+
240295
private:
241296
std::unique_ptr<PlayerImpl> pimpl_;
242297
};

0 commit comments

Comments
 (0)