-
Notifications
You must be signed in to change notification settings - Fork 37
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
mitsudome-r
wants to merge
11
commits into
autowarefoundation:main
Choose a base branch
from
mitsudome-r:add-autoware-component-interface-specs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb865bb
feat: add autoware_core_component_interface_specs package
mitsudome-r d95340a
fix: fix paths for header files
mitsudome-r 7a5a9a7
style(pre-commit): autofix
pre-commit-ci[bot] 6f7c1f9
fix: fix include path for control.hpp
mitsudome-r a10b1a2
feat: add get_qos() function
mitsudome-r 5bb1566
style(pre-commit): autofix
pre-commit-ci[bot] de0b70c
fix: make member functions static
mitsudome-r 775a0f0
fix: rename package
mitsudome-r 1514b4a
style(pre-commit): autofix
pre-commit-ci[bot] 1d2fd81
docs: add usage example to README
mitsudome-r 9a97044
style(pre-commit): autofix
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
common/autoware_core_component_interface_specs/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,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() |
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,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)); | ||
``` |
42 changes: 42 additions & 0 deletions
42
...e_core_component_interface_specs/include/autoware/core_component_interface_specs/base.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,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; | ||
|
||
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_ |
37 changes: 37 additions & 0 deletions
37
...ore_component_interface_specs/include/autoware/core_component_interface_specs/control.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,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_ |
47 changes: 47 additions & 0 deletions
47
...omponent_interface_specs/include/autoware/core_component_interface_specs/localization.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,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_ |
57 changes: 57 additions & 0 deletions
57
...re_core_component_interface_specs/include/autoware/core_component_interface_specs/map.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,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_ |
37 changes: 37 additions & 0 deletions
37
..._component_interface_specs/include/autoware/core_component_interface_specs/perception.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,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_ |
47 changes: 47 additions & 0 deletions
47
...re_component_interface_specs/include/autoware/core_component_interface_specs/planning.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,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_ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?