Skip to content

Commit e90db5d

Browse files
authored
feat(driving_environment_analyzer): add new package (#13)
* feat(driving_environment_analyzer): add package Signed-off-by: satoshi-ota <[email protected]> * fix: typo Signed-off-by: satoshi-ota <[email protected]> * fix: rename func Signed-off-by: satoshi-ota <[email protected]> --------- Signed-off-by: satoshi-ota <[email protected]>
1 parent e48d519 commit e90db5d

File tree

6 files changed

+614
-0
lines changed

6 files changed

+614
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(driving_environment_analyzer)
3+
4+
find_package(autoware_cmake REQUIRED)
5+
autoware_package()
6+
7+
ament_auto_add_library(${PROJECT_NAME}_node SHARED
8+
DIRECTORY src
9+
)
10+
11+
rclcpp_components_register_node(${PROJECT_NAME}_node
12+
PLUGIN "driving_environment_analyzer::DrivingEnvironmentAnalyzer"
13+
EXECUTABLE driving_environment_analyzer
14+
)
15+
16+
ament_auto_package(
17+
INSTALL_TO_SHARE
18+
launch
19+
)
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Driving Environment Analyzer
2+
3+
このツールはROSBAGに含まれる走行履歴を元に走行環境のODDを解析するツールです。
4+
5+
## How to use
6+
7+
現在以下の情報が出力可能です。
8+
9+
- 走行経路の長さ
10+
- 走行経路の車線情報
11+
- 走行経路の最大・最小勾配
12+
- 走行経路の最大曲率
13+
- 走行経路の最大・最小車線幅
14+
- 交差点の有無
15+
- 信号機の有無
16+
- 横断歩道の有無
17+
18+
起動時に`bag_path`オプションで解析したいROSBAGを指定してください。(ディレクトリの指定も.db3ファイルの直接指定もサポートしています。)
19+
20+
解析に必要なtopicは以下のとおりです。(今後増える可能性もあります。)
21+
22+
- `/planning/mission_planning/route`
23+
- `/map/vector_map`
24+
25+
以下のようにlaunchすることでODDの解析結果が得られます。
26+
27+
`ros2 launch driving_environment_analyzer driving_environment_analyzer.launch.xml use_map_in_bag:=true bag_path:=<ROSBAG>`
28+
29+
```bash
30+
[component_container-1] [INFO 1708999777.768870564] [driving_environment_analyzer]: ======================================
31+
[component_container-1] [INFO 1708999777.768922452] [driving_environment_analyzer]: data is ready. start ODD analysis...
32+
[component_container-1] [INFO 1708999777.768933574] [driving_environment_analyzer]: ======================================
33+
[component_container-1] [INFO 1708999777.768967412] [driving_environment_analyzer]: - Length of total lanes : 2357.50 [m]
34+
[component_container-1] [INFO 1708999777.769031174] [driving_environment_analyzer]: - Length of lane that has adjacent lane : 2080.43 [m]
35+
[component_container-1] [INFO 1708999777.769076141] [driving_environment_analyzer]: - Length of lane that has opposite lane : 0.00 [m]
36+
[component_container-1] [INFO 1708999777.769101793] [driving_environment_analyzer]: - Length of lane that has no adjacent lane : 277.07 [m]
37+
[component_container-1] [INFO 1708999777.769225729] [driving_environment_analyzer]: - Min lane width: 3.14 [m] Max lane width: 4.94 [m]
38+
[component_container-1] [INFO 1708999777.769278698] [driving_environment_analyzer]: - Max curvature: 0.007967 [1/m]
39+
[component_container-1] [INFO 1708999777.769293161] [driving_environment_analyzer]: - Min curve radius: 125.52 [m]
40+
[component_container-1] [INFO 1708999777.769336094] [driving_environment_analyzer]: - Min elevation angle: -0.033037 [rad] Max elevation angle: 0.026073 [rad]
41+
[component_container-1] [INFO 1708999777.769403870] [driving_environment_analyzer]: - Min speed limit: 13.89 [m/s] Max speed limit: 16.67 [m/s]
42+
[component_container-1] [INFO 1708999777.769424648] [driving_environment_analyzer]: - Exist traffic light: true
43+
[component_container-1] [INFO 1708999777.769435813] [driving_environment_analyzer]: - Exist intersection: true
44+
[component_container-1] [INFO 1708999777.769620035] [driving_environment_analyzer]: - Exist crosswalk: true
45+
[component_container-1] [INFO 1708999777.769634980] [driving_environment_analyzer]: ======================================
46+
[component_container-1] [INFO 1708999777.769642769] [driving_environment_analyzer]: complete ODD analysis. shutdown.
47+
[component_container-1] [INFO 1708999777.769650034] [driving_environment_analyzer]: ======================================
48+
```
49+
50+
ただし、`map/vector_map`に関しては`use_map_in_bag``false`にすることでローカル環境に保存されている地図を使用してODD解析を行うことも可能です。その場合、`map_path`オプションで地図のパスを指定してください。
51+
52+
`ros2 launch driving_environment_analyzer driving_environment_analyzer.launch.xml use_map_in_bag:=false map_path:=<MAP> bag_path:=<ROSBAG>`
53+
54+
以上のようにオプションを指定することでROSBAGに地図情報が保存されていなくてもODD解析が可能です。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2024 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef DRIVING_ENVIRONMENT_ANALYZER__NODE_HPP_
16+
#define DRIVING_ENVIRONMENT_ANALYZER__NODE_HPP_
17+
18+
#include "rosbag2_cpp/reader.hpp"
19+
#include "tier4_autoware_utils/ros/logger_level_configure.hpp"
20+
21+
#include <route_handler/route_handler.hpp>
22+
23+
#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp>
24+
#include <autoware_auto_perception_msgs/msg/predicted_objects.hpp>
25+
#include <autoware_planning_msgs/msg/lanelet_route.hpp>
26+
#include <geometry_msgs/msg/accel_with_covariance_stamped.hpp>
27+
#include <nav_msgs/msg/occupancy_grid.hpp>
28+
#include <nav_msgs/msg/odometry.hpp>
29+
#include <visualization_msgs/msg/marker.hpp>
30+
31+
#include <map>
32+
#include <memory>
33+
#include <mutex>
34+
#include <string>
35+
#include <vector>
36+
37+
namespace driving_environment_analyzer
38+
{
39+
using autoware_auto_mapping_msgs::msg::HADMapBin;
40+
using autoware_auto_perception_msgs::msg::PredictedObject;
41+
using autoware_auto_perception_msgs::msg::PredictedObjects;
42+
using autoware_planning_msgs::msg::LaneletRoute;
43+
using geometry_msgs::msg::AccelWithCovarianceStamped;
44+
using nav_msgs::msg::Odometry;
45+
46+
class DrivingEnvironmentAnalyzer : public rclcpp::Node
47+
{
48+
public:
49+
explicit DrivingEnvironmentAnalyzer(const rclcpp::NodeOptions & node_options);
50+
51+
private:
52+
bool isDataReady(const bool use_map_in_bag);
53+
void onMap(const HADMapBin::ConstSharedPtr map_msg);
54+
void analyze();
55+
56+
bool has_map_data_{false};
57+
58+
std::vector<LaneletRoute> route_msgs_;
59+
60+
route_handler::RouteHandler route_handler_;
61+
LaneletRoute::ConstSharedPtr route_ptr_{nullptr};
62+
rclcpp::Subscription<HADMapBin>::SharedPtr sub_map_;
63+
rclcpp::TimerBase::SharedPtr timer_;
64+
rosbag2_cpp::Reader reader_;
65+
};
66+
} // namespace driving_environment_analyzer
67+
68+
#endif // DRIVING_ENVIRONMENT_ANALYZER__NODE_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<launch>
3+
<arg name="map_path" description="point cloud and lanelet2 map directory path"/>
4+
<arg name="bag_path" description="bagfile path"/>
5+
<arg name="use_map_in_bag" default="false"/>
6+
<arg name="lanelet2_map_loader_param_path" default="$(find-pkg-share autoware_launch)/config/map/lanelet2_map_loader.param.yaml"/>
7+
<arg name="map_projection_loader_param_path" default="$(find-pkg-share autoware_launch)/config/map/map_projection_loader.param.yaml"/>
8+
9+
<node_container pkg="rclcpp_components" exec="component_container" name="map_container" namespace="" output="screen">
10+
<composable_node pkg="map_loader" plugin="Lanelet2MapLoaderNode" name="lanelet2_map_loader">
11+
<param from="$(var lanelet2_map_loader_param_path)"/>
12+
<param name="lanelet2_map_path" value="$(var map_path)/lanelet2_map.osm"/>
13+
<remap from="output/lanelet2_map" to="/map/vector_map"/>
14+
</composable_node>
15+
16+
<composable_node pkg="driving_environment_analyzer" plugin="driving_environment_analyzer::DrivingEnvironmentAnalyzer" name="driving_environment_analyzer">
17+
<param name="bag_path" value="$(var bag_path)"/>
18+
<param name="use_map_in_bag" value="$(var use_map_in_bag)"/>
19+
<remap from="input/lanelet2_map" to="/map/vector_map"/>
20+
</composable_node>
21+
</node_container>
22+
23+
<include file="$(find-pkg-share map_projection_loader)/launch/map_projection_loader.launch.xml">
24+
<arg name="param_path" value="$(var map_projection_loader_param_path)"/>
25+
<arg name="map_projector_info_path" value="$(var map_path)/map_projector_info.yaml"/>
26+
<arg name="lanelet2_map_path" value="$(var map_path)/lanelet2_map.osm"/>
27+
</include>
28+
</launch>
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>driving_environment_analyzer</name>
5+
<version>0.1.0</version>
6+
<description>The driving_environment_analyzer package</description>
7+
8+
<maintainer email="[email protected]">Satoshi Ota</maintainer>
9+
10+
<license>Apache License 2.0</license>
11+
12+
<author email="[email protected]">Satoshi Ota</author>
13+
14+
<buildtool_depend>ament_cmake_auto</buildtool_depend>
15+
<buildtool_depend>autoware_cmake</buildtool_depend>
16+
17+
<depend>autoware_adapi_v1_msgs</depend>
18+
<depend>autoware_auto_perception_msgs</depend>
19+
<depend>autoware_auto_planning_msgs</depend>
20+
<depend>autoware_auto_tf2</depend>
21+
<depend>autoware_auto_vehicle_msgs</depend>
22+
<depend>autoware_perception_msgs</depend>
23+
<depend>behavior_path_planner_common</depend>
24+
<depend>geometry_msgs</depend>
25+
<depend>interpolation</depend>
26+
<depend>lane_departure_checker</depend>
27+
<depend>lanelet2_extension</depend>
28+
<depend>libboost-dev</depend>
29+
<depend>motion_utils</depend>
30+
<depend>rclcpp</depend>
31+
<depend>rclcpp_components</depend>
32+
<depend>route_handler</depend>
33+
<depend>sensor_msgs</depend>
34+
<depend>signal_processing</depend>
35+
<depend>tf2</depend>
36+
<depend>tf2_eigen</depend>
37+
<depend>tf2_geometry_msgs</depend>
38+
<depend>tf2_ros</depend>
39+
<depend>tier4_autoware_utils</depend>
40+
<depend>tier4_planning_msgs</depend>
41+
<depend>vehicle_info_util</depend>
42+
<depend>visualization_msgs</depend>
43+
44+
<test_depend>ament_cmake_ros</test_depend>
45+
<test_depend>ament_lint_auto</test_depend>
46+
<test_depend>autoware_lint_common</test_depend>
47+
48+
<export>
49+
<build_type>ament_cmake</build_type>
50+
</export>
51+
</package>

0 commit comments

Comments
 (0)