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: add autoware_core_component_interface_specs package #124

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions common/autoware_core_component_interface_specs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.14)
project(autoware_component_interface_specs)

find_package(autoware_cmake REQUIRED)
autoware_package()

if(BUILD_TESTING)
ament_auto_add_gtest(gtest_${PROJECT_NAME}
test/gtest_main.cpp
test/test_planning.cpp
test/test_control.cpp
test/test_localization.cpp
test/test_map.cpp
test/test_perception.cpp
test/test_vehicle.cpp
)
endif()

ament_auto_package()
48 changes: 48 additions & 0 deletions common/autoware_core_component_interface_specs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# autoware_component_interface_specs

This package defines the standardized component interface specifications for Autoware Core, ensuring consistent communication and interaction between various components in the Autoware autonomous driving stack.

## Purpose

The purpose of this package is to:

- Provide a single source of truth for component interface definitions
- Ensure consistency across different implementations
- Facilitate modular development and component interchangeability
- Document the communication protocols between Autoware Core components

## Structure

The package contains interface specifications for various components, including:

- Message definitions
- Service interfaces
- Action interfaces

## Usage

To use these interface specifications in your component:

1. Add this package as a dependency in your package.xml:

```xml
<depend>autoware_core_component_interface_specs</depend>
```

2. Use the provided interfaces in your component code.

```cpp
#include <autoware/core_component_interface_specs/localization.hpp>

// Example: Creating a publisher using the interface specs
rclcpp::Publisher<KinematicState::Message>::SharedPtr publisher_ =
create_publisher<KinematicState::Message>(
KinematicState::name,
KinematicState::get_qos());

// Example: Creating a subscription using the interface specs
auto subscriber_ = create_subscription<KinematicState::Message>(
KinematicState::name,
KinematicState::get_qos(),
std::bind(&YourClass::callback, this, std::placeholders::1));
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2023 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__BASE_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__BASE_HPP_

#include <rclcpp/qos.hpp>

#include <autoware_map_msgs/msg/lanelet_map_bin.hpp>
#include <autoware_map_msgs/msg/map_projector_info.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>

namespace autoware::component_interface_specs
{

struct InterfaceBase
{
static constexpr char name[] = "";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
Comment on lines +29 to +32
Copy link

@isamu-takagi isamu-takagi Dec 20, 2024

Choose a reason for hiding this comment

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

These don't seem necessary. If your goal is to share get_qos function, how about making it a free function or using the CRTP?


static rclcpp::QoS get_qos()
{
return rclcpp::QoS{depth}.reliability(reliability).durability(durability);
}
};

} // namespace autoware::component_interface_specs

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__BASE_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2022 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__CONTROL_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__CONTROL_HPP_

#include <autoware/component_interface_specs/base.hpp>
#include <rclcpp/qos.hpp>

#include <autoware_control_msgs/msg/control.hpp>

namespace autoware::component_interface_specs::control
{

struct ControlCommand : InterfaceBase
{
using Message = autoware_control_msgs::msg::Control;
static constexpr char name[] = "/control/command/control_cmd";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

} // namespace autoware::component_interface_specs::control

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__CONTROL_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2022 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_

#include <autoware/component_interface_specs/base.hpp>
#include <rclcpp/qos.hpp>

#include <geometry_msgs/msg/accel_with_covariance_stamped.hpp>
#include <nav_msgs/msg/odometry.hpp>

namespace autoware::component_interface_specs::localization
{

struct KinematicState : InterfaceBase
{
using Message = nav_msgs::msg::Odometry;
static constexpr char name[] = "/localization/kinematic_state";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

struct Acceleration : InterfaceBase
{
using Message = geometry_msgs::msg::AccelWithCovarianceStamped;
static constexpr char name[] = "/localization/acceleration";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

} // namespace autoware::component_interface_specs::localization

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2023 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__MAP_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__MAP_HPP_

#include <autoware/component_interface_specs/base.hpp>
#include <rclcpp/qos.hpp>

#include <autoware_map_msgs/msg/lanelet_map_bin.hpp>
#include <autoware_map_msgs/msg/map_projector_info.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>

namespace autoware::component_interface_specs::map
{

struct MapProjectorInfo : InterfaceBase
{
using Message = autoware_map_msgs::msg::MapProjectorInfo;
static constexpr char name[] = "/map/map_projector_info";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

struct PointCloudMap : InterfaceBase
{
using Message = sensor_msgs::msg::PointCloud2;
static constexpr char name[] = "/map/point_cloud_map";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

struct VectorMap : InterfaceBase
{
using Message = autoware_map_msgs::msg::LaneletMapBin;
static constexpr char name[] = "/map/vector_map";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

} // namespace autoware::component_interface_specs::map

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__MAP_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2022 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_

#include <autoware/component_interface_specs/base.hpp>
#include <rclcpp/qos.hpp>

#include <autoware_perception_msgs/msg/predicted_objects.hpp>

namespace autoware::component_interface_specs::perception
{

struct ObjectRecognition : InterfaceBase
{
using Message = autoware_perception_msgs::msg::PredictedObjects;
static constexpr char name[] = "/perception/object_recognition/objects";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

} // namespace autoware::component_interface_specs::perception

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2022 TIER IV, Inc.
//
// 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__CORE_COMPONENT_INTERFACE_SPECS__PLANNING_HPP_
#define AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__PLANNING_HPP_

#include <autoware/component_interface_specs/base.hpp>
#include <rclcpp/qos.hpp>

#include <autoware_planning_msgs/msg/lanelet_route.hpp>
#include <autoware_planning_msgs/msg/trajectory.hpp>

namespace autoware::component_interface_specs::planning
{

struct LaneletRoute : InterfaceBase
{
using Message = autoware_planning_msgs::msg::LaneletRoute;
static constexpr char name[] = "/planning/mission_planning/route_selector/main/route";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;
};

struct Trajectory : InterfaceBase
{
using Message = autoware_planning_msgs::msg::Trajectory;
static constexpr char name[] = "/planning/scenario_planning/trajectory";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};

} // namespace autoware::component_interface_specs::planning

#endif // AUTOWARE__CORE_COMPONENT_INTERFACE_SPECS__PLANNING_HPP_
Loading
Loading