-
Notifications
You must be signed in to change notification settings - Fork 254
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
[WIP] Make Player a rosbag2
component (instead of rosbag2_transport
#1603
Open
roncapat
wants to merge
5
commits into
ros2:rolling
Choose a base branch
from
roncapat:components/move_to_rosbag2
base: rolling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−3
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7a80a0e
Make Player a `rosbag2` component
roncapat 3cf1020
Merge branch 'ros2:rolling' into components/move_to_rosbag2
roncapat c00bf42
Review fixes in rosbag2 composable player
MichaelOrlov 4f6414e
Rename component_player.{cpp}hpp to the composable_player.{cpp}hpp
MichaelOrlov 8751ebf
Add deprecation notice for the rosbag2_transport::Player constructor
MichaelOrlov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,48 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(rosbag2) | ||
|
||
# Default to C99 | ||
if(NOT CMAKE_C_STANDARD) | ||
set(CMAKE_C_STANDARD 99) | ||
endif() | ||
|
||
# Default to C++17 | ||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
endif() | ||
|
||
find_package(ament_cmake REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclcpp_components REQUIRED) | ||
find_package(rosbag2_transport REQUIRED) | ||
|
||
# Library for Rosbag2 composable nodes | ||
add_library(${PROJECT_NAME}_nodes SHARED | ||
src/rosbag2/composable_player.cpp | ||
# src/rosbag2/composable_recorder.cpp | ||
) | ||
target_include_directories(${PROJECT_NAME}_nodes PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>) | ||
|
||
ament_target_dependencies(${PROJECT_NAME}_nodes rclcpp rclcpp_components rosbag2_transport) | ||
|
||
rclcpp_components_register_node(${PROJECT_NAME}_nodes PLUGIN "rosbag2::Player" EXECUTABLE player) | ||
|
||
install(DIRECTORY include/ | ||
DESTINATION include/${PROJECT_NAME} | ||
) | ||
|
||
install( | ||
TARGETS ${PROJECT_NAME}_nodes | ||
EXPORT export_${PROJECT_NAME}_nodes | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) | ||
|
||
# Export modern CMake targets | ||
ament_export_targets(export_${PROJECT_NAME}_nodes) | ||
|
||
ament_package() |
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,56 @@ | ||
// Copyright 2024 Open Source Robotics Foundation, Inc. | ||
// | ||
// 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. | ||
|
||
/* This header must be included by all rclcpp headers which declare symbols | ||
* which are defined in the rclcpp library. When not building the rclcpp | ||
* library, i.e. when using the headers in other package's code, the contents | ||
* of this header change the visibility of certain symbols which the rclcpp | ||
* library cannot have, but the consuming code must have inorder to link. | ||
*/ | ||
|
||
#ifndef ROSBAG2__COMPOSABLE_PLAYER_HPP_ | ||
#define ROSBAG2__COMPOSABLE_PLAYER_HPP_ | ||
|
||
#include <string> | ||
|
||
#include "rclcpp/node_options.hpp" | ||
#include "rosbag2/visibility_control.hpp" | ||
#include "rosbag2_transport/player.hpp" | ||
|
||
namespace rosbag2 | ||
{ | ||
class Player : public rosbag2_transport::Player { | ||
public: | ||
/// \brief Constructor and entry point for the composable player. | ||
/// Will call Player(node_name, node_options) constructor with node_name = "rosbag2_player". | ||
/// \param node_options Node options which will be used during construction of the underlying | ||
/// node. | ||
ROSBAG2_PUBLIC | ||
explicit Player(const rclcpp::NodeOptions & node_options); | ||
|
||
/// \brief Default constructor and entry point for the composable player. | ||
/// Will construct Player class and initialize play_options, storage_options from node | ||
/// parameters. At the end will call Player::play() to automatically start playback in a | ||
/// separate thread. | ||
/// \param node_name Name for the underlying node. | ||
/// \param node_options Node options which will be used during construction of the underlying | ||
/// node. | ||
ROSBAG2_PUBLIC | ||
explicit Player( | ||
const std::string & node_name = "rosbag2_player", | ||
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions()); | ||
}; | ||
} // namespace rosbag2 | ||
|
||
#endif // ROSBAG2__COMPOSABLE_PLAYER_HPP_ |
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,56 @@ | ||
// Copyright 2024 Open Source Robotics Foundation, Inc. | ||
// | ||
// 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. | ||
|
||
/* This header must be included by all rclcpp headers which declare symbols | ||
* which are defined in the rclcpp library. When not building the rclcpp | ||
* library, i.e. when using the headers in other package's code, the contents | ||
* of this header change the visibility of certain symbols which the rclcpp | ||
* library cannot have, but the consuming code must have inorder to link. | ||
*/ | ||
|
||
#ifndef ROSBAG2__VISIBILITY_CONTROL_HPP_ | ||
#define ROSBAG2__VISIBILITY_CONTROL_HPP_ | ||
|
||
// This logic was borrowed (then namespaced) from the examples on the gcc wiki: | ||
// https://gcc.gnu.org/wiki/Visibility | ||
|
||
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define ROSBAG2_EXPORT __attribute__ ((dllexport)) | ||
#define ROSBAG2_IMPORT __attribute__ ((dllimport)) | ||
#else | ||
#define ROSBAG2_EXPORT __declspec(dllexport) | ||
#define ROSBAG2_IMPORT __declspec(dllimport) | ||
#endif | ||
#ifdef ROSBAG2_BUILDING_LIBRARY | ||
#define ROSBAG2_PUBLIC ROSBAG2_EXPORT | ||
#else | ||
#define ROSBAG2_PUBLIC ROSBAG2_IMPORT | ||
#endif | ||
#define ROSBAG2_PUBLIC_TYPE ROSBAG2_PUBLIC | ||
#define ROSBAG2_LOCAL | ||
#else | ||
#define ROSBAG2_EXPORT __attribute__ ((visibility("default"))) | ||
#define ROSBAG2_IMPORT | ||
#if __GNUC__ >= 4 | ||
#define ROSBAG2_PUBLIC __attribute__ ((visibility("default"))) | ||
#define ROSBAG2_LOCAL __attribute__ ((visibility("hidden"))) | ||
#else | ||
#define ROSBAG2_PUBLIC | ||
#define ROSBAG2_LOCAL | ||
#endif | ||
#define ROSBAG2_PUBLIC_TYPE | ||
#endif | ||
|
||
#endif // ROSBAG2__VISIBILITY_CONTROL_HPP_ |
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
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,39 @@ | ||
// Copyright 2024 Open Source Robotics Foundation, Inc. | ||
// | ||
// 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. | ||
|
||
/* This header must be included by all rclcpp headers which declare symbols | ||
* which are defined in the rclcpp library. When not building the rclcpp | ||
* library, i.e. when using the headers in other package's code, the contents | ||
* of this header change the visibility of certain symbols which the rclcpp | ||
* library cannot have, but the consuming code must have inorder to link. | ||
*/ | ||
|
||
#include "rclcpp_components/register_node_macro.hpp" | ||
#include "rosbag2/composable_player.hpp" | ||
|
||
namespace rosbag2 | ||
{ | ||
Player::Player(const rclcpp::NodeOptions & node_options) | ||
: Player("rosbag2_player", node_options) {} | ||
|
||
Player::Player( | ||
const std::string & node_name, | ||
const rclcpp::NodeOptions & node_options) | ||
: rosbag2_transport::Player(node_name, node_options) {} | ||
} // namespace rosbag2 | ||
|
||
// Register the component with class_loader. | ||
// This acts as an entry point, allowing the component to be | ||
// discoverable when its library is being loaded into a running process. | ||
RCLCPP_COMPONENTS_REGISTER_NODE(rosbag2::Player) |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clalancette Do you have any idea how to deprecate early added
"rosbag2_transport::Player"
registered rclcpp component node from further usage?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh never mind. I found a way how to put a deprecation notice. See 8751ebf for details.
cc: @roncapat