diff --git a/nebula_examples/CMakeLists.txt b/nebula_examples/CMakeLists.txt index aee322eaa..5072a5f76 100644 --- a/nebula_examples/CMakeLists.txt +++ b/nebula_examples/CMakeLists.txt @@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.5) project(nebula_examples) # Default to C++17 -if (NOT CMAKE_CXX_STANDARD) +if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) -endif () +endif() -if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic -Wunused-function) -endif () +endif() find_package(ament_cmake_auto REQUIRED) find_package(PCL REQUIRED COMPONENTS common) @@ -31,31 +31,31 @@ include_directories( # Offline Lib ament_auto_add_library(hesai_ros_offline_extract_pcd SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/hesai/hesai_ros_offline_extract_pcd.cpp - ) +) target_link_libraries(hesai_ros_offline_extract_pcd ${PCL_LIBRARIES}) ament_auto_add_executable(hesai_ros_offline_extract_pcd_node ${CMAKE_CURRENT_SOURCE_DIR}/src/hesai/hesai_ros_offline_extract_pcd_main.cpp - ) +) # Extraction for TEST Lib ament_auto_add_library(hesai_ros_offline_extract_bag_pcd SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp - ) +) target_link_libraries(hesai_ros_offline_extract_bag_pcd ${PCL_LIBRARIES}) ament_auto_add_executable(hesai_ros_offline_extract_bag_pcd_node ${CMAKE_CURRENT_SOURCE_DIR}/src/hesai/hesai_ros_offline_extract_bag_pcd_main.cpp - ) +) ## Velodyne # Extraction for TEST Lib ament_auto_add_library(velodyne_ros_offline_extract_bag_pcd SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/velodyne/velodyne_ros_offline_extract_bag_pcd.cpp - ) +) target_link_libraries(velodyne_ros_offline_extract_bag_pcd ${PCL_LIBRARIES}) ament_auto_add_executable(velodyne_ros_offline_extract_bag_pcd_node ${CMAKE_CURRENT_SOURCE_DIR}/src/velodyne/velodyne_ros_offline_extract_bag_pcd_main.cpp - ) +) -if (BUILD_TESTING) +if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() endif() diff --git a/nebula_examples/include/hesai/hesai_ros_offline_extract_bag_pcd.hpp b/nebula_examples/include/hesai/hesai_ros_offline_extract_bag_pcd.hpp index 7a4b48307..a7681323c 100644 --- a/nebula_examples/include/hesai/hesai_ros_offline_extract_bag_pcd.hpp +++ b/nebula_examples/include/hesai/hesai_ros_offline_extract_bag_pcd.hpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #ifndef NEBULA_HesaiRosOfflineExtractBag_H #define NEBULA_HesaiRosOfflineExtractBag_H @@ -14,6 +28,9 @@ #include "pandar_msgs/msg/pandar_packet.hpp" #include "pandar_msgs/msg/pandar_scan.hpp" +#include +#include + namespace nebula { namespace ros diff --git a/nebula_examples/include/hesai/hesai_ros_offline_extract_pcd.hpp b/nebula_examples/include/hesai/hesai_ros_offline_extract_pcd.hpp index 596bed2c6..711502e6a 100644 --- a/nebula_examples/include/hesai/hesai_ros_offline_extract_pcd.hpp +++ b/nebula_examples/include/hesai/hesai_ros_offline_extract_pcd.hpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #ifndef NEBULA_HesaiRosOfflineExtractSample_H #define NEBULA_HesaiRosOfflineExtractSample_H @@ -14,6 +28,9 @@ #include "pandar_msgs/msg/pandar_packet.hpp" #include "pandar_msgs/msg/pandar_scan.hpp" +#include +#include + namespace nebula { namespace ros diff --git a/nebula_examples/include/velodyne/velodyne_ros_offline_extract_bag_pcd.hpp b/nebula_examples/include/velodyne/velodyne_ros_offline_extract_bag_pcd.hpp index 96c4863c7..7818a050d 100644 --- a/nebula_examples/include/velodyne/velodyne_ros_offline_extract_bag_pcd.hpp +++ b/nebula_examples/include/velodyne/velodyne_ros_offline_extract_bag_pcd.hpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #ifndef NEBULA_VelodyneRosOfflineExtractBag_H #define NEBULA_VelodyneRosOfflineExtractBag_H @@ -26,6 +40,9 @@ #include +#include +#include + namespace nebula { namespace ros diff --git a/nebula_examples/package.xml b/nebula_examples/package.xml index ab6d61eb7..6f1163279 100644 --- a/nebula_examples/package.xml +++ b/nebula_examples/package.xml @@ -28,6 +28,9 @@ velodyne_msgs yaml-cpp + ament_lint_auto + ament_lint_common + ament_cmake diff --git a/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp b/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp index a01fd560d..9c1266347 100644 --- a/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp +++ b/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "hesai/hesai_ros_offline_extract_bag_pcd.hpp" #include "rclcpp/serialization.hpp" @@ -78,7 +92,7 @@ Status HesaiRosOfflineExtractBag::InitializeDriver( return driver_ptr_->GetStatus(); } -Status HesaiRosOfflineExtractBag::GetStatus() { return wrapper_status_; } +Status HesaiRosOfflineExtractBag::GetStatus() {return wrapper_status_;} Status HesaiRosOfflineExtractBag::GetParameters( drivers::HesaiSensorConfiguration & sensor_configuration, @@ -105,7 +119,7 @@ Status HesaiRosOfflineExtractBag::GetParameters( sensor_configuration.return_mode = // nebula::drivers::ReturnModeFromString(this->get_parameter("return_mode").as_string()); nebula::drivers::ReturnModeFromStringHesai( - this->get_parameter("return_mode").as_string(), sensor_configuration.sensor_model); + this->get_parameter("return_mode").as_string(), sensor_configuration.sensor_model); } { rcl_interfaces::msg::ParameterDescriptor descriptor; @@ -290,7 +304,7 @@ Status HesaiRosOfflineExtractBag::ReadBag() bool needs_open = true; storage_options.uri = bag_path; storage_options.storage_id = storage_id; - converter_options.output_serialization_format = format; //"cdr"; + converter_options.output_serialization_format = format; // "cdr"; { rosbag2_cpp::Reader reader(std::make_unique()); // reader.open(rosbag_directory.string()); @@ -329,7 +343,7 @@ Status HesaiRosOfflineExtractBag::ReadBag() writer_->open(storage_options_w, converter_options_w); writer_->create_topic( {bag_message->topic_name, "pandar_msgs/msg/PandarScan", rmw_get_serialization_format(), - ""}); + ""}); needs_open = false; } writer_->write(bag_message); diff --git a/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd_main.cpp b/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd_main.cpp index c6ced79de..f0eed5055 100644 --- a/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd_main.cpp +++ b/nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd_main.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "hesai/hesai_ros_offline_extract_bag_pcd.hpp" #include diff --git a/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd.cpp b/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd.cpp index 769d6ad79..a57d9b96e 100644 --- a/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd.cpp +++ b/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "hesai/hesai_ros_offline_extract_pcd.hpp" #include "rclcpp/serialization.hpp" @@ -7,9 +21,8 @@ #include "rosbag2_cpp/reader.hpp" #include "rosbag2_cpp/readers/sequential_reader.hpp" #include "rosbag2_storage/storage_options.hpp" -//#include -//#include -#include "rcpputils/filesystem_helper.hpp" +// #include +// #include #include @@ -79,7 +92,7 @@ Status HesaiRosOfflineExtractSample::InitializeDriver( return driver_ptr_->GetStatus(); } -Status HesaiRosOfflineExtractSample::GetStatus() { return wrapper_status_; } +Status HesaiRosOfflineExtractSample::GetStatus() {return wrapper_status_;} Status HesaiRosOfflineExtractSample::GetParameters( drivers::HesaiSensorConfiguration & sensor_configuration, @@ -106,7 +119,7 @@ Status HesaiRosOfflineExtractSample::GetParameters( sensor_configuration.return_mode = // nebula::drivers::ReturnModeFromString(this->get_parameter("return_mode").as_string()); nebula::drivers::ReturnModeFromStringHesai( - this->get_parameter("return_mode").as_string(), sensor_configuration.sensor_model); + this->get_parameter("return_mode").as_string(), sensor_configuration.sensor_model); } { rcl_interfaces::msg::ParameterDescriptor descriptor; @@ -259,7 +272,7 @@ Status HesaiRosOfflineExtractSample::ReadBag() storage_options.uri = bag_path; storage_options.storage_id = storage_id; - converter_options.output_serialization_format = format; //"cdr"; + converter_options.output_serialization_format = format; // "cdr"; { rosbag2_cpp::Reader reader(std::make_unique()); // reader.open(rosbag_directory.string()); diff --git a/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd_main.cpp b/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd_main.cpp index 616519a65..b504605e6 100644 --- a/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd_main.cpp +++ b/nebula_examples/src/hesai/hesai_ros_offline_extract_pcd_main.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "hesai/hesai_ros_offline_extract_pcd.hpp" #include diff --git a/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd.cpp b/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd.cpp index 54e09e5a7..913898b7c 100644 --- a/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd.cpp +++ b/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "velodyne/velodyne_ros_offline_extract_bag_pcd.hpp" namespace nebula @@ -42,7 +56,7 @@ Status VelodyneRosOfflineExtractBag::InitializeDriver( return driver_ptr_->GetStatus(); } -Status VelodyneRosOfflineExtractBag::GetStatus() { return wrapper_status_; } +Status VelodyneRosOfflineExtractBag::GetStatus() {return wrapper_status_;} Status VelodyneRosOfflineExtractBag::GetParameters( drivers::VelodyneSensorConfiguration & sensor_configuration, @@ -300,7 +314,7 @@ Status VelodyneRosOfflineExtractBag::ReadBag() bool needs_open = true; storage_options.uri = bag_path; storage_options.storage_id = storage_id; - converter_options.output_serialization_format = format; //"cdr"; + converter_options.output_serialization_format = format; // "cdr"; { rosbag2_cpp::Reader reader(std::make_unique()); reader.open(storage_options, converter_options); @@ -338,7 +352,7 @@ Status VelodyneRosOfflineExtractBag::ReadBag() writer_->open(storage_options_w, converter_options_w); writer_->create_topic( {bag_message->topic_name, "velodyne_msgs/msg/VelodyneScan", - rmw_get_serialization_format(), ""}); + rmw_get_serialization_format(), ""}); needs_open = false; } writer_->write(bag_message); diff --git a/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd_main.cpp b/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd_main.cpp index f8338ca03..bea1fc950 100644 --- a/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd_main.cpp +++ b/nebula_examples/src/velodyne/velodyne_ros_offline_extract_bag_pcd_main.cpp @@ -1,3 +1,17 @@ +// Copyright 2023 Map IV, 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. + #include "velodyne/velodyne_ros_offline_extract_bag_pcd.hpp" #include