-
Notifications
You must be signed in to change notification settings - Fork 668
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(default_ad_api): add localization api #1431
Changes from 3 commits
b6ede8b
ec2b06c
8c987eb
0dcffb2
d74888e
20dba3f
6f51ee0
ee6b428
fdde4f2
905ecfb
6b5a07d
92b5c7e
2a0bc7e
5ec7d38
b423776
566554e
122701c
e5db1a7
7f6cfda
bc02465
acdfc3f
f4ce862
cf1f540
b94a6d8
5431400
925589b
2af3217
7eaefe2
de6a32c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
uint16 UNKNOWN = 0 | ||
uint16 UNINITIALIZED = 1 | ||
uint16 INITIALIZING = 2 | ||
uint16 INITIALIZED = 3 | ||
|
||
builtin_interfaces/Time stamp | ||
uint16 state |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
geometry_msgs/PoseWithCovarianceStamped[<=1] pose | ||
--- | ||
uint16 ERROR_UNSAFE = 1 | ||
uint16 ERROR_GNSS_SUPPORT = 2 | ||
uint16 ERROR_GNSS = 3 | ||
uint16 ERROR_ESTIMATION = 4 | ||
autoware_ad_api_msgs/ResponseStatus status |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ad_api_msgs/msg/localization_initialization_state.hpp> | ||
#include <autoware_ad_api_msgs/srv/initialize_localization.hpp> | ||
|
||
namespace autoware_ad_api::localization | ||
{ | ||
|
||
struct Initialize | ||
{ | ||
using Service = autoware_ad_api_msgs::srv::InitializeLocalization; | ||
static constexpr char name[] = "/api/localization/initialize"; | ||
}; | ||
|
||
struct InitializationState | ||
{ | ||
using Message = autoware_ad_api_msgs::msg::LocalizationInitializationState; | ||
static constexpr char name[] = "/api/localization/initialization_state"; | ||
static constexpr size_t depth = 3; | ||
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_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
|
||
<build_depend>autoware_cmake</build_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>autoware_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(component_interface_specs) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
ament_auto_package() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ | ||
#define COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ | ||
|
||
#include <rclcpp/qos.hpp> | ||
|
||
#include <autoware_ad_api_msgs/msg/localization_initialization_state.hpp> | ||
#include <autoware_ad_api_msgs/srv/initialize_localization.hpp> | ||
|
||
namespace localization_interface | ||
{ | ||
|
||
struct Initialize | ||
{ | ||
using Service = autoware_ad_api_msgs::srv::InitializeLocalization; | ||
static constexpr char name[] = "/localization/initialize"; | ||
}; | ||
|
||
struct InitializationState | ||
{ | ||
using Message = autoware_ad_api_msgs::msg::LocalizationInitializationState; | ||
static constexpr char name[] = "/localization/initialization_state"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yukkysaito @mitsudome-r Do you have any opinions on the namings of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose these are okay. |
||
static constexpr size_t depth = 3; | ||
static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; | ||
static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; | ||
}; | ||
|
||
} // namespace localization_interface | ||
|
||
#endif // COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>component_interface_specs</name> | ||
<version>0.0.0</version> | ||
<description>The component_interface_specs package</description> | ||
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer> | ||
<license>Apache License 2.0</license> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
|
||
<build_depend>autoware_cmake</build_depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>autoware_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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 "localization.hpp" | ||
|
||
namespace default_ad_api | ||
{ | ||
|
||
LocalizationNode::LocalizationNode(const rclcpp::NodeOptions & options) | ||
: Node("localization", options) | ||
{ | ||
const auto node = component_interface_utils::NodeAdaptor(this); | ||
kenji-miyake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
group_srv_ = create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive); | ||
node.relay_message(pub_state_, sub_state_); | ||
node.relay_service(cli_initialize_, srv_initialize_, group_srv_); | ||
} | ||
|
||
} // namespace default_ad_api | ||
|
||
#include <rclcpp_components/register_node_macro.hpp> | ||
RCLCPP_COMPONENTS_REGISTER_NODE(default_ad_api::LocalizationNode) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 LOCALIZATION_HPP_ | ||
#define LOCALIZATION_HPP_ | ||
|
||
#include <autoware_ad_api_specs/localization.hpp> | ||
#include <component_interface_specs/localization.hpp> | ||
#include <component_interface_utils/rclcpp.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
using Initialize1 = autoware_ad_api::localization::Initialize; | ||
using Initialize2 = localization_interface::Initialize; | ||
using State1 = autoware_ad_api::localization::InitializationState; | ||
using State2 = localization_interface::InitializationState; | ||
|
||
namespace default_ad_api | ||
{ | ||
kenji-miyake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class LocalizationNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit LocalizationNode(const rclcpp::NodeOptions & options); | ||
|
||
private: | ||
rclcpp::CallbackGroup::SharedPtr group_srv_; | ||
component_interface_utils::Service<Initialize1>::SharedPtr srv_initialize_; | ||
component_interface_utils::Client<Initialize2>::SharedPtr cli_initialize_; | ||
component_interface_utils::Publisher<State1>::SharedPtr pub_state_; | ||
component_interface_utils::Subscription<State2>::SharedPtr sub_state_; | ||
}; | ||
|
||
} // namespace default_ad_api | ||
|
||
#endif // LOCALIZATION_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
project(default_ad_api_helpers) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
ament_auto_add_executable(automatic_pose_initializer | ||
src/automatic_pose_initializer.cpp | ||
) | ||
|
||
ament_auto_add_executable(initial_pose_adaptor | ||
src/initial_pose_adaptor.cpp | ||
) | ||
|
||
ament_auto_package(INSTALL_TO_SHARE config launch) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# default_ad_api_helpers | ||
|
||
## initial_pose_adaptor | ||
kenji-miyake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 fitting to map height service. | ||
|
||
| Interface | Local Name | Global Name | Description | | ||
| ------------ | -------------- | --------------------------------- | ----------------------------------------- | | ||
| Subscription | initialpose | /initialpose | The pose for localization initialization. | | ||
kenji-miyake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Client | fit_map_height | /localization/util/fit_map_height | To fix initial pose to map height | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you tell me where this service is implemented, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've found it in #1500. |
||
| Client | - | /api/localization/initialize | The localization initialize API. | | ||
|
||
## automatic_pose_initializer | ||
|
||
This node calls localization initialize API when the localization initialization state is uninitialized. | ||
Since the API uses GNSS pose when no pose is specified, initialization using GNSS can be performed automatically. | ||
|
||
| Interface | Local Name | Global Name | Description | | ||
| ------------ | ---------- | -------------------------------------- | ------------------------------------------ | | ||
| Subscription | - | /api/localization/initialization_state | The localization initialization state API. | | ||
| Client | - | /api/localization/initialize | The localization initialize API. | |
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.
Could you write brief descriptions of these error types?
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.