Initial import of FaRui Campus ADS v3.2

This commit is contained in:
li-shihao-code
2026-06-05 14:20:30 +08:00
commit 2839d34fdb
6548 changed files with 1335203 additions and 0 deletions
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.14)
project(autoware_ad_api_specs)
find_package(autoware_cmake REQUIRED)
autoware_package()
ament_auto_package()
@@ -0,0 +1,3 @@
# autoware_adapi_specs
This package is a specification of Autoware AD API.
@@ -0,0 +1,36 @@
// 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_AD_API_SPECS__FAIL_SAFE_HPP_
#define AUTOWARE_AD_API_SPECS__FAIL_SAFE_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/mrm_state.hpp>
namespace autoware_ad_api::fail_safe
{
struct MrmState
{
using Message = autoware_adapi_v1_msgs::msg::MrmState;
static constexpr char name[] = "/api/fail_safe/mrm_state";
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_ad_api::fail_safe
#endif // AUTOWARE_AD_API_SPECS__FAIL_SAFE_HPP_
@@ -0,0 +1,31 @@
// 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_AD_API_SPECS__INTERFACE_HPP_
#define AUTOWARE_AD_API_SPECS__INTERFACE_HPP_
#include <autoware_adapi_version_msgs/srv/interface_version.hpp>
namespace autoware_ad_api::interface
{
struct Version
{
using Service = autoware_adapi_version_msgs::srv::InterfaceVersion;
static constexpr char name[] = "/api/interface/version";
};
} // namespace autoware_ad_api::interface
#endif // AUTOWARE_AD_API_SPECS__INTERFACE_HPP_
@@ -0,0 +1,43 @@
// 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_AD_API_SPECS__LOCALIZATION_HPP_
#define AUTOWARE_AD_API_SPECS__LOCALIZATION_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/localization_initialization_state.hpp>
#include <autoware_adapi_v1_msgs/srv/initialize_localization.hpp>
namespace autoware_ad_api::localization
{
struct Initialize
{
using Service = autoware_adapi_v1_msgs::srv::InitializeLocalization;
static constexpr char name[] = "/api/localization/initialize";
};
struct InitializationState
{
using Message = autoware_adapi_v1_msgs::msg::LocalizationInitializationState;
static constexpr char name[] = "/api/localization/initialization_state";
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_ad_api::localization
#endif // AUTOWARE_AD_API_SPECS__LOCALIZATION_HPP_
@@ -0,0 +1,43 @@
// 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_AD_API_SPECS__MOTION_HPP_
#define AUTOWARE_AD_API_SPECS__MOTION_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/motion_state.hpp>
#include <autoware_adapi_v1_msgs/srv/accept_start.hpp>
namespace autoware_ad_api::motion
{
struct AcceptStart
{
using Service = autoware_adapi_v1_msgs::srv::AcceptStart;
static constexpr char name[] = "/api/motion/accept_start";
};
struct State
{
using Message = autoware_adapi_v1_msgs::msg::MotionState;
static constexpr char name[] = "/api/motion/state";
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_ad_api::motion
#endif // AUTOWARE_AD_API_SPECS__MOTION_HPP_
@@ -0,0 +1,73 @@
// 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_AD_API_SPECS__OPERATION_MODE_HPP_
#define AUTOWARE_AD_API_SPECS__OPERATION_MODE_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/operation_mode_state.hpp>
#include <autoware_adapi_v1_msgs/srv/change_operation_mode.hpp>
namespace autoware_ad_api::operation_mode
{
struct ChangeToStop
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/change_to_stop";
};
struct ChangeToAutonomous
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/change_to_autonomous";
};
struct ChangeToLocal
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/change_to_local";
};
struct ChangeToRemote
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/change_to_remote";
};
struct EnableAutowareControl
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/enable_autoware_control";
};
struct DisableAutowareControl
{
using Service = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
static constexpr char name[] = "/api/operation_mode/disable_autoware_control";
};
struct OperationModeState
{
using Message = autoware_adapi_v1_msgs::msg::OperationModeState;
static constexpr char name[] = "/api/operation_mode/state";
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_ad_api::operation_mode
#endif // AUTOWARE_AD_API_SPECS__OPERATION_MODE_HPP_
@@ -0,0 +1,36 @@
// 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_AD_API_SPECS__PERCEPTION_HPP_
#define AUTOWARE_AD_API_SPECS__PERCEPTION_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/dynamic_object_array.hpp>
namespace autoware_ad_api::perception
{
struct DynamicObjectArray
{
using Message = autoware_adapi_v1_msgs::msg::DynamicObjectArray;
static constexpr char name[] = "/api/perception/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_ad_api::perception
#endif // AUTOWARE_AD_API_SPECS__PERCEPTION_HPP_
@@ -0,0 +1,46 @@
// 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_AD_API_SPECS__PLANNING_HPP_
#define AUTOWARE_AD_API_SPECS__PLANNING_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/steering_factor_array.hpp>
#include <autoware_adapi_v1_msgs/msg/velocity_factor_array.hpp>
namespace autoware_ad_api::planning
{
struct VelocityFactors
{
using Message = autoware_adapi_v1_msgs::msg::VelocityFactorArray;
static constexpr char name[] = "/api/planning/velocity_factors";
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 SteeringFactors
{
using Message = autoware_adapi_v1_msgs::msg::SteeringFactorArray;
static constexpr char name[] = "/api/planning/steering_factors";
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_ad_api::planning
#endif // AUTOWARE_AD_API_SPECS__PLANNING_HPP_
@@ -0,0 +1,79 @@
// 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_AD_API_SPECS__ROUTING_HPP_
#define AUTOWARE_AD_API_SPECS__ROUTING_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/route.hpp>
#include <autoware_adapi_v1_msgs/msg/route_state.hpp>
#include <autoware_adapi_v1_msgs/srv/clear_route.hpp>
#include <autoware_adapi_v1_msgs/srv/set_route.hpp>
#include <autoware_adapi_v1_msgs/srv/set_route_points.hpp>
namespace autoware_ad_api::routing
{
struct SetRoutePoints
{
using Service = autoware_adapi_v1_msgs::srv::SetRoutePoints;
static constexpr char name[] = "/api/routing/set_route_points";
};
struct SetRoute
{
using Service = autoware_adapi_v1_msgs::srv::SetRoute;
static constexpr char name[] = "/api/routing/set_route";
};
struct ChangeRoutePoints
{
using Service = autoware_adapi_v1_msgs::srv::SetRoutePoints;
static constexpr char name[] = "/api/routing/change_route_points";
};
struct ChangeRoute
{
using Service = autoware_adapi_v1_msgs::srv::SetRoute;
static constexpr char name[] = "/api/routing/change_route";
};
struct ClearRoute
{
using Service = autoware_adapi_v1_msgs::srv::ClearRoute;
static constexpr char name[] = "/api/routing/clear_route";
};
struct RouteState
{
using Message = autoware_adapi_v1_msgs::msg::RouteState;
static constexpr char name[] = "/api/routing/state";
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 Route
{
using Message = autoware_adapi_v1_msgs::msg::Route;
static constexpr char name[] = "/api/routing/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;
};
} // namespace autoware_ad_api::routing
#endif // AUTOWARE_AD_API_SPECS__ROUTING_HPP_
@@ -0,0 +1,36 @@
// Copyright 2024 The Autoware Contributors
//
// 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_AD_API_SPECS__SYSTEM_HPP_
#define AUTOWARE_AD_API_SPECS__SYSTEM_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/heartbeat.hpp>
namespace autoware_ad_api::system
{
struct Heartbeat
{
using Message = autoware_adapi_v1_msgs::msg::Heartbeat;
static constexpr char name[] = "/api/system/heartbeat";
static constexpr size_t depth = 10;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};
} // namespace autoware_ad_api::system
#endif // AUTOWARE_AD_API_SPECS__SYSTEM_HPP_
@@ -0,0 +1,77 @@
// 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_AD_API_SPECS__VEHICLE_HPP_
#define AUTOWARE_AD_API_SPECS__VEHICLE_HPP_
#include <rclcpp/qos.hpp>
#include <autoware_adapi_v1_msgs/msg/door_status_array.hpp>
#include <autoware_adapi_v1_msgs/msg/vehicle_kinematics.hpp>
#include <autoware_adapi_v1_msgs/msg/vehicle_status.hpp>
#include <autoware_adapi_v1_msgs/srv/get_door_layout.hpp>
#include <autoware_adapi_v1_msgs/srv/get_vehicle_dimensions.hpp>
#include <autoware_adapi_v1_msgs/srv/set_door_command.hpp>
namespace autoware_ad_api::vehicle
{
struct VehicleKinematics
{
using Message = autoware_adapi_v1_msgs::msg::VehicleKinematics;
static constexpr char name[] = "/api/vehicle/kinematics";
static constexpr size_t depth = 1;
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT;
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE;
};
struct VehicleStatus
{
using Message = autoware_adapi_v1_msgs::msg::VehicleStatus;
static constexpr char name[] = "/api/vehicle/status";
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 Dimensions
{
using Service = autoware_adapi_v1_msgs::srv::GetVehicleDimensions;
static constexpr char name[] = "/api/vehicle/dimensions";
};
struct DoorCommand
{
using Service = autoware_adapi_v1_msgs::srv::SetDoorCommand;
static constexpr char name[] = "/api/vehicle/doors/command";
};
struct DoorLayout
{
using Service = autoware_adapi_v1_msgs::srv::GetDoorLayout;
static constexpr char name[] = "/api/vehicle/doors/layout";
};
struct DoorStatus
{
using Message = autoware_adapi_v1_msgs::msg::DoorStatusArray;
static constexpr char name[] = "/api/vehicle/doors/status";
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_ad_api::vehicle
#endif // AUTOWARE_AD_API_SPECS__VEHICLE_HPP_
@@ -0,0 +1,20 @@
<?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_ad_api_specs</name>
<version>0.0.0</version>
<description>The autoware_ad_api_specs package</description>
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
<maintainer email="ryohsuke.mitsudome@tier4.jp">Ryohsuke Mitsudome</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.14)
project(ad_api_adaptors)
find_package(autoware_cmake REQUIRED)
autoware_package()
ament_auto_add_library(${PROJECT_NAME} SHARED
src/initial_pose_adaptor.cpp
src/routing_adaptor.cpp
)
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "ad_api_adaptors::InitialPoseAdaptor"
EXECUTABLE initial_pose_adaptor_node
EXECUTOR MultiThreadedExecutor
)
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "ad_api_adaptors::RoutingAdaptor"
EXECUTABLE routing_adaptor_node
EXECUTOR SingleThreadedExecutor
)
ament_auto_package(INSTALL_TO_SHARE config launch)
@@ -0,0 +1,35 @@
# ad_api_adaptors
## initial_pose_adaptor
This node makes it easy to use the localization AD API from RViz.
When a initial pose topic is received, call the localization initialize API.
This node depends on the map height fitter library.
[See here for more details.](../../../map/autoware_map_height_fitter/README.md)
| Interface | Local Name | Global Name | Description |
| ------------ | ----------- | ---------------------------- | ----------------------------------------- |
| Subscription | initialpose | /initialpose | The pose for localization initialization. |
| Client | - | /api/localization/initialize | The localization initialize API. |
## routing_adaptor
This node makes it easy to use the routing AD API from RViz.
When a goal pose topic is received, reset the waypoints and call the API.
When a waypoint pose topic is received, append it to the end of the waypoints to call the API.
The clear API is called automatically before setting the route.
| Interface | Local Name | Global Name | Description |
| ------------ | ------------------ | ------------------------------------- | -------------------------------------------------- |
| Subscription | - | /api/routing/state | The state of the routing API. |
| Subscription | ~/input/fixed_goal | /planning/mission_planning/goal | The goal pose of route. Disable goal modification. |
| Subscription | ~/input/rough_goal | /rviz/routing/rough_goal | The goal pose of route. Enable goal modification. |
| Subscription | ~/input/reroute | /rviz/routing/reroute | The goal pose of reroute. |
| Subscription | ~/input/waypoint | /planning/mission_planning/checkpoint | The waypoint pose of route. |
| Client | - | /api/routing/clear_route | The route clear API. |
| Client | - | /api/routing/set_route_points | The route points set API. |
| Client | - | /api/routing/change_route_points | The route points change API. |
## parameters
{{ json_to_markdown("/system/default_ad_api_helpers/ad_api_adaptors/schema/ad_api_adaptors.schema.json") }}
@@ -0,0 +1,13 @@
/**:
ros__parameters:
# from initialpose (Rviz's 2DPoseEstimate)
initial_pose_particle_covariance:
[
4.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 4.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.01, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.01, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.01, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
]
@@ -0,0 +1,22 @@
<launch>
<arg name="rviz_initial_pose_auto_fix_target" default="pointcloud_map"/>
<group>
<push-ros-namespace namespace="default_ad_api/helpers"/>
<node pkg="ad_api_adaptors" exec="initial_pose_adaptor_node">
<param from="$(find-pkg-share ad_api_adaptors)/config/initial_pose.param.yaml"/>
<param name="map_height_fitter.map_loader_name" value="/map/pointcloud_map_loader"/>
<param name="map_height_fitter.target" value="$(var rviz_initial_pose_auto_fix_target)"/>
<remap from="~/initialpose" to="/initialpose"/>
<remap from="~/pointcloud_map" to="/map/pointcloud_map"/>
<remap from="~/partial_map_load" to="/map/get_partial_pointcloud_map"/>
<remap from="~/vector_map" to="/map/vector_map"/>
</node>
<node pkg="ad_api_adaptors" exec="routing_adaptor_node">
<remap from="~/input/fixed_goal" to="/planning/mission_planning/goal"/>
<remap from="~/input/rough_goal" to="/rviz/routing/rough_goal"/>
<remap from="~/input/reroute" to="/rviz/routing/reroute"/>
<remap from="~/input/waypoint" to="/planning/mission_planning/checkpoint"/>
</node>
</group>
</launch>
@@ -0,0 +1,28 @@
<?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>ad_api_adaptors</name>
<version>0.1.0</version>
<description>The ad_api_adaptors package</description>
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
<maintainer email="ryohsuke.mitsudome@tier4.jp">Ryohsuke Mitsudome</maintainer>
<maintainer email="yukihiro.saito@tier4.jp">Yukihiro Saito</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>
<depend>autoware_ad_api_specs</depend>
<depend>autoware_adapi_v1_msgs</depend>
<depend>autoware_map_height_fitter</depend>
<depend>component_interface_utils</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>
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ad_api_adaptors parameter",
"type": "object",
"definitions": {
"ad_api_adaptors": {
"type": "object",
"properties": {
"initial_pose_particle_covariance": {
"type": "array",
"description": "initial_pose_particle_covariance",
"default": [
4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1.0
]
}
},
"required": ["initial_pose_particle_covariance"],
"additionalProperties": false
}
},
"properties": {
"/**": {
"type": "object",
"properties": {
"ros__parameters": {
"$ref": "#/definitions/initial_pose_particle_covariance"
}
},
"required": ["ros__parameters"],
"additionalProperties": false
}
},
"required": ["/**"],
"additionalProperties": false
}
@@ -0,0 +1,66 @@
// 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.
#include "initial_pose_adaptor.hpp"
#include <memory>
#include <string>
#include <vector>
namespace ad_api_adaptors
{
template <class ServiceT>
using Future = typename rclcpp::Client<ServiceT>::SharedFuture;
std::array<double, 36> get_covariance_parameter(rclcpp::Node * node, const std::string & name)
{
const auto vector = node->declare_parameter<std::vector<double>>(name);
if (vector.size() != 36) {
throw std::invalid_argument("The covariance parameter size is not 36.");
}
std::array<double, 36> array;
std::copy_n(vector.begin(), array.size(), array.begin());
return array;
}
InitialPoseAdaptor::InitialPoseAdaptor(const rclcpp::NodeOptions & options)
: Node("initial_pose_adaptor", options), fitter_(this)
{
rviz_particle_covariance_ = get_covariance_parameter(this, "initial_pose_particle_covariance");
sub_initial_pose_ = create_subscription<PoseWithCovarianceStamped>(
"~/initialpose", rclcpp::QoS(1),
std::bind(&InitialPoseAdaptor::on_initial_pose, this, std::placeholders::_1));
const auto adaptor = component_interface_utils::NodeAdaptor(this);
adaptor.init_cli(cli_initialize_);
}
void InitialPoseAdaptor::on_initial_pose(const PoseWithCovarianceStamped::ConstSharedPtr msg)
{
PoseWithCovarianceStamped pose = *msg;
const auto fitted = fitter_.fit(pose.pose.pose.position, pose.header.frame_id);
if (fitted) {
pose.pose.pose.position = fitted.value();
}
pose.pose.covariance = rviz_particle_covariance_;
const auto req = std::make_shared<Initialize::Service::Request>();
req->pose.push_back(pose);
cli_initialize_->async_send_request(req);
}
} // namespace ad_api_adaptors
#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(ad_api_adaptors::InitialPoseAdaptor)
@@ -0,0 +1,46 @@
// 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 INITIAL_POSE_ADAPTOR_HPP_
#define INITIAL_POSE_ADAPTOR_HPP_
#include <autoware/map_height_fitter/map_height_fitter.hpp>
#include <autoware_ad_api_specs/localization.hpp>
#include <component_interface_utils/rclcpp.hpp>
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
namespace ad_api_adaptors
{
class InitialPoseAdaptor : public rclcpp::Node
{
public:
explicit InitialPoseAdaptor(const rclcpp::NodeOptions & options);
private:
using PoseWithCovarianceStamped = geometry_msgs::msg::PoseWithCovarianceStamped;
using Initialize = autoware_ad_api::localization::Initialize;
rclcpp::Subscription<PoseWithCovarianceStamped>::SharedPtr sub_initial_pose_;
component_interface_utils::Client<Initialize>::SharedPtr cli_initialize_;
std::array<double, 36> rviz_particle_covariance_;
autoware::map_height_fitter::MapHeightFitter fitter_;
void on_initial_pose(const PoseWithCovarianceStamped::ConstSharedPtr msg);
};
} // namespace ad_api_adaptors
#endif // INITIAL_POSE_ADAPTOR_HPP_
@@ -0,0 +1,115 @@
// 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.
#include "routing_adaptor.hpp"
#include <memory>
namespace ad_api_adaptors
{
RoutingAdaptor::RoutingAdaptor(const rclcpp::NodeOptions & options)
: Node("routing_adaptor", options)
{
using std::placeholders::_1;
sub_fixed_goal_ = create_subscription<PoseStamped>(
"~/input/fixed_goal", 3, std::bind(&RoutingAdaptor::on_fixed_goal, this, _1));
sub_rough_goal_ = create_subscription<PoseStamped>(
"~/input/rough_goal", 3, std::bind(&RoutingAdaptor::on_rough_goal, this, _1));
sub_reroute_ = create_subscription<PoseStamped>(
"~/input/reroute", 3, std::bind(&RoutingAdaptor::on_reroute, this, _1));
sub_waypoint_ = create_subscription<PoseStamped>(
"~/input/waypoint", 10, std::bind(&RoutingAdaptor::on_waypoint, this, _1));
const auto adaptor = component_interface_utils::NodeAdaptor(this);
adaptor.init_cli(cli_reroute_);
adaptor.init_cli(cli_route_);
adaptor.init_cli(cli_clear_);
adaptor.init_sub(
sub_state_, [this](const RouteState::Message::ConstSharedPtr msg) { state_ = msg->state; });
const auto rate = rclcpp::Rate(5.0);
timer_ = rclcpp::create_timer(
this, get_clock(), rate.period(), std::bind(&RoutingAdaptor::on_timer, this));
state_ = RouteState::Message::UNKNOWN;
route_ = std::make_shared<SetRoutePoints::Service::Request>();
}
void RoutingAdaptor::on_timer()
{
// Wait a moment to combine consecutive goals and checkpoints into a single request.
// This value is rate dependent and set the wait time for merging.
constexpr int delay_count = 3; // 0.4 seconds (rate * (value - 1))
if (0 < request_timing_control_ && request_timing_control_ < delay_count) {
++request_timing_control_;
}
if (request_timing_control_ != delay_count) {
return;
}
if (!calling_service_) {
if (state_ != RouteState::Message::UNSET) {
const auto request = std::make_shared<ClearRoute::Service::Request>();
calling_service_ = true;
cli_clear_->async_send_request(request, [this](auto) { calling_service_ = false; });
} else {
request_timing_control_ = 0;
calling_service_ = true;
cli_route_->async_send_request(route_, [this](auto) { calling_service_ = false; });
}
}
}
void RoutingAdaptor::on_fixed_goal(const PoseStamped::ConstSharedPtr pose)
{
request_timing_control_ = 1;
route_->header = pose->header;
route_->goal = pose->pose;
route_->waypoints.clear();
route_->option.allow_goal_modification = false;
}
void RoutingAdaptor::on_rough_goal(const PoseStamped::ConstSharedPtr pose)
{
request_timing_control_ = 1;
route_->header = pose->header;
route_->goal = pose->pose;
route_->waypoints.clear();
route_->option.allow_goal_modification = true;
}
void RoutingAdaptor::on_waypoint(const PoseStamped::ConstSharedPtr pose)
{
if (route_->header.frame_id != pose->header.frame_id) {
RCLCPP_ERROR_STREAM(get_logger(), "The waypoint frame does not match the goal.");
return;
}
request_timing_control_ = 1;
route_->waypoints.push_back(pose->pose);
}
void RoutingAdaptor::on_reroute(const PoseStamped::ConstSharedPtr pose)
{
const auto route = std::make_shared<SetRoutePoints::Service::Request>();
route->header = pose->header;
route->goal = pose->pose;
cli_reroute_->async_send_request(route);
}
} // namespace ad_api_adaptors
#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(ad_api_adaptors::RoutingAdaptor)
@@ -0,0 +1,64 @@
// 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 ROUTING_ADAPTOR_HPP_
#define ROUTING_ADAPTOR_HPP_
#include <autoware_ad_api_specs/routing.hpp>
#include <component_interface_utils/rclcpp.hpp>
#include <rclcpp/rclcpp.hpp>
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <string>
namespace ad_api_adaptors
{
class RoutingAdaptor : public rclcpp::Node
{
public:
explicit RoutingAdaptor(const rclcpp::NodeOptions & options);
private:
using PoseStamped = geometry_msgs::msg::PoseStamped;
using SetRoutePoints = autoware_ad_api::routing::SetRoutePoints;
using ChangeRoutePoints = autoware_ad_api::routing::ChangeRoutePoints;
using ClearRoute = autoware_ad_api::routing::ClearRoute;
using RouteState = autoware_ad_api::routing::RouteState;
component_interface_utils::Client<ChangeRoutePoints>::SharedPtr cli_reroute_;
component_interface_utils::Client<SetRoutePoints>::SharedPtr cli_route_;
component_interface_utils::Client<ClearRoute>::SharedPtr cli_clear_;
component_interface_utils::Subscription<RouteState>::SharedPtr sub_state_;
rclcpp::Subscription<PoseStamped>::SharedPtr sub_fixed_goal_;
rclcpp::Subscription<PoseStamped>::SharedPtr sub_rough_goal_;
rclcpp::Subscription<PoseStamped>::SharedPtr sub_waypoint_;
rclcpp::Subscription<PoseStamped>::SharedPtr sub_reroute_;
rclcpp::TimerBase::SharedPtr timer_;
bool calling_service_ = false;
int request_timing_control_ = 0;
SetRoutePoints::Service::Request::SharedPtr route_;
RouteState::Message::_state_type state_;
void on_timer();
void on_fixed_goal(const PoseStamped::ConstSharedPtr pose);
void on_rough_goal(const PoseStamped::ConstSharedPtr pose);
void on_waypoint(const PoseStamped::ConstSharedPtr pose);
void on_reroute(const PoseStamped::ConstSharedPtr pose);
};
} // namespace ad_api_adaptors
#endif // ROUTING_ADAPTOR_HPP_
@@ -0,0 +1,47 @@
# Modified from https://github.com/ament/ament_lint/blob/master/ament_clang_format/ament_clang_format/configuration/.clang-format
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AllowShortFunctionsOnASingleLine: InlineOnly
BraceWrapping:
AfterClass: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: true
IncludeCategories:
# C++ system headers
- Regex: <[a-z_]*>
Priority: 6
CaseSensitive: true
# C system headers
- Regex: <.*\.h>
Priority: 5
CaseSensitive: true
# Boost headers
- Regex: boost/.*
Priority: 4
CaseSensitive: true
# Message headers
- Regex: .*_msgs/.*
Priority: 3
CaseSensitive: true
- Regex: .*_srvs/.*
Priority: 3
CaseSensitive: true
# Other Package headers
- Regex: <.*>
Priority: 2
CaseSensitive: true
# Local package headers
- Regex: '".*"'
Priority: 1
CaseSensitive: true
@@ -0,0 +1,56 @@
## PR Type
<!-- Select one and remove others. If an appropriate one is not listed, please write by yourself. -->
- New Feature
- Improvement
- Bug Fix
## Related Links
<!-- Please write related links to GitHub/Jira/Slack/etc. -->
## Description
<!-- Describe what this PR changes. -->
## Review Procedure
<!-- Explain how to review this PR. -->
## Remarks
<!-- Write remarks as you like if you need them. -->
## Pre-Review Checklist for the PR Author
**PR Author should check the checkboxes below when creating the PR.**
- [ ] Code follows [coding guidelines][coding-guidelines]
- [ ] Assign PR to reviewer
## Checklist for the PR Reviewer
**Reviewers should check the checkboxes below before approval.**
- [ ] Commits are properly organized and messages are according to the guideline
- [ ] Code follows [coding guidelines][coding-guidelines]
- [ ] (Optional) Unit tests have been written for new behavior
- [ ] PR title describes the changes
## Post-Review Checklist for the PR Author
**PR Author should check the checkboxes below before merging.**
- [ ] All open points are addressed and tracked via issues or tickets
- [ ] Write [release notes][release-notes]
## CI Checks
- **Build and test for PR / build-and-test-pr**: Required to pass before the merge.
- **Build and test for PR / clang-tidy-pr**: NOT required to pass before the merge. It is up to the reviewer(s).
- **Check spelling**: NOT required to pass before the merge. It is up to the reviewer(s). See [here][spell-check-dict] if you want to add some words to the spell check dictionary.
[coding-guidelines]: https://tier4.atlassian.net/wiki/spaces/AIP/pages/1194394777/T4
[release-notes]: https://tier4.atlassian.net/wiki/spaces/AIP/pages/563774416
[spell-check-dict]: https://github.com/tier4/autoware-spell-check-dict#how-to-contribute
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
open-pull-requests-limit: 1
labels:
- tag:bot
- type:github-actions
@@ -0,0 +1,20 @@
- repository: autowarefoundation/autoware_common
files:
- source: .github/dependabot.yaml
- source: .github/workflows/build-and-test.yaml
- source: .github/workflows/build-and-test-differential.yaml
- source: .github/workflows/pre-commit.yaml
- source: .github/workflows/pre-commit-optional.yaml
- source: .github/workflows/semantic-pull-request.yaml
- source: .github/workflows/spell-check-differential.yaml
- source: .github/workflows/sync-files.yaml
- source: .clang-format
- source: .markdown-link-check.json
- source: .markdownlint.yaml
- source: .pre-commit-config.yaml
- source: .pre-commit-config-optional.yaml
- source: .prettierignore
- source: .prettierrc.yaml
- source: .yamllint.yaml
- source: CPPLINT.cfg
- source: setup.cfg
@@ -0,0 +1,91 @@
name: build-and-test-differential
on:
pull_request:
jobs:
build-and-test-differential:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
rosdistro:
- humble
include:
- rosdistro: humble
container: ros:humble
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
- name: Build
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Test
id: test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v3
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: differential
clang-tidy-differential:
runs-on: ubuntu-latest
container: ros:humble
needs: build-and-test-differential
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
- name: Get modified files
id: get-modified-files
uses: tj-actions/changed-files@v42
with:
files: |
**/*.cpp
**/*.hpp
- name: Run clang-tidy
if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
target-files: ${{ steps.get-modified-files.outputs.all_changed_files }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
build-depends-repos: build_depends.repos
@@ -0,0 +1,69 @@
name: build-and-test
on:
push:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
build-and-test:
if: ${{ github.event_name != 'push' || github.ref_name == github.event.repository.default_branch }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
rosdistro:
- humble
include:
- rosdistro: humble
container: ros:humble
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Free disk space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
dotnet: false
swap-storage: false
large-packages: false
- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
- name: Get self packages
id: get-self-packages
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1
- name: Build
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Test
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
id: test
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v3
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: total
- name: Show disk space after the tasks
run: df -h
@@ -0,0 +1,19 @@
name: pre-commit-optional
on:
pull_request:
jobs:
pre-commit-optional:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config-optional.yaml
base-branch: origin/${{ github.base_ref }}
@@ -0,0 +1,27 @@
name: pre-commit
on:
pull_request:
jobs:
pre-commit:
if: ${{ github.event.repository.private }} # Use pre-commit.ci for public repositories
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config.yaml
token: ${{ steps.generate-token.outputs.token }}
@@ -0,0 +1,12 @@
name: semantic-pull-request
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
semantic-pull-request:
uses: autowarefoundation/autoware-github-actions/.github/workflows/semantic-pull-request.yaml@v1
@@ -0,0 +1,16 @@
name: spell-check-differential
on:
pull_request:
jobs:
spell-check-differential:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Run spell-check
uses: autowarefoundation/autoware-github-actions/spell-check@v1
with:
cspell-json-url: https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/.cspell.json
@@ -0,0 +1,33 @@
name: sync-files
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
check-secret:
uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1
secrets:
secret: ${{ secrets.APP_ID }}
sync-files:
needs: check-secret
if: ${{ needs.check-secret.outputs.set == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Run sync-files
uses: autowarefoundation/autoware-github-actions/sync-files@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pr-labels: |
tag:bot
tag:sync-files
auto-merge-method: squash
@@ -0,0 +1,30 @@
name: sync-micro-bus
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
sync-micro-bus:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Run sync-branches
uses: autowarefoundation/autoware-github-actions/sync-branches@v1
with:
token: ${{ steps.generate-token.outputs.token }}
base-branch: micro-bus
sync-pr-branch: sync-micro-bus
sync-target-repository: https://github.com/tier4/tier4_ad_api_adaptor
sync-target-branch: tier4/universe
pr-title: "chore: sync-micro-bus"
pr-labels: |
bot
sync-micro-bus
@@ -0,0 +1,16 @@
{
"aliveStatusCodes": [200, 206, 403],
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^http://127\\.0\\.0\\.1"
},
{
"pattern": "^https://github.com/.*/discussions/new"
}
],
"retryOn429": true,
"retryCount": 10
}
@@ -0,0 +1,11 @@
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules.
default: true
MD013: false
MD024:
siblings_only: true
MD029:
style: ordered
MD033: false
MD041: false
MD046: false
MD049: false
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/tcort/markdown-link-check
rev: v3.11.2
hooks:
- id: markdown-link-check
args: [--quiet, --config=.markdown-link-check.json]
@@ -0,0 +1,95 @@
ci:
autofix_commit_msg: "style(pre-commit): autofix"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
args: [--unsafe]
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
hooks:
- id: markdownlint
args: [-c, .markdownlint.yaml, --fix]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.6
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint
rev: v1.30.0
hooks:
- id: yamllint
- repo: https://github.com/tier4/pre-commit-hooks-ros
rev: v0.8.0
hooks:
- id: flake8-ros
- id: prettier-xacro
- id: prettier-launch-xml
- id: prettier-package-xml
- id: ros-include-guard
- id: sort-package-xml
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-2
hooks:
- id: shfmt
args: [-w, -s, -i=4]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.0
hooks:
- id: clang-format
types_or: [c++, c, cuda]
- repo: https://github.com/cpplint/cpplint
rev: 1.6.1
hooks:
- id: cpplint
args: [--quiet]
exclude: .cu
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.2
hooks:
- id: check-metaschema
files: ^.+/schema/.*schema\.json$
- repo: local
hooks:
- id: prettier-svg
name: prettier svg
description: Apply Prettier with plugin-xml to svg.
entry: prettier --write --list-different --ignore-unknown --print-width 200 --xml-self-closing-space false --xml-whitespace-sensitivity ignore
language: node
files: .svg$
additional_dependencies: [prettier@2.7.1, "@prettier/plugin-xml@2.2.0"]
@@ -0,0 +1,2 @@
*.param.yaml
*.rviz
@@ -0,0 +1,20 @@
printWidth: 100
tabWidth: 2
overrides:
- files: package.xml
options:
printWidth: 1000
xmlSelfClosingSpace: false
xmlWhitespaceSensitivity: ignore
- files: "*.launch.xml"
options:
printWidth: 200
xmlSelfClosingSpace: false
xmlWhitespaceSensitivity: ignore
- files: "*.xacro"
options:
printWidth: 200
xmlSelfClosingSpace: false
xmlWhitespaceSensitivity: ignore
@@ -0,0 +1,22 @@
extends: default
ignore: |
*.param.yaml
rules:
braces:
level: error
max-spaces-inside: 1 # To format with Prettier
comments:
level: error
min-spaces-from-content: 1 # To be compatible with C++ and Python
document-start:
level: error
present: false # Don't need document start markers
line-length: disable # Delegate to Prettier
truthy:
level: error
check-keys: false # To allow 'on' of GitHub Actions
quoted-strings:
level: error
required: only-when-needed # To keep consistent style
@@ -0,0 +1,14 @@
# Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_cpplint/ament_cpplint/main.py#L64-L120
set noparent
linelength=100
includeorder=standardcfirst
filter=-build/c++11 # we do allow C++11
filter=-build/namespaces_literals # we allow using namespace for literals
filter=-runtime/references # we consider passing non-const references to be ok
filter=-whitespace/braces # we wrap open curly braces for namespaces, classes and functions
filter=-whitespace/indent # we don't indent keywords like public, protected and private with one space
filter=-whitespace/parens # we allow closing parenthesis to be on the next line
filter=-whitespace/semicolon # we allow the developer to decide about whitespace after a semicolon
filter=-build/header_guard # we automatically fix the names of header guards using pre-commit
filter=-build/include_order # we use the custom include order
filter=-build/include_subdir # we allow the style of "foo.hpp"
@@ -0,0 +1 @@
# Autoware High Level API
@@ -0,0 +1,25 @@
repositories:
core/common:
type: git
url: https://github.com/autowarefoundation/autoware_common.git
version: main
msgs/autoware_msgs:
type: git
url: https://github.com/autowarefoundation/autoware_msgs.git
version: main
msgs/autoware_adapi_msgs:
type: git
url: https://github.com/autowarefoundation/autoware_adapi_msgs.git
version: main
msg/autoware_internal_msgs:
type: git
url: https://github.com/autowarefoundation/autoware_internal_msgs.git
version: main
universe/tier4_autoware_msgs:
type: git
url: https://github.com/tier4/tier4_autoware_msgs.git
version: tier4/universe
universe/universe:
type: git
url: https://github.com/autowarefoundation/autoware.universe
version: main
@@ -0,0 +1,15 @@
[flake8]
# Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_flake8/ament_flake8/configuration/ament_flake8.ini
extend-ignore = B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202,CNL100,E203,E501,Q000
import-order-style = pep8
max-line-length = 100
show-source = true
statistics = true
[isort]
profile=black
line_length=100
force_sort_within_sections=true
force_single_line=true
reverse_relative=true
known_third_party=launch
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.14)
project(tier4_api_utils)
find_package(autoware_cmake REQUIRED)
autoware_package()
if(BUILD_TESTING)
include_directories(include)
ament_add_ros_isolated_gtest(${PROJECT_NAME}_test test/test.cpp)
ament_target_dependencies(${PROJECT_NAME}_test rclcpp tier4_external_api_msgs)
endif()
ament_auto_package()
+4
View File
@@ -0,0 +1,4 @@
# tier4_api_utils
This is an old implementation of a class that logs when calling a service.
Please use [component_interface_utils](../component_interface_utils/README.md) instead.
@@ -0,0 +1,70 @@
// Copyright 2021 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 TIER4_API_UTILS__RCLCPP__CLIENT_HPP_
#define TIER4_API_UTILS__RCLCPP__CLIENT_HPP_
#include "rclcpp/client.hpp"
#include "tier4_api_utils/types/response.hpp"
#include <chrono>
#include <utility>
namespace tier4_api_utils
{
template <typename ServiceT>
class Client
{
public:
RCLCPP_SMART_PTR_DEFINITIONS(Client)
using ResponseStatus = tier4_external_api_msgs::msg::ResponseStatus;
using AutowareServiceResult = std::pair<ResponseStatus, typename ServiceT::Response::SharedPtr>;
Client(typename rclcpp::Client<ServiceT>::SharedPtr client, const rclcpp::Logger & logger)
: client_(client), logger_(logger)
{
}
AutowareServiceResult call(
const typename ServiceT::Request::SharedPtr & request,
const std::chrono::nanoseconds & timeout = std::chrono::seconds(2))
{
RCLCPP_DEBUG(logger_, "client request");
if (!client_->service_is_ready()) {
RCLCPP_DEBUG(logger_, "client available");
return {response_error("Internal service is not available."), nullptr};
}
auto future = client_->async_send_request(request);
if (future.wait_for(timeout) != std::future_status::ready) {
RCLCPP_DEBUG(logger_, "client timeout");
return {response_error("Internal service has timed out."), nullptr};
}
RCLCPP_DEBUG(logger_, "client response");
return {response_success(), future.get()};
}
private:
RCLCPP_DISABLE_COPY(Client)
typename rclcpp::Client<ServiceT>::SharedPtr client_;
rclcpp::Logger logger_;
};
} // namespace tier4_api_utils
#endif // TIER4_API_UTILS__RCLCPP__CLIENT_HPP_
@@ -0,0 +1,63 @@
// Copyright 2021 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 TIER4_API_UTILS__RCLCPP__PROXY_HPP_
#define TIER4_API_UTILS__RCLCPP__PROXY_HPP_
#include "rclcpp/rclcpp.hpp"
#include "tier4_api_utils/rclcpp/client.hpp"
#include "tier4_api_utils/rclcpp/service.hpp"
#include <string>
#include <utility>
namespace tier4_api_utils
{
template <class NodeT>
class ServiceProxyNodeInterface
{
public:
// Use a raw pointer because shared_from_this cannot be used in constructor.
explicit ServiceProxyNodeInterface(NodeT * node) { node_ = node; }
template <typename ServiceT, typename CallbackT>
typename Service<ServiceT>::SharedPtr create_service(
const std::string & service_name, CallbackT && callback,
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
rclcpp::CallbackGroup::SharedPtr group = nullptr)
{
auto wrapped_callback = Service<ServiceT>::template wrap<CallbackT>(
std::forward<CallbackT>(callback), node_->get_logger());
return Service<ServiceT>::make_shared(node_->template create_service<ServiceT>(
service_name, std::move(wrapped_callback), qos_profile, group));
}
template <typename ServiceT>
typename Client<ServiceT>::SharedPtr create_client(
const std::string & service_name,
const rmw_qos_profile_t & qos_profile = rmw_qos_profile_services_default,
rclcpp::CallbackGroup::SharedPtr group = nullptr)
{
return Client<ServiceT>::make_shared(
node_->template create_client<ServiceT>(service_name, qos_profile, group),
node_->get_logger());
}
private:
NodeT * node_;
};
} // namespace tier4_api_utils
#endif // TIER4_API_UTILS__RCLCPP__PROXY_HPP_
@@ -0,0 +1,51 @@
// Copyright 2021 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 TIER4_API_UTILS__RCLCPP__SERVICE_HPP_
#define TIER4_API_UTILS__RCLCPP__SERVICE_HPP_
#include "rclcpp/service.hpp"
namespace tier4_api_utils
{
template <typename ServiceT>
class Service
{
public:
RCLCPP_SMART_PTR_DEFINITIONS(Service)
explicit Service(typename rclcpp::Service<ServiceT>::SharedPtr service) : service_(service) {}
template <typename CallbackT>
static auto wrap(CallbackT && callback, const rclcpp::Logger & logger)
{
auto wrapped_callback = [logger, callback](
typename ServiceT::Request::SharedPtr request,
typename ServiceT::Response::SharedPtr response) {
RCLCPP_INFO(logger, "service request");
callback(request, response);
RCLCPP_INFO(logger, "service response");
};
return wrapped_callback;
}
private:
RCLCPP_DISABLE_COPY(Service)
typename rclcpp::Service<ServiceT>::SharedPtr service_;
};
} // namespace tier4_api_utils
#endif // TIER4_API_UTILS__RCLCPP__SERVICE_HPP_
@@ -0,0 +1,21 @@
// Copyright 2021 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 TIER4_API_UTILS__TIER4_API_UTILS_HPP_
#define TIER4_API_UTILS__TIER4_API_UTILS_HPP_
#include "tier4_api_utils/rclcpp/proxy.hpp"
#include "tier4_api_utils/types/response.hpp"
#endif // TIER4_API_UTILS__TIER4_API_UTILS_HPP_
@@ -0,0 +1,78 @@
// Copyright 2021 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 TIER4_API_UTILS__TYPES__RESPONSE_HPP_
#define TIER4_API_UTILS__TYPES__RESPONSE_HPP_
#include "rclcpp/rclcpp.hpp"
#include "tier4_external_api_msgs/msg/response_status.hpp"
#include <string>
namespace tier4_api_utils
{
using ResponseStatus = tier4_external_api_msgs::msg::ResponseStatus;
inline bool is_success(const tier4_external_api_msgs::msg::ResponseStatus & status)
{
return status.code == tier4_external_api_msgs::msg::ResponseStatus::SUCCESS;
}
inline bool is_ignored(const tier4_external_api_msgs::msg::ResponseStatus & status)
{
return status.code == tier4_external_api_msgs::msg::ResponseStatus::IGNORED;
}
inline bool is_warn(const tier4_external_api_msgs::msg::ResponseStatus & status)
{
return status.code == tier4_external_api_msgs::msg::ResponseStatus::WARN;
}
inline bool is_error(const tier4_external_api_msgs::msg::ResponseStatus & status)
{
return status.code == tier4_external_api_msgs::msg::ResponseStatus::ERROR;
}
inline ResponseStatus response_success(const std::string & message = "")
{
return tier4_external_api_msgs::build<tier4_external_api_msgs::msg::ResponseStatus>()
.code(tier4_external_api_msgs::msg::ResponseStatus::SUCCESS)
.message(message);
}
inline ResponseStatus response_ignored(const std::string & message = "")
{
return tier4_external_api_msgs::build<tier4_external_api_msgs::msg::ResponseStatus>()
.code(tier4_external_api_msgs::msg::ResponseStatus::IGNORED)
.message(message);
}
inline ResponseStatus response_warn(const std::string & message = "")
{
return tier4_external_api_msgs::build<tier4_external_api_msgs::msg::ResponseStatus>()
.code(tier4_external_api_msgs::msg::ResponseStatus::WARN)
.message(message);
}
inline ResponseStatus response_error(const std::string & message = "")
{
return tier4_external_api_msgs::build<tier4_external_api_msgs::msg::ResponseStatus>()
.code(tier4_external_api_msgs::msg::ResponseStatus::ERROR)
.message(message);
}
} // namespace tier4_api_utils
#endif // TIER4_API_UTILS__TYPES__RESPONSE_HPP_
+27
View File
@@ -0,0 +1,27 @@
<?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>tier4_api_utils</name>
<version>0.0.0</version>
<description>The tier4_api_utils package</description>
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>tier4_external_api_msgs</depend>
<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>rclcpp</test_depend>
<test_depend>tier4_external_api_msgs</test_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
@@ -0,0 +1,32 @@
// Copyright 2021 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.
#include "gtest/gtest.h"
#include "rclcpp/rclcpp.hpp"
#include "tier4_api_utils/tier4_api_utils.hpp"
TEST(tier4_api_utils, instantiate)
{
rclcpp::Node node("tier4_api_utils_test");
tier4_api_utils::ServiceProxyNodeInterface proxy(&node);
}
int main(int argc, char ** argv)
{
testing::InitGoogleTest(&argc, argv);
rclcpp::init(argc, argv);
bool result = RUN_ALL_TESTS();
rclcpp::shutdown();
return result;
}