forked from AutomotiveAIChallenge/aichallenge-2024
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(planning): create cached lanelet costmap (#24)
* create cached_lanelet_costmap pkg dir Signed-off-by: Autumn60 <[email protected]> * update booars_utils/nav Signed-off-by: Autumn60 <[email protected]> * implement cached lanelet costmap Signed-off-by: Autumn60 <[email protected]> * add cached_lanelet_costmap to booars_costmap_utils Signed-off-by: Autumn60 <[email protected]> * update booars_costmap_generator Signed-off-by: Autumn60 <[email protected]> * update costmap_generator.param.yaml in booars_costmap_generator Signed-off-by: Autumn60 <[email protected]> * update costmap_generator.param.yaml in booars_launch Signed-off-by: Autumn60 <[email protected]> * Update aichallenge/workspace/src/aichallenge_submit/booars_launch/config/planning/costmap_generator.param.yaml --------- Signed-off-by: Autumn60 <[email protected]>
- Loading branch information
Showing
11 changed files
with
325 additions
and
18 deletions.
There are no files selected for viewing
15 changes: 11 additions & 4 deletions
15
...rkspace/src/aichallenge_submit/booars_launch/config/planning/costmap_generator.param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
...c/aichallenge_submit/costmap/booars_costmap_generator/config/costmap_generator.param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
aichallenge/workspace/src/aichallenge_submit/costmap/cached_lanelet_costmap/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(cached_lanelet_costmap) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
find_package(ament_cmake_auto REQUIRED) | ||
|
||
ament_auto_find_build_dependencies() | ||
|
||
ament_auto_add_library(cached_lanelet_costmap SHARED | ||
src/cached_lanelet_costmap.cpp | ||
) | ||
|
||
ament_auto_package() |
75 changes: 75 additions & 0 deletions
75
.../costmap/cached_lanelet_costmap/include/cached_lanelet_costmap/cached_lanelet_costmap.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 2024 Booars | ||
// | ||
// 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 CACHED_LANELET_COSTMAP__CACHED_LANELET_COSTMAP_HPP_ | ||
#define CACHED_LANELET_COSTMAP__CACHED_LANELET_COSTMAP_HPP_ | ||
|
||
#include <booars_utils/nav/occupancy_grid_parameters.hpp> | ||
#include <booars_utils/nav/occupancy_grid_utils.hpp> | ||
#include <multi_layered_costmap/costmap_base.hpp> | ||
|
||
#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp> | ||
|
||
#include <lanelet2_core/LaneletMap.h> | ||
#include <tf2_ros/buffer.h> | ||
#include <tf2_ros/transform_listener.h> | ||
|
||
#include <string> | ||
|
||
namespace cached_lanelet_costmap | ||
{ | ||
|
||
using OccupancyGrid = nav_msgs::msg::OccupancyGrid; | ||
using OccupancyGridParameters = booars_utils::nav::OccupancyGridParameters; | ||
using HADMapBin = autoware_auto_mapping_msgs::msg::HADMapBin; | ||
|
||
class CachedLaneletCostmap : public multi_layered_costmap::CostmapBase | ||
{ | ||
public: | ||
using SharedPtr = std::shared_ptr<CachedLaneletCostmap>; | ||
explicit CachedLaneletCostmap(rclcpp::Node & node, const std::string & layer_namespace); | ||
|
||
static CostmapBase::SharedPtr create_costmap( | ||
rclcpp::Node & node, const std::string & layer_namespace) | ||
{ | ||
return std::make_shared<CachedLaneletCostmap>(node, layer_namespace); | ||
} | ||
|
||
bool is_ready() override; | ||
bool is_occupied(const geometry_msgs::msg::PointStamped & point) override; | ||
|
||
private: | ||
bool try_transform_point( | ||
const geometry_msgs::msg::PointStamped & point, geometry_msgs::msg::Point & transformed_point, | ||
const std::string & target_frame); | ||
void create_cached_costmap( | ||
const std::string & map_frame_id, const lanelet::ConstLanelets & roads_lanelets); | ||
void map_callback(const HADMapBin::SharedPtr msg); | ||
|
||
tf2_ros::Buffer tf_buffer_; | ||
tf2_ros::TransformListener tf_listener_; | ||
|
||
rclcpp::Subscription<HADMapBin>::SharedPtr map_sub_; | ||
rclcpp::Publisher<OccupancyGrid>::SharedPtr costmap_pub_; | ||
|
||
OccupancyGrid::SharedPtr cached_costmap_; | ||
OccupancyGridParameters::SharedPtr cached_costmap_parameters_; | ||
|
||
double cached_costmap_origin_x_; | ||
double cached_costmap_origin_y_; | ||
bool is_map_ready_ = false; | ||
}; | ||
} // namespace cached_lanelet_costmap | ||
|
||
#endif // CACHED_LANELET_COSTMAP__CACHED_LANELET_COSTMAP_HPP_ |
25 changes: 25 additions & 0 deletions
25
aichallenge/workspace/src/aichallenge_submit/costmap/cached_lanelet_costmap/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?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>cached_lanelet_costmap</name> | ||
<version>0.0.0</version> | ||
<description>The cached_lanelet_costmap pkg</description> | ||
<maintainer email="[email protected]">Akiro Harada</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
|
||
<depend>autoware_auto_mapping_msgs</depend> | ||
<depend>booars_utils</depend> | ||
<depend>geometry_msgs</depend> | ||
<depend>lanelet2_extension</depend> | ||
<depend>multi_layered_costmap</depend> | ||
<depend>rclcpp</depend> | ||
<depend>tf2_geometry_msgs</depend> | ||
<depend>tf2_ros</depend> | ||
<depend>tier4_autoware_utils</depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Oops, something went wrong.