Skip to content
This repository was archived by the owner on Sep 21, 2026. It is now read-only.

Commit cb126fb

Browse files
committed
Merge remote-tracking branch 'origin' into
createRoute
2 parents 9913fcd + d8f6434 commit cb126fb

5 files changed

Lines changed: 271 additions & 131 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ find_package(rclcpp REQUIRED)
1111
find_package(std_msgs REQUIRED)
1212
find_package(geometry_msgs REQUIRED)
1313
find_package(ap1_msgs REQUIRED)
14+
find_package(lanelet2_core REQUIRED)
15+
find_package(lanelet2_io REQUIRED)
16+
find_package(lanelet2_projection REQUIRED)
1417

1518
add_executable(planner_node
1619
src/main.cpp
@@ -29,6 +32,9 @@ ament_target_dependencies(
2932
std_msgs
3033
geometry_msgs
3134
ap1_msgs
35+
lanelet2_core
36+
lanelet2_io
37+
lanelet2_projection
3238
)
3339

3440
install(TARGETS

‎README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Planning
22

3+
## Dependencies
4+
5+
Make sure you pull, build, and install `ap1_msgs`.
6+
You'll also need `ros-jazzy-lanelet2`. So `sudo apt install ros-jazzy-lanelet2` if you haven't already.
7+
38
## Compilaton
49

510
> Note: If you want clangd to provide good autocorrect do: `colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1` and `cp build/compile_commands.json .`

‎include/ap1/planning/planner_node.hpp‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
#define AP1_PLANNING_NODE_HPP
88

99
#include <cmath>
10+
#include <functional>
1011
#include <rclcpp/timer.hpp>
12+
#include <string>
13+
#include <vector>
1114

1215
#include "geometry_msgs/msg/point.hpp"
1316
#include "rclcpp/rclcpp.hpp"
17+
1418
#include "std_msgs/msg/float32_multi_array.hpp"
19+
#include <lanelet2_core/LaneletMap.h>
20+
#include <lanelet2_io/Io.h>
21+
#include <lanelet2_projection/UTM.h>
1522

1623
#include "ap1_msgs/msg/speed_profile_stamped.hpp"
1724
#include "ap1_msgs/msg/target_path_stamped.hpp"
@@ -44,10 +51,19 @@ class PlannerNode : public rclcpp::Node
4451
*/
4552
PlannerNode(double rate_hz = 60.0);
4653

54+
struct Lane
55+
{
56+
std::vector<geometry_msgs::msg::Point> left_boundary;
57+
std::vector<geometry_msgs::msg::Point> right_boundary;
58+
};
59+
4760
private:
4861
float speed_ = 0;
4962
const double rate_hz_;
5063
Point target_location_;
64+
Lane current_lane_;
65+
std::string map_file_path_;
66+
lanelet::LaneletMapPtr lanelet_map_;
5167

5268
TimerBase::SharedPtr timer_;
5369

@@ -69,6 +85,18 @@ class PlannerNode : public rclcpp::Node
6985
void on_target_location(const geometry_msgs::msg::Point::SharedPtr loc);
7086
void on_target_speed(const VehicleSpeedStamped::SharedPtr);
7187

88+
/**
89+
* @brief Mocks map data for testing.
90+
*/
91+
void process_map_data();
92+
93+
/**
94+
* @brief Calculates the centerline from the current lane boundaries.
95+
* @param lane The lane containing left and right boundaries.
96+
* @return std::vector<geometry_msgs::msg::Point> The calculated centerline.
97+
*/
98+
std::vector<geometry_msgs::msg::Point> calculate_centerline(const Lane& lane);
99+
72100
/**
73101
* @brief Planning loop callback runs rate_hz times per second.
74102
* This callback is responsible for sending commands & updates to control.

‎package.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<depend>std_msgs</depend>
1414
<depend>geometry_msgs</depend>
1515
<depend>ap1_msgs</depend>
16+
<depend>lanelet2_core</depend>
17+
<depend>lanelet2_io</depend>
18+
<depend>lanelet2_projection</depend>
1619

1720
<test_depend>ament_lint_auto</test_depend>
1821
<test_depend>ament_lint_common</test_depend>

0 commit comments

Comments
 (0)