From 19a48e87e81ca2703800f91b010deae737b6277a Mon Sep 17 00:00:00 2001 From: Masaya Kataoka Date: Mon, 19 Feb 2024 13:00:59 +0900 Subject: [PATCH 1/4] move packages Signed-off-by: Masaya Kataoka --- .../launch/mock_test.launch.py | 6 +- .../openscenario_visualization/CHANGELOG.rst | 0 .../openscenario_visualization/CMakeLists.txt | 13 ----- .../icons/classes/ContextPanel.png | Bin .../openscenario_visualization/img/rviz.png | Bin .../context_panel_plugin.hpp | 0 .../jsk_overlay_utils.hpp | 0 ..._visualization_condition_groups_plugin.hpp | 0 .../openscenario_visualization/package.xml | 0 .../openscenario_visualization/plugins.xml | 0 .../src/context_panel_plugin.cpp | 0 .../jsk_overlay_utils.cpp | 0 ..._visualization_condition_groups_plugin.cpp | 0 .../src/ui/context_panel_plugin.ui | 0 simulation/traffic_simulator/CMakeLists.txt | 13 +++++ .../visualization/visualization_component.hpp | 54 +++++++++--------- .../visualization/visualization_component.cpp | 18 +++--- .../src/visualization/visualization_node.cpp | 4 +- .../launch/random_test.launch.py | 6 +- .../launch/scenario_test_runner.launch.py | 6 +- 20 files changed, 60 insertions(+), 60 deletions(-) rename {openscenario => rviz_plugins}/openscenario_visualization/CHANGELOG.rst (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/CMakeLists.txt (79%) rename {openscenario => rviz_plugins}/openscenario_visualization/icons/classes/ContextPanel.png (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/img/rviz.png (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/include/openscenario_visualization/context_panel_plugin.hpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.hpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/package.xml (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/plugins.xml (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/src/context_panel_plugin.cpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp (100%) rename {openscenario => rviz_plugins}/openscenario_visualization/src/ui/context_panel_plugin.ui (100%) rename openscenario/openscenario_visualization/include/openscenario_visualization/openscenario_visualization_component.hpp => simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp (62%) rename openscenario/openscenario_visualization/src/openscenario_visualization_component.cpp => simulation/traffic_simulator/src/visualization/visualization_component.cpp (96%) rename openscenario/openscenario_visualization/src/openscenario_visualization_node.cpp => simulation/traffic_simulator/src/visualization/visualization_node.cpp (90%) diff --git a/mock/cpp_mock_scenarios/launch/mock_test.launch.py b/mock/cpp_mock_scenarios/launch/mock_test.launch.py index 07474b2928f..4b4b4573caf 100644 --- a/mock/cpp_mock_scenarios/launch/mock_test.launch.py +++ b/mock/cpp_mock_scenarios/launch/mock_test.launch.py @@ -151,9 +151,9 @@ def generate_launch_description(): arguments=[("__log_level:=warn")], ), Node( - package="openscenario_visualization", - executable="openscenario_visualization_node", - name="openscenario_visualization_node", + package="traffic_simulator", + executable="visualization_node", + name="visualizer", output="screen", ), Node( diff --git a/openscenario/openscenario_visualization/CHANGELOG.rst b/rviz_plugins/openscenario_visualization/CHANGELOG.rst similarity index 100% rename from openscenario/openscenario_visualization/CHANGELOG.rst rename to rviz_plugins/openscenario_visualization/CHANGELOG.rst diff --git a/openscenario/openscenario_visualization/CMakeLists.txt b/rviz_plugins/openscenario_visualization/CMakeLists.txt similarity index 79% rename from openscenario/openscenario_visualization/CMakeLists.txt rename to rviz_plugins/openscenario_visualization/CMakeLists.txt index c58057ffdbe..459e794f473 100644 --- a/openscenario/openscenario_visualization/CMakeLists.txt +++ b/rviz_plugins/openscenario_visualization/CMakeLists.txt @@ -35,15 +35,6 @@ include_directories(include SYSTEM ${OGRE_INCLUDE_DIRS}) -ament_auto_add_library(openscenario_visualization_component SHARED - src/openscenario_visualization_component.cpp -) - -ament_auto_add_executable(openscenario_visualization_node - src/openscenario_visualization_node.cpp -) -target_link_libraries(openscenario_visualization_node openscenario_visualization_component) - add_definitions(-DQT_NO_KEYWORDS) qt5_wrap_ui(UIC_FILES src/ui/context_panel_plugin.ui) @@ -63,10 +54,6 @@ target_include_directories(openscenario_visualization_rviz_plugin PRIVATE "${OGR install(DIRECTORY icons DESTINATION share/openscenario_visualization) install(DIRECTORY include/ DESTINATION include) -ament_export_libraries(openscenario_visualization_component) - -rclcpp_components_register_nodes(openscenario_visualization_component "openscenario_visualization::OpenscenarioVisualizationComponent") - if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() diff --git a/openscenario/openscenario_visualization/icons/classes/ContextPanel.png b/rviz_plugins/openscenario_visualization/icons/classes/ContextPanel.png similarity index 100% rename from openscenario/openscenario_visualization/icons/classes/ContextPanel.png rename to rviz_plugins/openscenario_visualization/icons/classes/ContextPanel.png diff --git a/openscenario/openscenario_visualization/img/rviz.png b/rviz_plugins/openscenario_visualization/img/rviz.png similarity index 100% rename from openscenario/openscenario_visualization/img/rviz.png rename to rviz_plugins/openscenario_visualization/img/rviz.png diff --git a/openscenario/openscenario_visualization/include/openscenario_visualization/context_panel_plugin.hpp b/rviz_plugins/openscenario_visualization/include/openscenario_visualization/context_panel_plugin.hpp similarity index 100% rename from openscenario/openscenario_visualization/include/openscenario_visualization/context_panel_plugin.hpp rename to rviz_plugins/openscenario_visualization/include/openscenario_visualization/context_panel_plugin.hpp diff --git a/openscenario/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.hpp b/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.hpp similarity index 100% rename from openscenario/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.hpp rename to rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.hpp diff --git a/openscenario/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp b/rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp similarity index 100% rename from openscenario/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp rename to rviz_plugins/openscenario_visualization/include/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.hpp diff --git a/openscenario/openscenario_visualization/package.xml b/rviz_plugins/openscenario_visualization/package.xml similarity index 100% rename from openscenario/openscenario_visualization/package.xml rename to rviz_plugins/openscenario_visualization/package.xml diff --git a/openscenario/openscenario_visualization/plugins.xml b/rviz_plugins/openscenario_visualization/plugins.xml similarity index 100% rename from openscenario/openscenario_visualization/plugins.xml rename to rviz_plugins/openscenario_visualization/plugins.xml diff --git a/openscenario/openscenario_visualization/src/context_panel_plugin.cpp b/rviz_plugins/openscenario_visualization/src/context_panel_plugin.cpp similarity index 100% rename from openscenario/openscenario_visualization/src/context_panel_plugin.cpp rename to rviz_plugins/openscenario_visualization/src/context_panel_plugin.cpp diff --git a/openscenario/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp similarity index 100% rename from openscenario/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp rename to rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/jsk_overlay_utils.cpp diff --git a/openscenario/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp b/rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp similarity index 100% rename from openscenario/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp rename to rviz_plugins/openscenario_visualization/src/openscenario_visualization_condition_groups_plugin/openscenario_visualization_condition_groups_plugin.cpp diff --git a/openscenario/openscenario_visualization/src/ui/context_panel_plugin.ui b/rviz_plugins/openscenario_visualization/src/ui/context_panel_plugin.ui similarity index 100% rename from openscenario/openscenario_visualization/src/ui/context_panel_plugin.ui rename to rviz_plugins/openscenario_visualization/src/ui/context_panel_plugin.ui diff --git a/simulation/traffic_simulator/CMakeLists.txt b/simulation/traffic_simulator/CMakeLists.txt index 122d3bd60a9..6f967c68485 100644 --- a/simulation/traffic_simulator/CMakeLists.txt +++ b/simulation/traffic_simulator/CMakeLists.txt @@ -58,6 +58,19 @@ ament_auto_add_library(traffic_simulator SHARED src/traffic_lights/traffic_light_publisher.cpp ) +ament_auto_add_library(visualization_component SHARED + src/visualization_component.cpp +) + +ament_auto_add_executable(visualization_node + src/visualization_node.cpp +) +target_link_libraries(visualization_node visualization_component) + +ament_export_libraries(visualization_component) + +rclcpp_components_register_nodes(visualization_component "traffic_simulator::VisualizationComponent") + target_link_libraries(traffic_simulator tinyxml2 pugixml diff --git a/openscenario/openscenario_visualization/include/openscenario_visualization/openscenario_visualization_component.hpp b/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp similarity index 62% rename from openscenario/openscenario_visualization/include/openscenario_visualization/openscenario_visualization_component.hpp rename to simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp index fd60a6ef788..5600eff60f1 100644 --- a/openscenario/openscenario_visualization/include/openscenario_visualization/openscenario_visualization_component.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp @@ -16,8 +16,8 @@ * @brief definition of visualizer component */ -#ifndef OPENSCENARIO_VISUALIZATION__OPENSCENARIO_VISUALIZATION_COMPONENT_HPP_ -#define OPENSCENARIO_VISUALIZATION__OPENSCENARIO_VISUALIZATION_COMPONENT_HPP_ +#ifndef TRAFFIC_SIMULATOR__VISUALIZATION__VISUALIZATION_COMPONENT_HPP_ +#define TRAFFIC_SIMULATOR__VISUALIZATION__VISUALIZATION_COMPONENT_HPP_ #if __cplusplus extern "C" { @@ -27,38 +27,38 @@ extern "C" { // demos/composition/include/composition/visibility_control.h at https://github.com/ros2/demos #if defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_EXPORT \ +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT \ __attribute__((dllexport)) -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_IMPORT \ +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT \ __attribute__((dllimport)) #else -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_EXPORT __declspec(dllexport) -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_IMPORT __declspec(dllimport) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT __declspec(dllexport) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT __declspec(dllimport) #endif -#ifdef OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_BUILDING_DLL -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC \ - OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_EXPORT +#ifdef TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_BUILDING_DLL +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC \ + TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT #else -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC \ - OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_IMPORT +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC \ + TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT #endif -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC_TYPE \ - OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_LOCAL +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC_TYPE \ + TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL #else -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_EXPORT \ +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT \ __attribute__((visibility("default"))) -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_IMPORT +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT #if __GNUC__ >= 4 -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC \ +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC \ __attribute__((visibility("default"))) -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_LOCAL \ +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL \ __attribute__((visibility("hidden"))) #else -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_LOCAL +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL #endif -#define OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC_TYPE +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC_TYPE #endif #if __cplusplus @@ -72,16 +72,16 @@ extern "C" { #include #include -namespace openscenario_visualization +namespace traffic_simulator { /** * @brief ROS 2 component for visualizing simulation result. */ -class OpenscenarioVisualizationComponent : public rclcpp::Node +class VisualizationComponent : public rclcpp::Node { public: - OPENSCENARIO_VISUALIZATION_OPENSCENARIO_VISUALIZATION_COMPONENT_PUBLIC - explicit OpenscenarioVisualizationComponent(const rclcpp::NodeOptions &); + TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC + explicit VisualizationComponent(const rclcpp::NodeOptions &); private: /** @@ -128,6 +128,6 @@ class OpenscenarioVisualizationComponent : public rclcpp::Node */ std::unordered_map markers_; }; -} // namespace openscenario_visualization +} // namespace traffic_simulator -#endif // OPENSCENARIO_VISUALIZATION__OPENSCENARIO_VISUALIZATION_COMPONENT_HPP_ +#endif // TRAFFIC_SIMULATOR__VISUALIZATION__VISUALIZATION_COMPONENT_HPP_ diff --git a/openscenario/openscenario_visualization/src/openscenario_visualization_component.cpp b/simulation/traffic_simulator/src/visualization/visualization_component.cpp similarity index 96% rename from openscenario/openscenario_visualization/src/openscenario_visualization_component.cpp rename to simulation/traffic_simulator/src/visualization/visualization_component.cpp index 913553e50ff..571b6963af5 100644 --- a/openscenario/openscenario_visualization/src/openscenario_visualization_component.cpp +++ b/simulation/traffic_simulator/src/visualization/visualization_component.cpp @@ -53,9 +53,9 @@ #include #include -namespace openscenario_visualization +namespace traffic_simulator { -OpenscenarioVisualizationComponent::OpenscenarioVisualizationComponent( +VisualizationComponent::VisualizationComponent( const rclcpp::NodeOptions & options) : Node("openscenario_visualization", options) { @@ -64,10 +64,10 @@ OpenscenarioVisualizationComponent::OpenscenarioVisualizationComponent( this->create_subscription( "entity/status", 1, std::bind( - &OpenscenarioVisualizationComponent::entityStatusCallback, this, std::placeholders::_1)); + &VisualizationComponent::entityStatusCallback, this, std::placeholders::_1)); } -void OpenscenarioVisualizationComponent::entityStatusCallback( +void VisualizationComponent::entityStatusCallback( const traffic_simulator_msgs::msg::EntityStatusWithTrajectoryArray::ConstSharedPtr msg) { visualization_msgs::msg::MarkerArray current_marker; @@ -100,7 +100,7 @@ void OpenscenarioVisualizationComponent::entityStatusCallback( marker_pub_->publish(current_marker); } -const visualization_msgs::msg::MarkerArray OpenscenarioVisualizationComponent::generateDeleteMarker( +const visualization_msgs::msg::MarkerArray VisualizationComponent::generateDeleteMarker( std::string ns) { auto ret = visualization_msgs::msg::MarkerArray(); @@ -117,7 +117,7 @@ const visualization_msgs::msg::MarkerArray OpenscenarioVisualizationComponent::g return ret; } -const visualization_msgs::msg::MarkerArray OpenscenarioVisualizationComponent::generateMarker( +const visualization_msgs::msg::MarkerArray VisualizationComponent::generateMarker( const traffic_simulator_msgs::msg::EntityStatus & status, const std::vector & goal_pose, const traffic_simulator_msgs::msg::WaypointsArray & waypoints, @@ -450,7 +450,7 @@ const visualization_msgs::msg::MarkerArray OpenscenarioVisualizationComponent::g } const visualization_msgs::msg::MarkerArray -OpenscenarioVisualizationComponent::generateDeleteMarker() const +VisualizationComponent::generateDeleteMarker() const { visualization_msgs::msg::MarkerArray ret; visualization_msgs::msg::Marker marker; @@ -458,6 +458,6 @@ OpenscenarioVisualizationComponent::generateDeleteMarker() const ret.markers.emplace_back(marker); return ret; } -} // namespace openscenario_visualization +} // namespace traffic_simulator -RCLCPP_COMPONENTS_REGISTER_NODE(openscenario_visualization::OpenscenarioVisualizationComponent) +RCLCPP_COMPONENTS_REGISTER_NODE(traffic_simulator::VisualizationComponent) diff --git a/openscenario/openscenario_visualization/src/openscenario_visualization_node.cpp b/simulation/traffic_simulator/src/visualization/visualization_node.cpp similarity index 90% rename from openscenario/openscenario_visualization/src/openscenario_visualization_node.cpp rename to simulation/traffic_simulator/src/visualization/visualization_node.cpp index afd9a99134d..fc4c500ca8e 100644 --- a/openscenario/openscenario_visualization/src/openscenario_visualization_node.cpp +++ b/simulation/traffic_simulator/src/visualization/visualization_node.cpp @@ -42,7 +42,7 @@ */ #include -#include +#include #include int main(int argc, char * argv[]) @@ -50,7 +50,7 @@ int main(int argc, char * argv[]) rclcpp::init(argc, argv); rclcpp::NodeOptions options; auto component = - std::make_shared(options); + std::make_shared(options); rclcpp::spin(component->get_node_base_interface()); rclcpp::shutdown(); return 0; diff --git a/test_runner/random_test_runner/launch/random_test.launch.py b/test_runner/random_test_runner/launch/random_test.launch.py index 7d67f58c712..55cb1629cbc 100644 --- a/test_runner/random_test_runner/launch/random_test.launch.py +++ b/test_runner/random_test_runner/launch/random_test.launch.py @@ -218,10 +218,10 @@ def launch_setup(self, context, *args, **kwargs): scenario_node, RegisterEventHandler(event_handler=shutdown_handler), Node( - package="openscenario_visualization", - executable="openscenario_visualization_node", + package="traffic_simulator", + executable="visualization_node", namespace="simulation", - name="openscenario_visualizer", + name="visualizer", output="screen", ), ] diff --git a/test_runner/scenario_test_runner/launch/scenario_test_runner.launch.py b/test_runner/scenario_test_runner/launch/scenario_test_runner.launch.py index ae0b1e34b43..fc6703d0a3d 100755 --- a/test_runner/scenario_test_runner/launch/scenario_test_runner.launch.py +++ b/test_runner/scenario_test_runner/launch/scenario_test_runner.launch.py @@ -199,10 +199,10 @@ def description(): on_exit=ShutdownOnce(), ), Node( - package="openscenario_visualization", - executable="openscenario_visualization_node", + package="traffic_simulator", + executable="visualization_node", namespace="simulation", - name="openscenario_visualizer", + name="visualizer", output="screen", ), Node( From ef3e359b4da14e5aa7bf1f2e45f93a8c126af0cf Mon Sep 17 00:00:00 2001 From: Masaya Kataoka Date: Mon, 19 Feb 2024 13:06:16 +0900 Subject: [PATCH 2/4] fix package path --- simulation/traffic_simulator/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simulation/traffic_simulator/CMakeLists.txt b/simulation/traffic_simulator/CMakeLists.txt index 6f967c68485..a561cf83ccf 100644 --- a/simulation/traffic_simulator/CMakeLists.txt +++ b/simulation/traffic_simulator/CMakeLists.txt @@ -59,11 +59,11 @@ ament_auto_add_library(traffic_simulator SHARED ) ament_auto_add_library(visualization_component SHARED - src/visualization_component.cpp + src/visualization/visualization_component.cpp ) ament_auto_add_executable(visualization_node - src/visualization_node.cpp + src/visualization/visualization_node.cpp ) target_link_libraries(visualization_node visualization_component) From 90317e3fa66532e64d2bb32af3484fa2b265c57d Mon Sep 17 00:00:00 2001 From: Masaya Kataoka Date: Mon, 19 Feb 2024 13:53:34 +0900 Subject: [PATCH 3/4] apply reformat Signed-off-by: Masaya Kataoka --- .../include/traffic_simulator/api/api.hpp | 2 +- .../traffic_simulator/entity/entity_base.hpp | 4 ++-- .../traffic_simulator/entity/entity_manager.hpp | 4 ++-- .../visualization/visualization_component.hpp | 15 +++++---------- .../src/visualization/visualization_component.cpp | 13 +++++-------- .../src/visualization/visualization_node.cpp | 5 ++--- 6 files changed, 17 insertions(+), 26 deletions(-) diff --git a/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp b/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp index 86843200f1d..1c27a73d5c2 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/api/api.hpp @@ -286,7 +286,7 @@ class API const lane_change::TrajectoryShape trajectory_shape, const lane_change::Constraint & constraint); -// clang-format off + // clang-format off #define FORWARD_TO_ENTITY_MANAGER(NAME) \ /*! \ @brief Forward to arguments to the EntityManager::NAME function. \ diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp index 81399e55e91..33522fc5004 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_base.hpp @@ -61,7 +61,7 @@ class EntityBase virtual void cancelRequest(); -// clang-format off + // clang-format off #define DEFINE_GETTER(NAME, TYPE, RETURN_VARIABLE) \ /** \ @brief Get NAME of the entity. \ @@ -84,7 +84,7 @@ class EntityBase // clang-format on #undef DEFINE_GETTER -// clang-format off + // clang-format off #define DEFINE_CHECK_FUNCTION(FUNCTION_NAME, BOOL_VARIABLE) \ /** \ @note This function was defined by DEFINE_CHECK_FUNCTION function. \ diff --git a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp index 0359bb27b28..be302d83f0a 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/entity/entity_manager.hpp @@ -243,7 +243,7 @@ class EntityManager } } -// clang-format off + // clang-format off #define FORWARD_TO_HDMAP_UTILS(NAME) \ /*! \ @brief Forward to arguments to the HDMapUtils::NAME function. \ @@ -264,7 +264,7 @@ class EntityManager #undef FORWARD_TO_HDMAP_UTILS -// clang-format off + // clang-format off #define FORWARD_TO_ENTITY(IDENTIFIER, ...) \ /*! \ @brief Forward to arguments to the EntityBase::IDENTIFIER function. \ diff --git a/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp b/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp index 5600eff60f1..f136192e043 100644 --- a/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp +++ b/simulation/traffic_simulator/include/traffic_simulator/visualization/visualization_component.hpp @@ -27,10 +27,8 @@ extern "C" { // demos/composition/include/composition/visibility_control.h at https://github.com/ros2/demos #if defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ -#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT \ - __attribute__((dllexport)) -#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT \ - __attribute__((dllimport)) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT __attribute__((dllexport)) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT __attribute__((dllimport)) #else #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT __declspec(dllexport) #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT __declspec(dllimport) @@ -46,14 +44,11 @@ extern "C" { TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL #else -#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT \ - __attribute__((visibility("default"))) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_EXPORT __attribute__((visibility("default"))) #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_IMPORT #if __GNUC__ >= 4 -#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC \ - __attribute__((visibility("default"))) -#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL \ - __attribute__((visibility("hidden"))) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC __attribute__((visibility("default"))) +#define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL __attribute__((visibility("hidden"))) #else #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_PUBLIC #define TRAFFIC_SIMULATOR_VISUALIZATION_COMPONENT_LOCAL diff --git a/simulation/traffic_simulator/src/visualization/visualization_component.cpp b/simulation/traffic_simulator/src/visualization/visualization_component.cpp index 571b6963af5..8c722c73d2e 100644 --- a/simulation/traffic_simulator/src/visualization/visualization_component.cpp +++ b/simulation/traffic_simulator/src/visualization/visualization_component.cpp @@ -48,23 +48,21 @@ #include #include #include -#include #include #include +#include #include namespace traffic_simulator { -VisualizationComponent::VisualizationComponent( - const rclcpp::NodeOptions & options) -: Node("openscenario_visualization", options) +VisualizationComponent::VisualizationComponent(const rclcpp::NodeOptions & options) +: Node("visualization", options) { marker_pub_ = create_publisher("entity/marker", 1); entity_status_sub_ = this->create_subscription( "entity/status", 1, - std::bind( - &VisualizationComponent::entityStatusCallback, this, std::placeholders::_1)); + std::bind(&VisualizationComponent::entityStatusCallback, this, std::placeholders::_1)); } void VisualizationComponent::entityStatusCallback( @@ -449,8 +447,7 @@ const visualization_msgs::msg::MarkerArray VisualizationComponent::generateMarke return ret; } -const visualization_msgs::msg::MarkerArray -VisualizationComponent::generateDeleteMarker() const +const visualization_msgs::msg::MarkerArray VisualizationComponent::generateDeleteMarker() const { visualization_msgs::msg::MarkerArray ret; visualization_msgs::msg::Marker marker; diff --git a/simulation/traffic_simulator/src/visualization/visualization_node.cpp b/simulation/traffic_simulator/src/visualization/visualization_node.cpp index fc4c500ca8e..dc768ad887e 100644 --- a/simulation/traffic_simulator/src/visualization/visualization_node.cpp +++ b/simulation/traffic_simulator/src/visualization/visualization_node.cpp @@ -42,15 +42,14 @@ */ #include -#include #include +#include int main(int argc, char * argv[]) { rclcpp::init(argc, argv); rclcpp::NodeOptions options; - auto component = - std::make_shared(options); + auto component = std::make_shared(options); rclcpp::spin(component->get_node_base_interface()); rclcpp::shutdown(); return 0; From 47624b7870af10c7c8ccc74e64a10e9a01d8e8df Mon Sep 17 00:00:00 2001 From: Masaya Kataoka Date: Mon, 19 Feb 2024 14:07:27 +0900 Subject: [PATCH 4/4] add include Signed-off-by: Masaya Kataoka --- .../src/visualization/visualization_component.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/simulation/traffic_simulator/src/visualization/visualization_component.cpp b/simulation/traffic_simulator/src/visualization/visualization_component.cpp index 8c722c73d2e..8e708d367e2 100644 --- a/simulation/traffic_simulator/src/visualization/visualization_component.cpp +++ b/simulation/traffic_simulator/src/visualization/visualization_component.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include