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 all 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
8 changes: 7 additions & 1 deletion planning/.pages
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ nav:
- 'About Freespace Planner': planning/autoware_freespace_planner
- 'Algorithm': planning/autoware_freespace_planning_algorithms
- 'RRT*': planning/autoware_freespace_planning_algorithms/rrtstar
- 'Mission Planner': planning/autoware_mission_planner
- 'Mapless Architecture': planning/mapless_architecture
- 'Human Machine Interface': planning/mapless_architecture/autoware_hmi
- 'Local Map Provider': planning/mapless_architecture/autoware_local_map_provider
- 'Local Mission Planner': planning/mapless_architecture/autoware_local_mission_planner
- 'Local Mission Planner Library': planning/mapless_architecture/autoware_local_mission_planner_common
- 'Mission Lane Converter': planning/mapless_architecture/autoware_mission_lane_converter
- '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.
57 changes: 57 additions & 0 deletions planning/mapless_architecture/autoware_hmi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_hmi)

# Check for compiler
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)
find_package(rclcpp_components REQUIRED)
ament_auto_find_build_dependencies()
autoware_package()

ament_auto_add_library(${PROJECT_NAME} SHARED
src/hmi_node.cpp
)

# Register node
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::mapless_architecture::HMINode"
EXECUTABLE ${PROJECT_NAME}_exe
)

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

# Specify required C and C++ standards
target_compile_features(${PROJECT_NAME} PUBLIC c_std_99 cxx_std_17)

# Install the target library
install(TARGETS
${PROJECT_NAME}
DESTINATION lib/${PROJECT_NAME})

# Install the launch directory
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME})

# --- SPECIFY TESTS ---
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()

# Ensure all packages are correctly installed
ament_auto_package(
INSTALL_TO_SHARE
launch
)
29 changes: 29 additions & 0 deletions planning/mapless_architecture/autoware_hmi/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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
```

## Output topics

| Name | Type | Description |
| ------------------------- | ------------------------------------ | ----------- |
| `hmi_node/output/mission` | autoware_planning_msgs::msg::Mission | mission |

## Node parameters

| Parameter | Type | Description |
| --------- | ------ | ---------------------------------------------- |
| `mission` | string | the mission (LANE_KEEP, LANE_CHANGE_LEFT, ...) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2024 driveblocks GmbH, authors: Simon Eisenmann, Thomas Herrmann
//
// 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 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.
*/
explicit HMINode(const rclcpp::NodeOptions & options);

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_
35 changes: 35 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,35 @@
# Copyright 2024 driveblocks GmbH, authors: Simon Eisenmann, Thomas Herrmann
#
# 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.

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_exe",
name="autoware_hmi",
namespace="mapless_architecture",
remappings=[
("hmi_node/output/mission", "hmi_node/output/mission"),
],
parameters=[],
output="screen",
),
]
)
24 changes: 24 additions & 0 deletions planning/mapless_architecture/autoware_hmi/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>
<depend>rclcpp_components</depend>

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

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
95 changes: 95 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,95 @@
// Copyright 2024 driveblocks GmbH, authors: Simon Eisenmann, Thomas Herrmann
//
// 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 "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(const rclcpp::NodeOptions & options) : Node("hmi_node", options)
{
// 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;
}

missionMessage.deadline = 1000; // This parameter can be changed if needed (it will be set by the
// software in the future).

mission_publisher_->publish(missionMessage);
}
} // namespace autoware::mapless_architecture

#include "rclcpp_components/register_node_macro.hpp"

RCLCPP_COMPONENTS_REGISTER_NODE(autoware::mapless_architecture::HMINode)
21 changes: 21 additions & 0 deletions planning/mapless_architecture/autoware_hmi/test/gtest_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 driveblocks GmbH, authors: Simon Eisenmann, Thomas Herrmann
//
// 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 "gtest/gtest.h"

int main(int argc, char ** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Loading
Loading