Skip to content

Commit

Permalink
Merge branch 'main' into generic-hesai-decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
amc-nu authored Sep 11, 2023
2 parents 45df6b6 + 918657b commit 29d3a16
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 58 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,3 @@ jobs:
verbose: true
flags: differential

clang-tidy-differential:
runs-on: ubuntu-latest
container: ros:humble
needs: build-and-test-differential
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1

- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1

- name: Get modified files
id: get-modified-files
uses: tj-actions/changed-files@v35
with:
files: |
**/*.cpp
**/*.hpp
- name: Run clang-tidy
if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
target-files: ${{ steps.get-modified-files.outputs.all_changed_files }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
build-depends-repos: build_depends.repos
22 changes: 11 additions & 11 deletions nebula_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,6 +28,9 @@
#include "pandar_msgs/msg/pandar_packet.hpp"
#include "pandar_msgs/msg/pandar_scan.hpp"

#include <memory>
#include <string>

namespace nebula
{
namespace ros
Expand Down
17 changes: 17 additions & 0 deletions nebula_examples/include/hesai/hesai_ros_offline_extract_pcd.hpp
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,6 +28,9 @@
#include "pandar_msgs/msg/pandar_packet.hpp"
#include "pandar_msgs/msg/pandar_scan.hpp"

#include <memory>
#include <string>

namespace nebula
{
namespace ros
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -26,6 +40,9 @@

#include <regex>

#include <memory>
#include <string>

namespace nebula
{
namespace ros
Expand Down
3 changes: 3 additions & 0 deletions nebula_examples/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<depend>velodyne_msgs</depend>
<depend>yaml-cpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
22 changes: 18 additions & 4 deletions nebula_examples/src/hesai/hesai_ros_offline_extract_bag_pcd.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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<rosbag2_cpp::readers::SequentialReader>());
// reader.open(rosbag_directory.string());
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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/rclcpp.hpp>
Expand Down
25 changes: 19 additions & 6 deletions nebula_examples/src/hesai/hesai_ros_offline_extract_pcd.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -7,9 +21,8 @@
#include "rosbag2_cpp/reader.hpp"
#include "rosbag2_cpp/readers/sequential_reader.hpp"
#include "rosbag2_storage/storage_options.hpp"
//#include <boost/filesystem/path.hpp>
//#include <boost/filesystem/operations.hpp>
#include "rcpputils/filesystem_helper.hpp"
// #include <boost/filesystem/path.hpp>
// #include <boost/filesystem/operations.hpp>

#include <regex>

Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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<rosbag2_cpp::readers::SequentialReader>());
// reader.open(rosbag_directory.string());
Expand Down
14 changes: 14 additions & 0 deletions nebula_examples/src/hesai/hesai_ros_offline_extract_pcd_main.cpp
Original file line number Diff line number Diff line change
@@ -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/rclcpp.hpp>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<rosbag2_cpp::readers::SequentialReader>());
reader.open(storage_options, converter_options);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <rclcpp/rclcpp.hpp>
Expand Down

0 comments on commit 29d3a16

Please sign in to comment.