diff --git a/common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt b/common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt
index c6d4e30061626..cdc57743a6cb1 100644
--- a/common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt
+++ b/common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt
@@ -11,6 +11,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)
ament_auto_add_library(${PROJECT_NAME} SHARED
+ src/automatic_checkpoint_append_tool.cpp
src/automatic_goal_sender.cpp
src/automatic_goal_append_tool.cpp
src/automatic_goal_panel.cpp
diff --git a/common/tier4_automatic_goal_rviz_plugin/icons/classes/AutowareAutomaticCheckpointTool.png b/common/tier4_automatic_goal_rviz_plugin/icons/classes/AutowareAutomaticCheckpointTool.png
new file mode 100644
index 0000000000000..6a67573717ae1
Binary files /dev/null and b/common/tier4_automatic_goal_rviz_plugin/icons/classes/AutowareAutomaticCheckpointTool.png differ
diff --git a/common/tier4_automatic_goal_rviz_plugin/package.xml b/common/tier4_automatic_goal_rviz_plugin/package.xml
index deda078ace22e..fb5331379acb6 100644
--- a/common/tier4_automatic_goal_rviz_plugin/package.xml
+++ b/common/tier4_automatic_goal_rviz_plugin/package.xml
@@ -6,6 +6,8 @@
The autoware automatic goal rviz plugin package
Shumpei Wakabayashi
Dawid Moszyński
+ Kyoichi Sugahara
+ Satoshi Ota
Apache License 2.0
Dawid Moszyński
@@ -22,6 +24,7 @@
rviz_default_plugins
tf2
tf2_geometry_msgs
+ tier4_autoware_utils
visualization_msgs
yaml-cpp
diff --git a/common/tier4_automatic_goal_rviz_plugin/plugins/plugin_description.xml b/common/tier4_automatic_goal_rviz_plugin/plugins/plugin_description.xml
index e7d5224550868..e9d77491941ed 100644
--- a/common/tier4_automatic_goal_rviz_plugin/plugins/plugin_description.xml
+++ b/common/tier4_automatic_goal_rviz_plugin/plugins/plugin_description.xml
@@ -9,4 +9,9 @@
base_class_type="rviz_common::Tool">
AutowareAutomaticGoalTool
+
+ AutowareAutomaticCheckpointTool
+
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.cpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.cpp
new file mode 100644
index 0000000000000..4efa6fedbaabd
--- /dev/null
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.cpp
@@ -0,0 +1,122 @@
+// 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.
+/*
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2012, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "automatic_checkpoint_append_tool.hpp"
+
+#ifdef ROS_DISTRO_GALACTIC
+#include
+#else
+#include
+#endif
+#include
+
+#include
+
+namespace rviz_plugins
+{
+AutowareAutomaticCheckpointTool::AutowareAutomaticCheckpointTool()
+{
+ shortcut_key_ = 'c';
+
+ pose_topic_property_ = new rviz_common::properties::StringProperty(
+ "Pose Topic", "~/automatic_goal/checkpoint", "The topic on which to publish automatic_goal.",
+ getPropertyContainer(), SLOT(updateTopic()), this);
+ std_dev_x_ = new rviz_common::properties::FloatProperty(
+ "X std deviation", 0.5, "X standard deviation for checkpoint pose [m]", getPropertyContainer());
+ std_dev_y_ = new rviz_common::properties::FloatProperty(
+ "Y std deviation", 0.5, "Y standard deviation for checkpoint pose [m]", getPropertyContainer());
+ std_dev_theta_ = new rviz_common::properties::FloatProperty(
+ "Theta std deviation", M_PI / 12.0, "Theta standard deviation for checkpoint pose [rad]",
+ getPropertyContainer());
+ position_z_ = new rviz_common::properties::FloatProperty(
+ "Z position", 0.0, "Z position for checkpoint pose [m]", getPropertyContainer());
+ std_dev_x_->setMin(0);
+ std_dev_y_->setMin(0);
+ std_dev_theta_->setMin(0);
+ position_z_->setMin(0);
+}
+
+void AutowareAutomaticCheckpointTool::onInitialize()
+{
+ PoseTool::onInitialize();
+ setName("2D AppendCheckpoint");
+ updateTopic();
+}
+
+void AutowareAutomaticCheckpointTool::updateTopic()
+{
+ rclcpp::Node::SharedPtr raw_node = context_->getRosNodeAbstraction().lock()->get_raw_node();
+ pose_pub_ = raw_node->create_publisher(
+ pose_topic_property_->getStdString(), 1);
+ clock_ = raw_node->get_clock();
+}
+
+void AutowareAutomaticCheckpointTool::onPoseSet(double x, double y, double theta)
+{
+ // pose
+ std::string fixed_frame = context_->getFixedFrame().toStdString();
+ geometry_msgs::msg::PoseStamped pose;
+ pose.header.frame_id = fixed_frame;
+ pose.header.stamp = clock_->now();
+ pose.pose.position.x = x;
+ pose.pose.position.y = y;
+ pose.pose.position.z = position_z_->getFloat();
+
+ tf2::Quaternion quat;
+ quat.setRPY(0.0, 0.0, theta);
+ pose.pose.orientation = tf2::toMsg(quat);
+ RCLCPP_INFO(
+ rclcpp::get_logger("AutowareAutomaticCheckpointTool"),
+ "Setting pose: %.3f %.3f %.3f %.3f [frame=%s]", x, y, position_z_->getFloat(), theta,
+ fixed_frame.c_str());
+ pose_pub_->publish(pose);
+}
+
+} // end namespace rviz_plugins
+
+#include
+PLUGINLIB_EXPORT_CLASS(rviz_plugins::AutowareAutomaticCheckpointTool, rviz_common::Tool)
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.hpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.hpp
new file mode 100644
index 0000000000000..4ea3fa4bd009a
--- /dev/null
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_checkpoint_append_tool.hpp
@@ -0,0 +1,91 @@
+// 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.
+/*
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2012, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AUTOMATIC_CHECKPOINT_APPEND_TOOL_HPP_
+#define AUTOMATIC_CHECKPOINT_APPEND_TOOL_HPP_
+
+#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
+#include
+#include
+#include
+#include
+#include
+#include
+#endif
+
+#include
+
+namespace rviz_plugins
+{
+class AutowareAutomaticCheckpointTool : public rviz_default_plugins::tools::PoseTool
+{
+ Q_OBJECT
+
+public:
+ AutowareAutomaticCheckpointTool();
+ void onInitialize() override;
+
+protected:
+ void onPoseSet(double x, double y, double theta) override;
+
+private Q_SLOTS:
+ void updateTopic();
+
+private: // NOLINT for Qt
+ rclcpp::Clock::SharedPtr clock_{nullptr};
+ rclcpp::Publisher::SharedPtr pose_pub_{nullptr};
+
+ rviz_common::properties::StringProperty * pose_topic_property_{nullptr};
+ rviz_common::properties::FloatProperty * std_dev_x_{nullptr};
+ rviz_common::properties::FloatProperty * std_dev_y_{nullptr};
+ rviz_common::properties::FloatProperty * std_dev_theta_{nullptr};
+ rviz_common::properties::FloatProperty * position_z_{nullptr};
+};
+
+} // namespace rviz_plugins
+
+#endif // AUTOMATIC_CHECKPOINT_APPEND_TOOL_HPP_
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp
index bee390bfe29ed..6b8d7765a989a 100644
--- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp
@@ -16,6 +16,8 @@
#include "automatic_goal_panel.hpp"
+#include
+
namespace rviz_plugins
{
AutowareAutomaticGoalPanel::AutowareAutomaticGoalPanel(QWidget * parent)
@@ -139,6 +141,9 @@ void AutowareAutomaticGoalPanel::onInitialize()
sub_append_goal_ = raw_node_->create_subscription(
"~/automatic_goal/goal", 5,
std::bind(&AutowareAutomaticGoalPanel::onAppendGoal, this, std::placeholders::_1));
+ sub_append_checkpoint_ = raw_node_->create_subscription(
+ "~/automatic_goal/checkpoint", 5,
+ std::bind(&AutowareAutomaticGoalPanel::onAppendCheckpoint, this, std::placeholders::_1));
initCommunication(raw_node_.get());
}
@@ -244,12 +249,28 @@ void AutowareAutomaticGoalPanel::onClickSaveListToFile()
void AutowareAutomaticGoalPanel::onAppendGoal(const PoseStamped::ConstSharedPtr pose)
{
if (state_ == State::EDITING) {
- goals_list_.push_back(pose);
+ goals_list_.emplace_back(pose);
updateGoalsList();
updateGUI();
}
}
+void AutowareAutomaticGoalPanel::onAppendCheckpoint(const PoseStamped::ConstSharedPtr pose)
+{
+ if (goals_list_widget_ptr_->selectedItems().count() != 1) {
+ showMessageBox("Select a goal in GoalsList before set checkpoint");
+ return;
+ }
+
+ current_goal_ = goals_list_widget_ptr_->currentRow();
+ if (current_goal_ >= goals_list_.size()) {
+ return;
+ }
+
+ goals_list_.at(current_goal_).checkpoint_pose_ptrs.push_back(pose);
+ publishMarkers();
+}
+
// Override
void AutowareAutomaticGoalPanel::onCallResult()
{
@@ -418,47 +439,71 @@ void AutowareAutomaticGoalPanel::updateGoalIcon(const unsigned goal_index, const
void AutowareAutomaticGoalPanel::publishMarkers()
{
+ using tier4_autoware_utils::createDefaultMarker;
+ using tier4_autoware_utils::createMarkerColor;
+ using tier4_autoware_utils::createMarkerScale;
+
MarkerArray text_array;
MarkerArray arrow_array;
// Clear existing
- visualization_msgs::msg::Marker marker;
- marker.header.stamp = rclcpp::Time();
- marker.ns = "names";
- marker.id = 0;
- marker.action = visualization_msgs::msg::Marker::DELETEALL;
- text_array.markers.push_back(marker);
- marker.ns = "poses";
- arrow_array.markers.push_back(marker);
- pub_marker_->publish(text_array);
- pub_marker_->publish(arrow_array);
+ {
+ auto marker = createDefaultMarker(
+ "map", rclcpp::Clock{RCL_ROS_TIME}.now(), "names", 0L, Marker::CUBE,
+ createMarkerScale(1.0, 1.0, 1.0), createMarkerColor(1.0, 1.0, 1.0, 0.999));
+ marker.action = visualization_msgs::msg::Marker::DELETEALL;
+ text_array.markers.push_back(marker);
+ pub_marker_->publish(text_array);
+ }
+
+ {
+ auto marker = createDefaultMarker(
+ "map", rclcpp::Clock{RCL_ROS_TIME}.now(), "poses", 0L, Marker::CUBE,
+ createMarkerScale(1.0, 1.0, 1.0), createMarkerColor(1.0, 1.0, 1.0, 0.999));
+ arrow_array.markers.push_back(marker);
+ pub_marker_->publish(arrow_array);
+ }
+
text_array.markers.clear();
arrow_array.markers.clear();
- // Publish current
- for (unsigned i = 0; i < goals_list_.size(); i++) {
- visualization_msgs::msg::Marker marker;
- marker.header.frame_id = "map";
- marker.header.stamp = rclcpp::Time();
- marker.ns = "names";
- marker.id = static_cast(i);
- marker.type = visualization_msgs::msg::Marker::TEXT_VIEW_FACING;
+
+ const auto push_arrow_marker = [&](const auto & pose, const auto & color, const size_t id) {
+ auto marker = createDefaultMarker(
+ "map", rclcpp::Clock{RCL_ROS_TIME}.now(), "poses", id, Marker::ARROW,
+ createMarkerScale(1.6, 0.5, 0.5), color);
marker.action = visualization_msgs::msg::Marker::ADD;
- marker.pose = goals_list_[i]->pose;
+ marker.pose = pose;
marker.lifetime = rclcpp::Duration(0, 0);
- marker.scale.x = 1.6;
- marker.scale.y = 1.6;
- marker.scale.z = 1.6;
- marker.color.r = 1.0;
- marker.color.g = 1.0;
- marker.color.b = 1.0;
- marker.color.a = 1.0;
marker.frame_locked = false;
- marker.text = "G" + std::to_string(i);
- text_array.markers.push_back(marker);
- marker.ns = "poses";
- marker.scale.y = 0.2;
- marker.scale.z = 0.2;
- marker.type = visualization_msgs::msg::Marker::ARROW;
arrow_array.markers.push_back(marker);
+ };
+
+ const auto push_text_marker = [&](const auto & pose, const auto & text, const size_t id) {
+ auto marker = createDefaultMarker(
+ "map", rclcpp::Clock{RCL_ROS_TIME}.now(), "names", id, Marker::TEXT_VIEW_FACING,
+ createMarkerScale(1.6, 1.6, 1.6), createMarkerColor(1.0, 1.0, 1.0, 0.999));
+ marker.action = visualization_msgs::msg::Marker::ADD;
+ marker.pose = pose;
+ marker.lifetime = rclcpp::Duration(0, 0);
+ marker.frame_locked = false;
+ marker.text = text;
+ text_array.markers.push_back(marker);
+ };
+
+ // Publish current
+ size_t id = 0;
+ for (size_t i = 0; i < goals_list_.size(); ++i) {
+ {
+ const auto pose = goals_list_.at(i).goal_pose_ptr->pose;
+ push_arrow_marker(pose, createMarkerColor(0.0, 1.0, 0.0, 0.999), id++);
+ push_text_marker(pose, "Goal:" + std::to_string(i), id++);
+ }
+
+ for (size_t j = 0; j < goals_list_.at(i).checkpoint_pose_ptrs.size(); ++j) {
+ const auto pose = goals_list_.at(i).checkpoint_pose_ptrs.at(j)->pose;
+ push_arrow_marker(pose, createMarkerColor(1.0, 1.0, 0.0, 0.999), id++);
+ push_text_marker(
+ pose, "Checkpoint:" + std::to_string(i) + "[Goal:" + std::to_string(j) + "]", id++);
+ }
}
pub_marker_->publish(text_array);
pub_marker_->publish(arrow_array);
@@ -469,13 +514,13 @@ void AutowareAutomaticGoalPanel::saveGoalsList(const std::string & file_path)
{
YAML::Node node;
for (unsigned i = 0; i < goals_list_.size(); ++i) {
- node[i]["position_x"] = goals_list_[i]->pose.position.x;
- node[i]["position_y"] = goals_list_[i]->pose.position.y;
- node[i]["position_z"] = goals_list_[i]->pose.position.z;
- node[i]["orientation_x"] = goals_list_[i]->pose.orientation.x;
- node[i]["orientation_y"] = goals_list_[i]->pose.orientation.y;
- node[i]["orientation_z"] = goals_list_[i]->pose.orientation.z;
- node[i]["orientation_w"] = goals_list_[i]->pose.orientation.w;
+ node[i]["position_x"] = goals_list_[i].goal_pose_ptr->pose.position.x;
+ node[i]["position_y"] = goals_list_[i].goal_pose_ptr->pose.position.y;
+ node[i]["position_z"] = goals_list_[i].goal_pose_ptr->pose.position.z;
+ node[i]["orientation_x"] = goals_list_[i].goal_pose_ptr->pose.orientation.x;
+ node[i]["orientation_y"] = goals_list_[i].goal_pose_ptr->pose.orientation.y;
+ node[i]["orientation_z"] = goals_list_[i].goal_pose_ptr->pose.orientation.z;
+ node[i]["orientation_w"] = goals_list_[i].goal_pose_ptr->pose.orientation.w;
}
std::ofstream file_out(file_path);
file_out << node;
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.hpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.hpp
index 0ec9ca530f074..72a5bd4fb80fe 100644
--- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.hpp
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.hpp
@@ -61,7 +61,9 @@ class AutowareAutomaticGoalPanel : public rviz_common::Panel,
public automatic_goal::AutowareAutomaticGoalSender
{
using State = automatic_goal::AutomaticGoalState;
+ using Pose = geometry_msgs::msg::Pose;
using PoseStamped = geometry_msgs::msg::PoseStamped;
+ using Marker = visualization_msgs::msg::Marker;
using MarkerArray = visualization_msgs::msg::MarkerArray;
using OperationModeState = autoware_adapi_v1_msgs::msg::OperationModeState;
using ChangeOperationMode = autoware_adapi_v1_msgs::srv::ChangeOperationMode;
@@ -96,6 +98,7 @@ public Q_SLOTS: // NOLINT for Qt
// Inputs
void onAppendGoal(const PoseStamped::ConstSharedPtr pose);
+ void onAppendCheckpoint(const PoseStamped::ConstSharedPtr pose);
// Visual updates
void updateGUI();
@@ -116,6 +119,7 @@ public Q_SLOTS: // NOLINT for Qt
// Pub/Sub
rclcpp::Publisher::SharedPtr pub_marker_{nullptr};
rclcpp::Subscription::SharedPtr sub_append_goal_{nullptr};
+ rclcpp::Subscription::SharedPtr sub_append_checkpoint_{nullptr};
// Containers
rclcpp::Node::SharedPtr raw_node_{nullptr};
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp
index cc8d46e2f60c6..3ca368a3bd1a4 100644
--- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp
@@ -108,9 +108,9 @@ void AutowareAutomaticGoalSender::updateGoalsList()
std::stringstream ss;
ss << std::fixed << std::setprecision(2);
tf2::Quaternion tf2_quat;
- tf2::convert(goal->pose.orientation, tf2_quat);
- ss << "G" << i << " (" << goal->pose.position.x << ", ";
- ss << goal->pose.position.y << ", " << tf2::getYaw(tf2_quat) << ")";
+ tf2::convert(goal.goal_pose_ptr->pose.orientation, tf2_quat);
+ ss << "G" << i << " (" << goal.goal_pose_ptr->pose.position.x << ", ";
+ ss << goal.goal_pose_ptr->pose.position.y << ", " << tf2::getYaw(tf2_quat) << ")";
goals_achieved_.insert({i++, std::make_pair(ss.str(), 0)});
}
onGoalListUpdated();
@@ -178,7 +178,7 @@ void AutowareAutomaticGoalSender::loadGoalsList(const std::string & file_path)
pose->pose.orientation.y = goal["orientation_y"].as();
pose->pose.orientation.z = goal["orientation_z"].as();
pose->pose.orientation.w = goal["orientation_w"].as();
- goals_list_.push_back(pose);
+ goals_list_.emplace_back(pose);
}
resetAchievedGoals();
updateGoalsList();
diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.hpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.hpp
index aacdada352811..88b7b5e7dac20 100644
--- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.hpp
+++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.hpp
@@ -80,8 +80,11 @@ class AutowareAutomaticGoalSender : public rclcpp::Node
}
auto req = std::make_shared();
- req->header = goals_list_.at(goal_index)->header;
- req->goal = goals_list_.at(goal_index)->pose;
+ req->header = goals_list_.at(goal_index).goal_pose_ptr->header;
+ req->goal = goals_list_.at(goal_index).goal_pose_ptr->pose;
+ for (const auto & checkpoint : goals_list_.at(goal_index).checkpoint_pose_ptrs) {
+ req->waypoints.push_back(checkpoint->pose);
+ }
client->async_send_request(
req, [this](typename rclcpp::Client::SharedFuture result) {
if (result.get()->status.code != 0) state_ = State::ERROR;
@@ -120,6 +123,13 @@ class AutowareAutomaticGoalSender : public rclcpp::Node
}
}
+ struct Route
+ {
+ explicit Route(const PoseStamped::ConstSharedPtr & goal) : goal_pose_ptr{goal} {}
+ PoseStamped::ConstSharedPtr goal_pose_ptr{};
+ std::vector checkpoint_pose_ptrs{};
+ };
+
// Update
void updateGoalsList();
virtual void updateAutoExecutionTimerTick();
@@ -155,7 +165,7 @@ class AutowareAutomaticGoalSender : public rclcpp::Node
// Containers
unsigned current_goal_{0};
State state_{State::INITIALIZING};
- std::vector goals_list_{};
+ std::vector goals_list_{};
std::map> goals_achieved_{};
std::string goals_achieved_file_path_{};