forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pose_initilizer): support gnss/imu pose estimator (autowarefound…
…ation#2904) * Support GNSS/IMU pose estimator Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * style(pre-commit): autofix Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Revert gnss/imu support Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Support GNSS/IMU pose estimator Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * style(pre-commit): autofix Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Separate EKF and NDT trigger modules Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Integrate activate and deactivate into sendRequest Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * style(pre-commit): autofix Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Change sendRequest function arguments Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * style(pre-commit): autofix Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Remove unused conditional branches Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Fix command name Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Change to snake_case Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Fix typos Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Update localization/pose_initializer/src/pose_initializer/ekf_localization_trigger_module.cpp Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com> Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Update localization/pose_initializer/src/pose_initializer/ndt_localization_trigger_module.cpp Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com> Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Update copyright year Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Set the copyright year of ekf_localization_module to 2022 Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Delete unnecessary conditional branches Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Add ekf_enabled parameter Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> * Add #include <string> Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> --------- Signed-off-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ryohei Sasaki <ryohei.sasaki@map4.jp> Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com>
- Loading branch information
1 parent
2b221b8
commit 53daf9a
Showing
12 changed files
with
181 additions
and
92 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
56 changes: 56 additions & 0 deletions
56
localization/pose_initializer/src/pose_initializer/ekf_localization_trigger_module.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,56 @@ | ||
// Copyright 2022 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. | ||
|
||
#include "ekf_localization_trigger_module.hpp" | ||
|
||
#include <component_interface_specs/localization.hpp> | ||
#include <component_interface_utils/rclcpp/exceptions.hpp> | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
using ServiceException = component_interface_utils::ServiceException; | ||
using Initialize = localization_interface::Initialize; | ||
|
||
EkfLocalizationTriggerModule::EkfLocalizationTriggerModule(rclcpp::Node * node) | ||
: logger_(node->get_logger()) | ||
{ | ||
client_ekf_trigger_ = node->create_client<SetBool>("ekf_trigger_node"); | ||
} | ||
|
||
void EkfLocalizationTriggerModule::send_request(bool flag) const | ||
{ | ||
const auto req = std::make_shared<SetBool::Request>(); | ||
std::string command_name; | ||
req->data = flag; | ||
if (flag) { | ||
command_name = "Activation"; | ||
} else { | ||
command_name = "Deactivation"; | ||
} | ||
|
||
if (!client_ekf_trigger_->service_is_ready()) { | ||
throw component_interface_utils::ServiceUnready("EKF triggering service is not ready"); | ||
} | ||
|
||
auto future_ekf = client_ekf_trigger_->async_send_request(req); | ||
|
||
if (future_ekf.get()->success) { | ||
RCLCPP_INFO(logger_, "EKF %s succeeded", command_name.c_str()); | ||
} else { | ||
RCLCPP_INFO(logger_, "EKF %s failed", command_name.c_str()); | ||
throw ServiceException( | ||
Initialize::Service::Response::ERROR_ESTIMATION, "EKF " + command_name + " failed"); | ||
} | ||
} |
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
75 changes: 0 additions & 75 deletions
75
localization/pose_initializer/src/pose_initializer/localization_trigger_module.cpp
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
localization/pose_initializer/src/pose_initializer/ndt_localization_trigger_module.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,56 @@ | ||
// Copyright 2023 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. | ||
|
||
#include "ndt_localization_trigger_module.hpp" | ||
|
||
#include <component_interface_specs/localization.hpp> | ||
#include <component_interface_utils/rclcpp/exceptions.hpp> | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
using ServiceException = component_interface_utils::ServiceException; | ||
using Initialize = localization_interface::Initialize; | ||
|
||
NdtLocalizationTriggerModule::NdtLocalizationTriggerModule(rclcpp::Node * node) | ||
: logger_(node->get_logger()) | ||
{ | ||
client_ndt_trigger_ = node->create_client<SetBool>("ndt_trigger_node"); | ||
} | ||
|
||
void NdtLocalizationTriggerModule::send_request(bool flag) const | ||
{ | ||
const auto req = std::make_shared<SetBool::Request>(); | ||
std::string command_name; | ||
req->data = flag; | ||
if (flag) { | ||
command_name = "Activation"; | ||
} else { | ||
command_name = "Deactivation"; | ||
} | ||
|
||
if (!client_ndt_trigger_->service_is_ready()) { | ||
throw component_interface_utils::ServiceUnready("NDT triggering service is not ready"); | ||
} | ||
|
||
auto future_ndt = client_ndt_trigger_->async_send_request(req); | ||
|
||
if (future_ndt.get()->success) { | ||
RCLCPP_INFO(logger_, "NDT %s succeeded", command_name.c_str()); | ||
} else { | ||
RCLCPP_INFO(logger_, "NDT %s failed", command_name.c_str()); | ||
throw ServiceException( | ||
Initialize::Service::Response::ERROR_ESTIMATION, "NDT " + command_name + " failed"); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
localization/pose_initializer/src/pose_initializer/ndt_localization_trigger_module.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,36 @@ | ||
// Copyright 2023 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 POSE_INITIALIZER__NDT_LOCALIZATION_TRIGGER_MODULE_HPP_ | ||
#define POSE_INITIALIZER__NDT_LOCALIZATION_TRIGGER_MODULE_HPP_ | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <std_srvs/srv/set_bool.hpp> | ||
|
||
class NdtLocalizationTriggerModule | ||
{ | ||
private: | ||
using SetBool = std_srvs::srv::SetBool; | ||
|
||
public: | ||
explicit NdtLocalizationTriggerModule(rclcpp::Node * node); | ||
void send_request(bool flag) const; | ||
|
||
private: | ||
rclcpp::Logger logger_; | ||
rclcpp::Client<SetBool>::SharedPtr client_ndt_trigger_; | ||
}; | ||
|
||
#endif // POSE_INITIALIZER__NDT_LOCALIZATION_TRIGGER_MODULE_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
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