This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35ed429
commit b77d197
Showing
13 changed files
with
469 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
// IntelliSense を使用して利用可能な属性を学べます。 | ||
// 既存の属性の説明をホバーして表示します。 | ||
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "(gdb) obstacle_stop_planner_node_exe", | ||
"type": "cppdbg", | ||
"request": "attach", | ||
"program": "${workspaceFolder}/install/lib/obstacle_stop_planner_nodes/obstacle_stop_planner_node_exe", | ||
"processId": "${command:pickProcess}", | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "gdb の再フォーマットを有効にする", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "(gdb) gtest", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "build/obstacle_stop_planner_refine/test_obstacle_stop_planner", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "gdb の再フォーマットを有効にする", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": false | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "(gdb) gtest node", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "build/obstacle_stop_planner_nodes/test_obstacle_stop_planner_node", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "gdb の再フォーマットを有効にする", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": false | ||
} | ||
] | ||
}, | ||
] | ||
} |
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
11 changes: 11 additions & 0 deletions
11
obstacle_stop_planner_nodes_refine/param/vehicle_info.yaml
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,11 @@ | ||
/**: | ||
ros__parameters: | ||
wheel_radius: 0.39 | ||
wheel_width: 0.42 | ||
wheel_base: 2.74 # between front wheel center and rear wheel center | ||
wheel_tread: 1.63 # between left wheel center and right wheel center | ||
front_overhang: 1.0 # between front wheel center and vehicle front | ||
rear_overhang: 1.03 # between rear wheel center and vehicle rear | ||
left_overhang: 0.1 # between left wheel center and vehicle left | ||
right_overhang: 0.1 # between right wheel center and vehicle right | ||
vehicle_height: 2.5 |
61 changes: 61 additions & 0 deletions
61
obstacle_stop_planner_nodes_refine/test/obstacle_stop_planner_node_launch_test.py
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,61 @@ | ||
# Copyright 2021 the Autoware Foundation | ||
# | ||
# 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. | ||
# | ||
# Co-developed by Tier IV, Inc. and Apex.AI, Inc. | ||
|
||
import os | ||
import unittest | ||
|
||
import launch_testing | ||
import pytest | ||
from ament_index_python import get_package_share_directory | ||
from launch.launch_description import LaunchDescription | ||
from launch_ros.actions import Node | ||
from launch_testing.actions import ReadyToTest | ||
from launch_testing.asserts import assertExitCodes | ||
|
||
|
||
@pytest.mark.launch_test | ||
def generate_test_description(): | ||
obstacle_stop_planner_node = Node( | ||
package='obstacle_stop_planner_nodes', | ||
executable='obstacle_stop_planner_node_exe', | ||
namespace='test', | ||
parameters=[ | ||
os.path.join( | ||
get_package_share_directory('obstacle_stop_planner_nodes'), | ||
'param/obstacle_stop_planner.yaml'), | ||
os.path.join( | ||
get_package_share_directory('obstacle_stop_planner_nodes'), | ||
'param/adaptive_cruise_control.yaml'), | ||
os.path.join( | ||
get_package_share_directory('obstacle_stop_planner_nodes'), | ||
'param/vehicle_info.yaml') | ||
]) | ||
|
||
context = {'obstacle_stop_planner_node': obstacle_stop_planner_node} | ||
|
||
return LaunchDescription([ | ||
obstacle_stop_planner_node, | ||
# Start tests right away - no need to wait for anything | ||
ReadyToTest(), | ||
]), context | ||
|
||
|
||
@launch_testing.post_shutdown_test() | ||
class TestProcessOutput(unittest.TestCase): | ||
|
||
def test_exit_code(self, proc_output, proc_info, obstacle_stop_planner_node): | ||
# Check that process exits with code -15 code: termination request, sent to the program | ||
assertExitCodes(proc_info, [-15], process=obstacle_stop_planner_node) |
93 changes: 93 additions & 0 deletions
93
obstacle_stop_planner_nodes_refine/test/test_obstacle_stop_planner_node.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,93 @@ | ||
// Copyright 2020 The Autoware Foundation | ||
// | ||
// 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 <obstacle_stop_planner_nodes/obstacle_stop_planner_node.hpp> | ||
|
||
#include <memory> | ||
#include <chrono> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
using sensor_msgs::msg::PointCloud2; | ||
using autoware_planning_msgs::msg::Trajectory; | ||
|
||
class ObstacleStopPlannerNodeTest : public ::testing::Test | ||
{ | ||
public: | ||
void SetUp() override | ||
{ | ||
ASSERT_FALSE(rclcpp::ok()); | ||
rclcpp::init(0, nullptr); | ||
ASSERT_TRUE(rclcpp::ok()); | ||
|
||
fake_node_ = std::make_shared<rclcpp::Node>("fake_node"); | ||
|
||
using PubAllocT = rclcpp::PublisherOptionsWithAllocator<std::allocator<void>>; | ||
dummy_pointcloud_pub_ = | ||
fake_node_->create_publisher<PointCloud2>( | ||
"input/pointcloud", rclcpp::QoS{1}, PubAllocT{}); | ||
dummy_path_pub_ = | ||
fake_node_->create_publisher<Trajectory>( | ||
"input/trajectory", rclcpp::QoS{1}, PubAllocT{}); | ||
dummy_velocity_pub_ = | ||
fake_node_->create_publisher<geometry_msgs::msg::TwistStamped>( | ||
"input/twist", rclcpp::QoS{1}, PubAllocT{}); | ||
dummy_object_pub_ = | ||
fake_node_->create_publisher<autoware_perception_msgs::msg::DynamicObjectArray>( | ||
"input/objects", rclcpp::QoS{1}, PubAllocT{}); | ||
path_sub_ = | ||
fake_node_->create_subscription<Trajectory>( | ||
"output/trajectory", rclcpp::QoS{1}, | ||
[this](const Trajectory::SharedPtr msg) | ||
{this->path_msg_ = *msg;}); | ||
|
||
rclcpp::NodeOptions node_options{}; | ||
|
||
planner_ = std::make_shared<obstacle_stop_planner_nodes::ObstacleStopPlannerNode>(node_options); | ||
} | ||
|
||
std::shared_ptr<obstacle_stop_planner_nodes::ObstacleStopPlannerNode> planner_; | ||
rclcpp::Node::SharedPtr fake_node_{nullptr}; | ||
rclcpp::Publisher<PointCloud2>::SharedPtr dummy_pointcloud_pub_; | ||
rclcpp::Publisher<Trajectory>::SharedPtr dummy_path_pub_; | ||
rclcpp::Publisher<geometry_msgs::msg::TwistStamped>::SharedPtr dummy_velocity_pub_; | ||
rclcpp::Publisher<autoware_perception_msgs::msg::DynamicObjectArray>::SharedPtr dummy_object_pub_; | ||
rclcpp::Subscription<Trajectory>::SharedPtr path_sub_; | ||
boost::optional<Trajectory> path_msg_; | ||
}; | ||
|
||
TEST_F(ObstacleStopPlannerNodeTest, plan_simple_trajectory) | ||
{ | ||
using namespace std::chrono_literals; | ||
|
||
rclcpp::executors::SingleThreadedExecutor executor; | ||
executor.add_node(fake_node_); | ||
executor.add_node(planner_); | ||
|
||
// TODO(KS): Publish data | ||
|
||
|
||
using namespace std::chrono_literals; | ||
rclcpp::WallRate rate(100ms); | ||
while (rclcpp::ok()) { | ||
executor.spin_some(); | ||
if (path_msg_.has_value()) { | ||
break; | ||
} | ||
rate.sleep(); | ||
} | ||
|
||
// Check data | ||
ASSERT_EQ(0, 1); | ||
} |
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 |
---|---|---|
|
@@ -77,5 +77,4 @@ endif() | |
ament_auto_package( | ||
INSTALL_TO_SHARE | ||
config | ||
launch | ||
) |
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
Oops, something went wrong.