Skip to content
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

[pull] main from autowarefoundation:main #143

Merged
merged 31 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0d4e444
feat(automatic_goal): add automatic goal rviz plugin (#3031)
dmoszynski Mar 12, 2023
5ec247b
feat(behavior_path_planner): use akima spline for xy only first (#2800)
takayuki5168 Mar 13, 2023
e97ff9d
fix(lane_change): lane change module changes output path intentionall…
satoshi-ota Mar 13, 2023
d8ab5f1
chore(system_error_monitor): supress initial warning (#3056)
takayuki5168 Mar 13, 2023
864d97d
fix(mpc): reset prev value when mpc failed (#3062)
TakaHoribe Mar 13, 2023
969dacf
fix(lane_change): use previous output (#3059)
satoshi-ota Mar 13, 2023
5ca8e68
fix(avoidance): use previous module output (#3043)
satoshi-ota Mar 13, 2023
e6615b3
fix(lane_change): update lane change status in planWaitingApproval() …
satoshi-ota Mar 13, 2023
b2790e9
fix(avoidance): be able to execute lc + avoidance simlutaneously (#3066)
satoshi-ota Mar 13, 2023
be0929b
fix(tensorrt_yolox): resolve all output labels become unknown (#3064)
ktro2828 Mar 13, 2023
ad413be
feat(behavior_path_planner): use efficient lateral distance calculati…
purewater0901 Mar 14, 2023
1b4fa2b
fix(avoidance): fix shift line merging logic (#2882)
satoshi-ota Mar 14, 2023
87e4422
fix(velodyne_monitor): add fmt package to dependencies (#3069)
drwnz Mar 14, 2023
4342bdc
fix(lane_change): use previous module turn signal in waiting approval…
satoshi-ota Mar 14, 2023
38032f1
feat(planning_evaluator): add modified goal deviation (#3053)
kosuke55 Mar 14, 2023
d19c6c4
fix(pointcloud_preprocessor): pointcloud preprocessor pcl headers (#3…
drwnz Mar 14, 2023
c1d28c9
feat(lidar_centerpoint): add build only option for tensorrt engine (#…
yukke42 Mar 14, 2023
c9f6ba2
refactor(lane change): lane change class rework (#3060)
zulfaqar-azmi-t4 Mar 14, 2023
b0ead6b
fix(freespace_planning_algorithms): remove duplicate candidates in tr…
NorahXiong Mar 14, 2023
07b7837
feat(pose_initializer): enable pose initialization while running (onl…
kminoda Mar 14, 2023
7a0f84c
feat(probablisitic_occupancy_grid_map): add scan_frame option for gri…
YoshiRi Mar 14, 2023
fc32b0f
refactor(trajectory_follower_node): remove unnecessary cmake code (#2…
TakaHoribe Mar 14, 2023
5e29ea0
fix(lane_departure_checker): use kinematic state for ego pose (#3057)
takayuki5168 Mar 14, 2023
5a0d672
feat(tier4_autoware_utils): add expandPolygon function (#3052)
takayuki5168 Mar 14, 2023
edafc46
docs(obstacle avoidance planner): update the docs (#2963)
takayuki5168 Mar 15, 2023
b93dbc5
fix(tier4_perception_launch): fix config path (#3078)
takayuki5168 Mar 15, 2023
db23fd3
fix(perception): add dependencies to traffic light nodes (#3071)
drwnz Mar 15, 2023
82f1184
chore(tier4_simulator_launch): add code owner (#3080)
takayuki5168 Mar 15, 2023
5ec84e3
bugfix(tier4_simulator_launch): fix occupancy grid map not appearing …
YoshiRi Mar 15, 2023
f210e40
refactor(behavior_path_planner): change names in lane change module (…
purewater0901 Mar 16, 2023
e36b079
fix(behavior_path_planner): fix lane changing segment s_end (#3074)
purewater0901 Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions common/tier4_automatic_goal_rviz_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.14)
project(tier4_automatic_goal_rviz_plugin)

find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(Qt5 REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)

ament_auto_add_library(${PROJECT_NAME} SHARED
src/automatic_goal_sender.cpp
src/automatic_goal_append_tool.cpp
src/automatic_goal_panel.cpp
)

ament_auto_add_executable(automatic_goal_sender
src/automatic_goal_sender.cpp
)

target_link_libraries(${PROJECT_NAME}
${QT_LIBRARIES}
)

# Export the plugin to be imported by rviz2
pluginlib_export_plugin_description_file(rviz_common plugins/plugin_description.xml)

ament_auto_package(
INSTALL_TO_SHARE
launch
icons
plugins
)
80 changes: 80 additions & 0 deletions common/tier4_automatic_goal_rviz_plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# tier4_automatic_goal_rviz_plugin

## Purpose

1. Defining a `GoalsList` by adding goals using `RvizTool` (Pose on the map).

2. Automatic execution of the created `GoalsList` from the selected goal - it can be stopped and restarted.

3. Looping the current `GoalsList`.

4. Saving achieved goals to a file.

5. Plan the route to one (single) selected goal and starting that route - it can be stopped and restarted.

6. Remove any goal from the list or clear the current route.

7. Save the current `GoalsList` to a file and load the list from the file.

8. The application enables/disables access to options depending on the current state.

9. The saved `GoalsList` can be executed without using a plugin - using a node `automatic_goal_sender`.

## Inputs / Outputs

### Input

| Name | Type | Description |
| ---------------------------- | ------------------------------------------------- | ------------------------------------------------ |
| `/api/operation_mode/state` | `autoware_adapi_v1_msgs::msg::OperationModeState` | The topic represents the state of operation mode |
| `/api/routing/state` | `autoware_adapi_v1_msgs::msg::RouteState` | The topic represents the state of route |
| `/rviz2/automatic_goal/goal` | `geometry_msgs::msgs::PoseStamped` | The topic for adding goals to GoalsList |

### Output

| Name | Type | Description |
| ------------------------------------------ | -------------------------------------------------- | -------------------------------------------------- |
| `/api/operation_mode/change_to_autonomous` | `autoware_adapi_v1_msgs::srv::ChangeOperationMode` | The service to change operation mode to autonomous |
| `/api/operation_mode/change_to_stop` | `autoware_adapi_v1_msgs::srv::ChangeOperationMode` | The service to change operation mode to stop |
| `/api/routing/set_route_points` | `autoware_adapi_v1_msgs::srv::SetRoutePoints` | The service to set route |
| `/api/routing/clear_route` | `autoware_adapi_v1_msgs::srv::ClearRoute` | The service to clear route state |
| `/rviz2/automatic_goal/markers` | `visualization_msgs::msg::MarkerArray` | The topic to visualize goals as rviz markers |

## HowToUse

1. Start rviz and select panels/Add new panel.

![select_panel](./images/select_panels.png)

2. Select `tier4_automatic_goal_rviz_plugin/AutowareAutomaticGoalPanel` and press OK.

3. Select Add a new tool.

![select_tool](./images/select_tool.png)

4. Select `tier4_automatic_goal_rviz_plugin/AutowareAutomaticGoalTool` and press OK.

5. Add goals visualization as markers to `Displays`.

![markers](./images/markers.png)

6. Append goals to the `GoalsList` to be achieved using `2D Append Goal` - in such a way that routes can be planned.

7. Start sequential planning and goal achievement by clicking `Send goals automatically`

![panel](./images/panel.png)

8. You can save `GoalsList` by clicking `Save to file`.

9. After saving, you can run the `GoalsList` without using a plugin also:
- example: `ros2 launch tier4_automatic_goal_rviz_plugin automatic_goal_sender.launch.xml goals_list_file_path:="/tmp/goals_list.yaml" goals_achieved_dir_path:="/tmp/"`
- `goals_list_file_path` - is the path to the saved `GoalsList` file to be loaded
- `goals_achieved_dir_path` - is the path to the directory where the file `goals_achieved.log` will be created and the achieved goals will be written to it

### Hints

If the application (Engagement) goes into `ERROR` mode (usually returns to `EDITING` later), it means that one of the services returned a calling error (`code!=0`).
In this situation, check the terminal output for more information.

- Often it is enough to try again.
- Sometimes a clearing of the current route is required before retrying.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="goals_list_file_path" description="" default=""/>
<arg name="goals_achieved_dir_path" description="" default=""/>

<node pkg="tier4_automatic_goal_rviz_plugin" exec="automatic_goal_sender" name="automatic_goal_sender" output="screen">
<param name="goals_list_file_path" value="$(var goals_list_file_path)"/>
<param name="goals_achieved_dir_path" value="$(var goals_achieved_dir_path)"/>
</node>
</launch>
35 changes: 35 additions & 0 deletions common/tier4_automatic_goal_rviz_plugin/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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_automatic_goal_rviz_plugin</name>
<version>0.0.0</version>
<description>The autoware automatic goal rviz plugin package</description>
<maintainer email="shumpei.wakabayashi@tier4.jp">Shumpei Wakabayashi</maintainer>
<maintainer email="dawid.moszynski@robotec.ai">Dawid Moszyński</maintainer>
<license>Apache License 2.0</license>
<author email="dawid.moszynski@robotec.ai">Dawid Moszyński</author>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<build_depend>autoware_cmake</build_depend>
<depend>autoware_adapi_v1_msgs</depend>
<depend>geometry_msgs</depend>
<depend>libqt5-core</depend>
<depend>libqt5-gui</depend>
<depend>libqt5-widgets</depend>
<depend>qtbase5-dev</depend>
<depend>rclcpp</depend>
<depend>rviz_common</depend>
<depend>rviz_default_plugins</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>visualization_msgs</depend>
<depend>yaml-cpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
<rviz plugin="${prefix}/plugins/plugin_description.xml"/>
</export>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<library path="tier4_automatic_goal_rviz_plugin">
<class
type="rviz_plugins::AutowareAutomaticGoalPanel"
base_class_type="rviz_common::Panel">
<description>AutowareAutomaticGoalPanel</description>
</class>
<class name="rviz_plugins/AutowareAutomaticGoalTool"
type="rviz_plugins::AutowareAutomaticGoalTool"
base_class_type="rviz_common::Tool">
<description>AutowareAutomaticGoalTool</description>
</class>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// 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.
/*
* 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_goal_append_tool.hpp"

#ifdef ROS_DISTRO_GALACTIC
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif
#include <tf2_ros/transform_listener.h>

#include <string>

namespace rviz_plugins
{
AutowareAutomaticGoalTool::AutowareAutomaticGoalTool()
{
shortcut_key_ = 'c';

pose_topic_property_ = new rviz_common::properties::StringProperty(
"Pose Topic", "~/automatic_goal/goal", "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 AutowareAutomaticGoalTool::onInitialize()
{
PoseTool::onInitialize();
setName("2D AppendGoal");
updateTopic();
}

void AutowareAutomaticGoalTool::updateTopic()
{
rclcpp::Node::SharedPtr raw_node = context_->getRosNodeAbstraction().lock()->get_raw_node();
pose_pub_ = raw_node->create_publisher<geometry_msgs::msg::PoseStamped>(
pose_topic_property_->getStdString(), 1);
clock_ = raw_node->get_clock();
}

void AutowareAutomaticGoalTool::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("AutowareAutomaticGoalTool"), "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/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(rviz_plugins::AutowareAutomaticGoalTool, rviz_common::Tool)
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// 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.
/*
* 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_GOAL_APPEND_TOOL_HPP_
#define AUTOMATIC_GOAL_APPEND_TOOL_HPP_

#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
#include <QObject>
#include <rclcpp/node.hpp>
#include <rviz_common/display_context.hpp>
#include <rviz_common/properties/float_property.hpp>
#include <rviz_common/properties/string_property.hpp>
#include <rviz_default_plugins/tools/pose/pose_tool.hpp>
#endif

#include <geometry_msgs/msg/pose_stamped.hpp>

namespace rviz_plugins
{
class AutowareAutomaticGoalTool : public rviz_default_plugins::tools::PoseTool
{
Q_OBJECT

public:
AutowareAutomaticGoalTool();
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<geometry_msgs::msg::PoseStamped>::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_GOAL_APPEND_TOOL_HPP_
Loading