forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pose_initializer): add a method type to the `/localization/initi…
…alize` service. (autowarefoundation#7048) * change message type of InitializeLocalization in component_interface_specs Signed-off-by: Yamato Ando <[email protected]> * change message type of InitializeLocalizaion in pose_initializer Signed-off-by: Yamato Ando <[email protected]> * modify readme Signed-off-by: Yamato Ando <[email protected]> * style(pre-commit): autofix * delete redundant line Signed-off-by: Yamato Ando <[email protected]> * fix typo Signed-off-by: Yamato Ando <[email protected]> * Update localization/pose_initializer/src/pose_initializer/pose_initializer_core.cpp Co-authored-by: Ryohsuke Mitsudome <[email protected]> * add description in readme Signed-off-by: Yamato Ando <[email protected]> * style(pre-commit): autofix * add bash Signed-off-by: Yamato Ando <[email protected]> --------- Signed-off-by: Yamato Ando <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ryohsuke Mitsudome <[email protected]>
- Loading branch information
1 parent
65503cf
commit 30dba21
Showing
10 changed files
with
241 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
system/default_ad_api/src/utils/localization_conversion.cpp
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,40 @@ | ||
// Copyright 2024 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_conversion.hpp" | ||
|
||
#include <memory> | ||
|
||
namespace default_ad_api::localization_conversion | ||
{ | ||
|
||
InternalInitializeRequest convert_request(const ExternalInitializeRequest & external) | ||
{ | ||
auto internal = std::make_shared<InternalInitializeRequest::element_type>(); | ||
internal->pose_with_covariance = external->pose; | ||
internal->method = tier4_localization_msgs::srv::InitializeLocalization::Request::AUTO; | ||
return internal; | ||
} | ||
|
||
ExternalResponse convert_response(const InternalResponse & internal) | ||
{ | ||
// TODO(Takagi, Isamu): check error code correspondence | ||
ExternalResponse external; | ||
external.success = internal.success; | ||
external.code = internal.code; | ||
external.message = internal.message; | ||
return external; | ||
} | ||
|
||
} // namespace default_ad_api::localization_conversion |
44 changes: 44 additions & 0 deletions
44
system/default_ad_api/src/utils/localization_conversion.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,44 @@ | ||
// Copyright 2024 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 UTILS__LOCALIZATION_CONVERSION_HPP_ | ||
#define UTILS__LOCALIZATION_CONVERSION_HPP_ | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <autoware_adapi_v1_msgs/srv/initialize_localization.hpp> | ||
#include <tier4_localization_msgs/srv/initialize_localization.hpp> | ||
|
||
namespace default_ad_api::localization_conversion | ||
{ | ||
|
||
using ExternalInitializeRequest = | ||
autoware_adapi_v1_msgs::srv::InitializeLocalization::Request::SharedPtr; | ||
using InternalInitializeRequest = | ||
tier4_localization_msgs::srv::InitializeLocalization::Request::SharedPtr; | ||
InternalInitializeRequest convert_request(const ExternalInitializeRequest & external); | ||
|
||
using ExternalResponse = autoware_adapi_v1_msgs::msg::ResponseStatus; | ||
using InternalResponse = autoware_common_msgs::msg::ResponseStatus; | ||
ExternalResponse convert_response(const InternalResponse & internal); | ||
|
||
template <class ClientT, class RequestT> | ||
ExternalResponse convert_call(ClientT & client, RequestT & req) | ||
{ | ||
return convert_response(client->call(convert_request(req))->status); | ||
} | ||
|
||
} // namespace default_ad_api::localization_conversion | ||
|
||
#endif // UTILS__LOCALIZATION_CONVERSION_HPP_ |