Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mapless_architecture): add mapless_architecture #7709

Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c268146
Add nodes
simon-eisenmann-driveblocks Jun 13, 2024
0b6c306
Restructure folder
simon-eisenmann-driveblocks Jun 13, 2024
8b9c504
Change documentation
simon-eisenmann-driveblocks Jun 13, 2024
5e6ca68
Add local mission planner
simon-eisenmann-driveblocks Jun 13, 2024
c25cac8
Remove driveblocks dependencies
simon-eisenmann-driveblocks Jun 20, 2024
a12fcd7
Rename packages
simon-eisenmann-driveblocks Jun 20, 2024
b589b53
Add namespace
simon-eisenmann-driveblocks Jun 20, 2024
f94bdc9
Run pre-commit
simon-eisenmann-driveblocks Jun 20, 2024
71f7469
Update launch files
simon-eisenmann-driveblocks Jun 20, 2024
5033efb
Change readme
simon-eisenmann-driveblocks Jun 24, 2024
b431760
Specify language
simon-eisenmann-driveblocks Jun 24, 2024
4af9b99
Fix pre-commit issues
simon-eisenmann-driveblocks Jun 25, 2024
4a8b586
Work on documentation
simon-eisenmann-driveblocks Jun 25, 2024
b048568
Fix bug
simon-eisenmann-driveblocks Jun 25, 2024
60bff85
Remove driveblocks dependencies
simon-eisenmann-driveblocks Jun 26, 2024
c1958e0
Remove node, change readme
simon-eisenmann-driveblocks Jun 26, 2024
55b4e77
Remove local_road_provider
simon-eisenmann-driveblocks Jun 26, 2024
3bb548f
Remove db_msgs
simon-eisenmann-driveblocks Jun 27, 2024
9f9b92e
Move some functions to the library
simon-eisenmann-driveblocks Jun 27, 2024
30048f6
Merge commit
simon-eisenmann-driveblocks Jun 27, 2024
6219caa
Merge commit
simon-eisenmann-driveblocks Jul 3, 2024
1d562b3
5: Local odom adaptions
simon-eisenmann-driveblocks Jul 9, 2024
9e137df
2: Work on requested changes
simon-eisenmann-driveblocks Jul 9, 2024
77749eb
3: Change the license
simon-eisenmann-driveblocks Jul 9, 2024
ff9dfd8
6: Check TODOs/FIXMEs
simon-eisenmann-driveblocks Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions planning/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ nav:
- 'Algorithm': planning/autoware_freespace_planning_algorithms
- 'RRT*': planning/autoware_freespace_planning_algorithms/rrtstar
- 'Mission Planner': planning/autoware_mission_planner
- 'Local Mission Planner': planning/mapless_architecture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add links to each subpackages under the Local Mission Planner .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

- 'Motion Planning':
- 'Path Optimizer':
- 'About Path Optimizer': planning/autoware_path_optimizer
Expand Down
35 changes: 35 additions & 0 deletions planning/mapless_architecture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Mission Planner

The Mission Planner module generates a reference trajectory/path in a local road model based on mission inputs. These inputs are received from the Human Machine Interface (HMI) or another agent. The resulting trajectory or path is then forwarded to the Behavior Planner for further processing.

A detailed overview can be seen here:

![mapless_architecture](images/mapless_architecture.svg)

## Components

The Mission Planner consists of several components (ROS2 packages) working together:

- **Local Mission Planner**: Generates target lanes based on the mission input.
- **HMI (Human Machine Interface)**: Provides a user interface for defining missions via terminal input.
- **Converter**: Converts lanes generated by the Mission Planner into Autoware Trajectories/Paths.
- **Local Road Provider**: Converts the LaneletsStamped message into a RoadSegments message.
- **Local Map Provider**: Converts the RoadSegments message into a LocalMap message.

## Launching the Software

To launch all nodes of the software:

```bash
ros2 launch autoware_local_mission_planner mission_planner_compose.launch.py
```

To launch a specific node, such as the mission planner:

```bash
ros2 launch autoware_local_mission_planner mission_planner.launch.py
```

## Additional Notes

During the beta phase, the mission planner will immediately output a straight trajectory with low velocity to move the vehicle into the local road model. Once the vehicle can be located in the local road model, a trajectory following the ego lane will be computed.
47 changes: 47 additions & 0 deletions planning/mapless_architecture/autoware_hmi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_hmi)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# --- FIND DEPENDENCIES ---
find_package(autoware_cmake REQUIRED) # automatically find dependencies
ament_auto_find_build_dependencies()
autoware_package()

# build executables
ament_auto_add_executable(${PROJECT_NAME}
src/hmi_main.cpp
src/hmi_node.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17

# install executable(s)
install(TARGETS
${PROJECT_NAME}
DESTINATION lib/${PROJECT_NAME})

# install launchfile(s) [all within the "launch" folder]
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME})

# --- SPECIFY TESTS ---
# configure clang format
set(ament_cmake_clang_format_CONFIG_FILE ../../.clang-format)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_lint_auto REQUIRED)

ament_auto_add_gtest(${PROJECT_NAME}_tests test/gtest_main.cpp)

ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package()
17 changes: 17 additions & 0 deletions planning/mapless_architecture/autoware_hmi/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# HMI Node

Creates a mission based on the terminal input (ROS parameter change).

Available missions:

- LANE_KEEP
- LANE_CHANGE_LEFT
- LANE_CHANGE_RIGHT
- TAKE_NEXT_EXIT_LEFT
- TAKE_NEXT_EXIT_RIGHT

Interact with this node by changing the ROS parameters. For a lane change to the right use this command in the terminal:

```bash
ros2 param set /mission_planner/hmi mission LANE_CHANGE_RIGHT
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2024 driveblocks GmbH
// driveblocks proprietary license
#ifndef AUTOWARE__HMI__HMI_NODE_HPP_
#define AUTOWARE__HMI__HMI_NODE_HPP_

#include "rclcpp/rclcpp.hpp"

#include "autoware_planning_msgs/msg/mission.hpp"

#include <string>
#include <vector>

namespace autoware::mapless_architecture
{

/**
* Node for HMI.
*/
class HMINode : public rclcpp::Node
{
public:
/**
* @brief Constructor for the HMINode class.
* Initializes the publisher and subscriber with appropriate topics and QoS
* settings.
*/
HMINode();

private:
/**
* @brief Callback function for parameter changes.
* This callback function is triggered whenever a ROS 2 parameter is changed.
* @param parameters The received parameter changes.
*/
rcl_interfaces::msg::SetParametersResult ParamCallback_(
const std::vector<rclcpp::Parameter> & parameters);

/**
* @brief Function which publishes the mission.
*
* @param mission The mission that should be published.
*/
void PublishMission_(std::string mission);

// Declare ROS2 publisher and subscriber

rclcpp::Publisher<autoware_planning_msgs::msg::Mission>::SharedPtr mission_publisher_;

rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr param_callback_handle_;
};
} // namespace autoware::mapless_architecture

#endif // AUTOWARE__HMI__HMI_NODE_HPP_
23 changes: 23 additions & 0 deletions planning/mapless_architecture/autoware_hmi/launch/hmi.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 driveblocks GmbH
# driveblocks proprietary license
from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
return LaunchDescription(
[
# hmi executable
Node(
package="autoware_hmi",
executable="autoware_hmi",
name="autoware_hmi",
namespace="mapless_architecture",
remappings=[
("hmi_node/output/mission", "hmi_node/output/mission"),
],
parameters=[],
output="screen",
),
]
)
23 changes: 23 additions & 0 deletions planning/mapless_architecture/autoware_hmi/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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>autoware_hmi</name>
<version>0.0.1</version>
<description>HMI</description>
<maintainer email="simon.eisenmann@driveblocks.ai">driveblocks</maintainer>
<license>driveblocks proprietary license</license>

<buildtool_depend>autoware_cmake</buildtool_depend>

<exec_depend>ros2launch</exec_depend>

<depend>autoware_planning_msgs</depend>
<depend>rclcpp</depend>

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

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
18 changes: 18 additions & 0 deletions planning/mapless_architecture/autoware_hmi/src/hmi_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 driveblocks GmbH
// driveblocks proprietary license

#include "autoware/hmi/hmi_node.hpp"

#include <rclcpp/rclcpp.hpp>

#include <memory>

int main(int argc, char * argv[])
{
RCLCPP_INFO(rclcpp::get_logger("hmi"), "Launching HMI node...");

rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<autoware::mapless_architecture::HMINode>());
rclcpp::shutdown();
return 0;
}
80 changes: 80 additions & 0 deletions planning/mapless_architecture/autoware_hmi/src/hmi_node.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2024 driveblocks GmbH
// driveblocks proprietary license

#include "autoware/hmi/hmi_node.hpp"

#include "rclcpp/rclcpp.hpp"

#include "autoware_planning_msgs/msg/mission.hpp"

namespace autoware::mapless_architecture
{
using std::placeholders::_1;

HMINode::HMINode() : Node("hmi_node")
{
// Set quality of service to best effort (if transmission fails, do not try to
// resend but rather use new sensor data)
// the history_depth is set to 1 (message queue size)
auto qos = rclcpp::QoS(1);
qos.best_effort();

// Declare parameter
this->declare_parameter("mission", "LANE_KEEP");

// Initialize publisher
mission_publisher_ =
this->create_publisher<autoware_planning_msgs::msg::Mission>("hmi_node/output/mission", 1);

// Initialize parameters callback handle
param_callback_handle_ = this->add_on_set_parameters_callback(
std::bind(&HMINode::ParamCallback_, this, std::placeholders::_1));
}

rcl_interfaces::msg::SetParametersResult HMINode::ParamCallback_(
const std::vector<rclcpp::Parameter> & parameters)
{
// Initialize output
rcl_interfaces::msg::SetParametersResult result;

result.successful = false;
result.reason = "";
std::string mission;
for (const auto & param : parameters) {
if (param.get_name() == "mission") {
if (param.get_type() == rclcpp::ParameterType::PARAMETER_STRING) {
mission = param.as_string();

// Publish mission
PublishMission_(mission);

result.successful = true;
} else {
result.reason = "Incorrect Type";
}
}
}
return result;
}

void HMINode::PublishMission_(std::string mission)
{
autoware_planning_msgs::msg::Mission missionMessage;
if (mission == "LANE_KEEP") {
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::LANE_KEEP;
} else if (mission == "LANE_CHANGE_LEFT") {
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::LANE_CHANGE_LEFT;
} else if (mission == "LANE_CHANGE_RIGHT") {
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::LANE_CHANGE_RIGHT;
} else if (mission == "TAKE_NEXT_EXIT_LEFT") {
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::TAKE_NEXT_EXIT_LEFT;
} else if (mission == "TAKE_NEXT_EXIT_RIGHT") {
missionMessage.mission_type = autoware_planning_msgs::msg::Mission::TAKE_NEXT_EXIT_RIGHT;
}

// TODO(simon.eisenmann@driveblocks.ai): Change deadline parameter
missionMessage.deadline = 1000;

mission_publisher_->publish(missionMessage);
}
} // namespace autoware::mapless_architecture
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2024 driveblocks GmbH
// driveblocks proprietary license
#include "gtest/gtest.h"

int main(int argc, char ** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_local_map_provider)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# --- FIND DEPENDENCIES ---
find_package(autoware_cmake REQUIRED) # automatically find dependencies
ament_auto_find_build_dependencies()
autoware_package()

# build executables
ament_auto_add_executable(${PROJECT_NAME}
src/local_map_provider_main.cpp
src/local_map_provider_node.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17

# install executable(s)
install(TARGETS
${PROJECT_NAME}
DESTINATION lib/${PROJECT_NAME})

# install launchfile(s) [all within the "launch" folder]
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME})

# --- SPECIFY TESTS ---
# configure clang format
set(ament_cmake_clang_format_CONFIG_FILE ../../.clang-format)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_lint_auto REQUIRED)

ament_auto_add_gtest(${PROJECT_NAME}_tests test/gtest_main.cpp)

ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Local Map Provider Node

This node converts the mission_planner_messages::msg::RoadSegments message into a mission_planner_messages::msg::LocalMap message right now. More functionality can be added later.
Loading
Loading