Skip to content

Commit

Permalink
Merge branch 'main' into feat/lane_change_stop_wall
Browse files Browse the repository at this point in the history
  • Loading branch information
rej55 committed Aug 31, 2023
2 parents 649c1c5 + 2df7540 commit 0f69b60
Show file tree
Hide file tree
Showing 46 changed files with 1,112 additions and 536 deletions.
5 changes: 3 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ common/component_interface_tools/** isamu.takagi@tier4.jp kahhooi.tan@tier4.jp m
common/component_interface_utils/** isamu.takagi@tier4.jp kahhooi.tan@tier4.jp makoto.yabuta@tier4.jp yukihiro.saito@tier4.jp
common/cuda_utils/** daisuke.nishimatsu@tier4.jp manato.hirabayashi@tier4.jp
common/fake_test_node/** opensource@apex.ai satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp tomoya.kimura@tier4.jp
common/geography_utils/** koji.minoda@tier4.jp
common/global_parameter_loader/** ryohsuke.mitsudome@tier4.jp
common/glog_component/** takamasa.horibe@tier4.jp
common/goal_distance_calculator/** taiki.tanaka@tier4.jp
Expand Down Expand Up @@ -117,7 +118,7 @@ perception/lidar_apollo_segmentation_tvm/** ambroise.vincent@arm.com xinyu.wang@
perception/lidar_apollo_segmentation_tvm_nodes/** ambroise.vincent@arm.com xinyu.wang@tier4.jp
perception/lidar_centerpoint/** kenzo.lobos@tier4.jp yusuke.muramatsu@tier4.jp
perception/lidar_centerpoint_tvm/** carl.liu@autocore.ai xinyu.wang@tier4.jp
perception/map_based_prediction/** shunsuke.miura@tier4.jp tomoya.kimura@tier4.jp yoshi.ri@tier4.jp yutaka.shimizu@tier4.jp
perception/map_based_prediction/** kyoichi.sugahara@tier4.jp shunsuke.miura@tier4.jp takayuki.murooka@tier4.jp tomoya.kimura@tier4.jp yoshi.ri@tier4.jp yutaka.shimizu@tier4.jp
perception/multi_object_tracker/** yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
perception/object_merger/** yoshi.ri@tier4.jp yukihiro.saito@tier4.jp
perception/object_range_splitter/** yukihiro.saito@tier4.jp
Expand Down Expand Up @@ -166,7 +167,7 @@ planning/freespace_planning_algorithms/** kosuke.takeuchi@tier4.jp takamasa.hori
planning/mission_planner/** isamu.takagi@tier4.jp kosuke.takeuchi@tier4.jp ryohsuke.mitsudome@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp yutaka.shimizu@tier4.jp
planning/motion_velocity_smoother/** fumiya.watanabe@tier4.jp makoto.kurihara@tier4.jp takamasa.horibe@tier4.jp yutaka.shimizu@tier4.jp
planning/obstacle_avoidance_planner/** kosuke.takeuchi@tier4.jp takamasa.horibe@tier4.jp takayuki.murooka@tier4.jp
planning/obstacle_cruise_planner/** takayuki.murooka@tier4.jp yutaka.shimizu@tier4.jp
planning/obstacle_cruise_planner/** kosuke.takeuchi@tier4.jp satoshi.ota@tier4.jp takayuki.murooka@tier4.jp yutaka.shimizu@tier4.jp
planning/obstacle_stop_planner/** berkay@leodrive.ai satoshi.ota@tier4.jp shumpei.wakabayashi@tier4.jp taiki.tanaka@tier4.jp tomoya.kimura@tier4.jp
planning/obstacle_velocity_limiter/** maxime.clement@tier4.jp
planning/path_smoother/** maxime.clement@tier4.jp takayuki.murooka@tier4.jp
Expand Down
35 changes: 35 additions & 0 deletions common/geography_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.14)
project(geography_utils)

find_package(autoware_cmake REQUIRED)
autoware_package()

# GeographicLib
find_package(PkgConfig)
find_path(GeographicLib_INCLUDE_DIR GeographicLib/Config.h
PATH_SUFFIXES GeographicLib
)
set(GeographicLib_INCLUDE_DIRS ${GeographicLib_INCLUDE_DIR})
find_library(GeographicLib_LIBRARIES NAMES Geographic)

ament_auto_add_library(geography_utils SHARED
src/height.cpp
)

target_link_libraries(geography_utils
${GeographicLib_LIBRARIES}
)

if(BUILD_TESTING)
find_package(ament_cmake_ros REQUIRED)

file(GLOB_RECURSE test_files test/*.cpp)

ament_add_ros_isolated_gtest(test_geography_utils ${test_files})

target_link_libraries(test_geography_utils
geography_utils
)
endif()

ament_auto_package()
5 changes: 5 additions & 0 deletions common/geography_utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# geography_utils

## Purpose

This package contains geography-related functions used by other packages, so please refer to them as needed.
36 changes: 36 additions & 0 deletions common/geography_utils/include/geography_utils/height.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2023 TIER 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 GEOGRAPHY_UTILS__HEIGHT_HPP_
#define GEOGRAPHY_UTILS__HEIGHT_HPP_

#include <map>
#include <stdexcept>
#include <string>
#include <utility>

namespace geography_utils
{

typedef double (*HeightConversionFunction)(
const double height, const double latitude, const double longitude);
double convert_wgs84_to_egm2008(const double height, const double latitude, const double longitude);
double convert_egm2008_to_wgs84(const double height, const double latitude, const double longitude);
double convert_height(
const double height, const double latitude, const double longitude,
const std::string & source_vertical_datum, const std::string & target_vertical_datum);

} // namespace geography_utils

#endif // GEOGRAPHY_UTILS__HEIGHT_HPP_
22 changes: 22 additions & 0 deletions common/geography_utils/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>geography_utils</name>
<version>0.1.0</version>
<description>The geography_utils package</description>
<maintainer email="koji.minoda@tier4.jp">Koji Minoda</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>geographiclib</depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
63 changes: 63 additions & 0 deletions common/geography_utils/src/height.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2023 TIER 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 <GeographicLib/Geoid.hpp>
#include <geography_utils/height.hpp>

#include <map>
#include <stdexcept>
#include <string>
#include <utility>

namespace geography_utils
{

double convert_wgs84_to_egm2008(const double height, const double latitude, const double longitude)
{
GeographicLib::Geoid egm2008("egm2008-1");
// cSpell: ignore ELLIPSOIDTOGEOID
return egm2008.ConvertHeight(latitude, longitude, height, GeographicLib::Geoid::ELLIPSOIDTOGEOID);
}

double convert_egm2008_to_wgs84(const double height, const double latitude, const double longitude)
{
GeographicLib::Geoid egm2008("egm2008-1");
// cSpell: ignore GEOIDTOELLIPSOID
return egm2008.ConvertHeight(latitude, longitude, height, GeographicLib::Geoid::GEOIDTOELLIPSOID);
}

double convert_height(
const double height, const double latitude, const double longitude,
const std::string & source_vertical_datum, const std::string & target_vertical_datum)
{
if (source_vertical_datum == target_vertical_datum) {
return height;
}
std::map<std::pair<std::string, std::string>, HeightConversionFunction> conversion_map;
conversion_map[{"WGS84", "EGM2008"}] = convert_wgs84_to_egm2008;
conversion_map[{"EGM2008", "WGS84"}] = convert_egm2008_to_wgs84;

auto key = std::make_pair(source_vertical_datum, target_vertical_datum);
if (conversion_map.find(key) != conversion_map.end()) {
return conversion_map[key](height, latitude, longitude);
} else {
std::string error_message =
"Invalid conversion types: " + std::string(source_vertical_datum.c_str()) + " to " +
std::string(target_vertical_datum.c_str());

throw std::invalid_argument(error_message);
}
}

} // namespace geography_utils
92 changes: 92 additions & 0 deletions common/geography_utils/test/test_height.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright 2023 TIER 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 <geography_utils/height.hpp>

#include <gtest/gtest.h>

#include <stdexcept>
#include <string>

// Test case to verify if same source and target datums return original height
TEST(Tier4GeographyUtils, SameSourceTargetDatum)
{
const double height = 10.0;
const double latitude = 35.0;
const double longitude = 139.0;
const std::string datum = "WGS84";

double converted_height =
geography_utils::convert_height(height, latitude, longitude, datum, datum);

EXPECT_DOUBLE_EQ(height, converted_height);
}

// Test case to verify valid source and target datums
TEST(Tier4GeographyUtils, ValidSourceTargetDatum)
{
// Calculated with
// https://www.unavco.org/software/geodetic-utilities/geoid-height-calculator/geoid-height-calculator.html
const double height = 10.0;
const double latitude = 35.0;
const double longitude = 139.0;
const double target_height = -30.18;

double converted_height =
geography_utils::convert_height(height, latitude, longitude, "WGS84", "EGM2008");

EXPECT_NEAR(target_height, converted_height, 0.1);
}

// Test case to verify invalid source and target datums
TEST(Tier4GeographyUtils, InvalidSourceTargetDatum)
{
const double height = 10.0;
const double latitude = 35.0;
const double longitude = 139.0;

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "INVALID2"),
std::invalid_argument);
}

// Test case to verify invalid source datums
TEST(Tier4GeographyUtils, InvalidSourceDatum)
{
const double height = 10.0;
const double latitude = 35.0;
const double longitude = 139.0;

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "INVALID1", "WGS84"),
std::invalid_argument);
}

// Test case to verify invalid target datums
TEST(Tier4GeographyUtils, InvalidTargetDatum)
{
const double height = 10.0;
const double latitude = 35.0;
const double longitude = 139.0;

EXPECT_THROW(
geography_utils::convert_height(height, latitude, longitude, "WGS84", "INVALID2"),
std::invalid_argument);
}

int main(int argc, char ** argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<arg name="traffic_light_classifier_model_name" default="traffic_light_classifier_mobilenetv2_batch_6.onnx" description="classifier onnx model filename"/>
<arg name="input/cloud" default="/sensing/lidar/top/pointcloud_raw" description="point cloud for occlusion prediction"/>
<arg name="internal/traffic_signals" default="/perception/traffic_light_recognition/internal/traffic_signals"/>
<arg name="fusion/traffic_signals" default="/perception/traffic_light_recognition/fusion/traffic_signals"/>
<arg name="external/traffic_signals" default="/perception/traffic_light_recognition/external/traffic_signals"/>
<arg name="output/traffic_signals" default="/perception/traffic_light_recognition/traffic_signals"/>
<arg name="use_crosswalk_traffic_light_estimator" default="true" description="output pedestrian's traffic light signals"/>
Expand Down Expand Up @@ -70,7 +71,7 @@
<arg name="input/camera_info" value="$(var input/camera_info)"/>
<arg name="input/cloud" value="$(var input/cloud)"/>
<arg name="input/rois" value="$(var output/rois1)"/>
<arg name="input/traffic_signals" value="estimated/traffic_signals"/>
<arg name="input/traffic_signals" value="classified/traffic_signals"/>
<arg name="output/traffic_signals" value="$(var output/traffic_signals1)"/>
</include>
</group>
Expand Down Expand Up @@ -120,7 +121,7 @@
<arg name="input/camera_info" value="$(var input/camera_info)"/>
<arg name="input/cloud" value="$(var input/cloud)"/>
<arg name="input/rois" value="$(var output/rois2)"/>
<arg name="input/traffic_signals" value="estimated/traffic_signals"/>
<arg name="input/traffic_signals" value="classified/traffic_signals"/>
<arg name="output/traffic_signals" value="$(var output/traffic_signals2)"/>
</include>
</group>
Expand All @@ -132,9 +133,27 @@
<param name="camera_namespaces" value="$(var all_camera_namespaces)"/>
<param name="perform_group_fusion" value="true"/>
<remap from="~/input/vector_map" to="/map/vector_map"/>
<remap from="~/output/traffic_signals" to="$(var fusion/traffic_signals)"/>
</node>
</group>

<group if="$(var use_crosswalk_traffic_light_estimator)">
<node pkg="crosswalk_traffic_light_estimator" exec="crosswalk_traffic_light_estimator_node" name="crosswalk_traffic_light_estimator" output="screen">
<remap from="~/input/vector_map" to="/map/vector_map"/>
<remap from="~/input/route" to="/planning/mission_planning/route"/>
<remap from="~/input/classified/traffic_signals" to="$(var fusion/traffic_signals)"/>
<remap from="~/output/traffic_signals" to="$(var internal/traffic_signals)"/>
</node>
</group>

<group unless="$(var use_crosswalk_traffic_light_estimator)">
<node pkg="topic_tools" exec="relay" name="fusion_signals_relay" output="screen">
<param name="input_topic" value="$(var fusion/traffic_signals)"/>
<param name="output_topic" value="$(var internal/traffic_signals)"/>
<param name="type" value="autoware_auto_perception_msgs/msg/TrafficSignalArray"/>
</node>
</group>

<!-- V2X fusion -->
<group>
<include file="$(find-pkg-share traffic_light_arbiter)/launch/traffic_light_arbiter.launch.xml">
Expand Down
Loading

0 comments on commit 0f69b60

Please sign in to comment.