Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Test refactoring #3

Merged
merged 62 commits into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
259a4de
wip
KeisukeShima Feb 25, 2021
1ed8da2
wip: add memo
KeisukeShima Feb 25, 2021
caa5297
refactoring
KeisukeShima Feb 26, 2021
db5748a
create vehicle class
KeisukeShima Mar 1, 2021
17cc672
create trajectory, point_helper class
KeisukeShima Mar 1, 2021
b729ad2
add inline prefix
KeisukeShima Mar 1, 2021
d6a880e
refactoring
KeisukeShima Mar 1, 2021
3fb5650
refactoring
KeisukeShima Mar 1, 2021
48178ed
create OneStepPolygon class
KeisukeShima Mar 2, 2021
d840ded
refactoring
KeisukeShima Mar 2, 2021
e00f392
update design document
KeisukeShima Mar 2, 2021
9ff1392
insert final newline
KeisukeShima Mar 2, 2021
56ef212
add gtest
KeisukeShima Mar 3, 2021
b4cd78c
wip
KeisukeShima Mar 2, 2021
1de69cf
modify createVehicleFootprint()
KeisukeShima Mar 3, 2021
b4f2b0f
cleanup code
KeisukeShima Mar 3, 2021
aeef6aa
change namespace
KeisukeShima Mar 4, 2021
5568f74
use camelCase for function name
KeisukeShima Mar 4, 2021
0ca8a0e
apply uncrustify
KeisukeShima Mar 4, 2021
7602798
test passed
KeisukeShima Mar 4, 2021
863d31c
use const reference for non-primitive types
KeisukeShima Mar 4, 2021
9579da8
remove setter function
KeisukeShima Mar 4, 2021
2142496
modify one_step_polygon class
KeisukeShima Mar 4, 2021
2acc807
apply colcon test
KeisukeShima Mar 4, 2021
c343967
replace boost type to autoware_util
KeisukeShima Mar 4, 2021
4c2c1e6
rename function
KeisukeShima Mar 4, 2021
14f7786
follow lane_departure_checker's way
KeisukeShima Mar 5, 2021
f1bfb63
remove jsonDumpsPose and related code
KeisukeShima Mar 5, 2021
43ff1a3
replace VehicleInfo to Param
KeisukeShima Mar 5, 2021
b9d2047
change logger variable to const reference
KeisukeShima Mar 5, 2021
04fbdbf
Use using to simplify the code
KeisukeShima Mar 8, 2021
6462d77
cleanup include file
KeisukeShima Mar 8, 2021
475bfae
Refactor trajectory, util
KeisukeShima Mar 8, 2021
6696986
Delete Trajectory class
KeisukeShima Mar 8, 2021
1048d65
Refactor point_helper
KeisukeShima Mar 8, 2021
95c024c
Refactor AdaptiveCruiseControl class
KeisukeShima Mar 8, 2021
0a648fa
Remove unused line
KeisukeShima Mar 9, 2021
d471f07
refactor input/output
KeisukeShima Mar 9, 2021
6887e2f
Add test
KeisukeShima Mar 9, 2021
3852167
Refactoring
KeisukeShima Mar 9, 2021
c283861
Replace pcl::PointXYZ with Point3d
KeisukeShima Mar 10, 2021
8807c15
add include file
KeisukeShima Mar 17, 2021
4aca1e3
fix build error
KeisukeShima Mar 17, 2021
e5bbbaa
Apply clang-tidy format
KeisukeShima Mar 19, 2021
dfe42b1
Remove OpenCV dependency
KeisukeShima Mar 22, 2021
64e794b
create ament_cmake_auto_gtest package
KeisukeShima Mar 22, 2021
c8b7cc6
Add readme
KeisukeShima Mar 22, 2021
eeceeb7
Replace tuple with optional
KeisukeShima Mar 22, 2021
06ec3b6
add pcl_ros
KeisukeShima Mar 22, 2021
f83300a
Modify ObstaclePointCloud class
KeisukeShima Mar 22, 2021
388a88d
add build_depends
KeisukeShima Mar 22, 2021
64a1121
fix path
KeisukeShima Mar 22, 2021
4e7e19d
fix path
KeisukeShima Mar 22, 2021
0b0ff64
append depends
KeisukeShima Mar 22, 2021
f720dd0
Fix rebase error
KeisukeShima Mar 24, 2021
490178f
Ported code from the feature/create-node-pkg branch
KeisukeShima Mar 29, 2021
c55df3c
Fix lint
Mar 29, 2021
dd4fa9f
Add .isort.cfg
Mar 29, 2021
7c13039
Fix usage of ament_cmake_auto_gtest
KeisukeShima Mar 30, 2021
20f124b
Cleanup, modify copyright
KeisukeShima Mar 30, 2021
9d1825a
Fix usage of ament_auto_add_gtest
KeisukeShima Mar 30, 2021
454b543
Rename vehicle_info.param.yaml
KeisukeShima Mar 31, 2021
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
4 changes: 4 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
with:
required-ros-distributions: foxy

- name: Concat build_depends.repos
run: |
curl -sSL https://raw.githubusercontent.com/tier4/AutowareArchitectureProposal.iv/ros2/build_depends.repos | sed '1d' >> build_depends.repos

- name: Run action-ros-ci
id: action_ros_ci_step
uses: ros-tooling/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[settings]
force_sort_within_sections=true
known_third_party=launch
14 changes: 14 additions & 0 deletions ament_cmake_auto_gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)

project(ament_cmake_auto_gtest NONE)

find_package(ament_cmake REQUIRED)

ament_package(
CONFIG_EXTRAS "ament_cmake_auto_gtest-extras.cmake"
)

install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
)
3 changes: 3 additions & 0 deletions ament_cmake_auto_gtest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NOTE: This package is temporary and will be removed after the following pull requests have been merged.

<https://github.com/ament/ament_cmake/pull/257>
20 changes: 20 additions & 0 deletions ament_cmake_auto_gtest/ament_cmake_auto_gtest-extras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2014 Open Source Robotics Foundation, 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.

# copied from ament_cmake_auto/ament_cmake_auto-extras.cmake

find_package(ament_cmake_auto QUIET REQUIRED)
find_package(ament_cmake_gtest QUIET REQUIRED)

include("${ament_cmake_auto_gtest_DIR}/ament_auto_add_gtest.cmake")
110 changes: 110 additions & 0 deletions ament_cmake_auto_gtest/cmake/ament_auto_add_gtest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright 2014 Open Source Robotics Foundation, 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.

#
# Add a gtest, automatically linking and including dependencies.
#
# Call add_executable(target ARGN), link it against the gtest libraries
# and register the executable as a test.
#
# If gtest is not available the specified target is not being created and
# therefore the target existence should be checked before being used.
#
#
# All arguments of the CMake function ``add_executable()`` can be
# used beside the custom arguments ``DIRECTORY`` and
# ``NO_TARGET_LINK_LIBRARIES``.
#
# :param target: the name of the executable target
# :type target: string
# :param DIRECTORY: the directory to recursively glob for source
# files with the following extensions: c, cc, cpp, cxx
# :type DIRECTORY: string
# :param NO_TARGET_LINK_LIBRARIES: if set skip linking against
# ``${PROJECT_NAME}_LIBRARIES``
# :type NO_TARGET_LINK_LIBRARIES: option
# :param ARGN: the list of source files
# :type ARGN: list of strings
# :param RUNNER: the path to the test runner script
# (default: see ament_add_test).
# :type RUNNER: string
# :param TIMEOUT: the test timeout in seconds,
# default defined by ``ament_add_test()``
# :type TIMEOUT: integer
# :param WORKING_DIRECTORY: the working directory for invoking the
# executable in, default defined by ``ament_add_test()``
# :type WORKING_DIRECTORY: string
# :param SKIP_LINKING_MAIN_LIBRARIES: if set skip linking against the gtest
# main libraries
# :type SKIP_LINKING_MAIN_LIBRARIES: option
# :param SKIP_TEST: if set mark the test as being skipped
# :type SKIP_TEST: option
# :param ENV: list of env vars to set; listed as ``VAR=value``
# :type ENV: list of strings
# :param APPEND_ENV: list of env vars to append if already set, otherwise set;
# listed as ``VAR=value``
# :type APPEND_ENV: list of strings
# :param APPEND_LIBRARY_DIRS: list of library dirs to append to the appropriate
# OS specific env var, a la LD_LIBRARY_PATH
# :type APPEND_LIBRARY_DIRS: list of strings
#
# @public
#
macro(ament_auto_add_gtest target)
cmake_parse_arguments(ARG
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;NO_TARGET_LINK_LIBRARIES;SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST"
"RUNNER;TIMEOUT;WORKING_DIRECTORY;DIRECTORY"
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
${ARGN})
if(NOT ARG_DIRECTORY AND NOT ARG_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "ament_auto_add_executable() called without any "
"source files and without a DIRECTORY argument")
endif()

set(_source_files "")
if(ARG_DIRECTORY)
# glob all source files
file(
GLOB_RECURSE
_source_files
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${ARG_DIRECTORY}/*.c"
"${ARG_DIRECTORY}/*.cc"
"${ARG_DIRECTORY}/*.cpp"
"${ARG_DIRECTORY}/*.cxx"
)
if(NOT _source_files)
message(FATAL_ERROR "ament_auto_add_executable() no source files found "
"in directory '${CMAKE_CURRENT_SOURCE_DIR}/${ARG_DIRECTORY}'")
endif()
endif()

# parse again to "remove" custom arguments
cmake_parse_arguments(ARG "NO_TARGET_LINK_LIBRARIES" "DIRECTORY" "" ${ARGN})
ament_add_gtest("${target}" ${ARG_UNPARSED_ARGUMENTS} ${_source_files})

# add include directory of this package if it exists
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_include_directories("${target}" PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include")
endif()
# link against other libraries of this package
if(NOT ${PROJECT_NAME}_LIBRARIES STREQUAL "" AND
NOT ARG_NO_TARGET_LINK_LIBRARIES)
target_link_libraries("${target}" ${${PROJECT_NAME}_LIBRARIES})
endif()

# add exported information from found build dependencies
ament_target_dependencies(${target} ${${PROJECT_NAME}_FOUND_BUILD_DEPENDS})
endmacro()
19 changes: 19 additions & 0 deletions ament_cmake_auto_gtest/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>ament_cmake_auto_gtest</name>
<version>0.9.2</version>
<description>The auto-magic functions for ease to use of the ament buildsystem in CMake.</description>
<maintainer email="[email protected]">Dirk Thomas</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_gtest</buildtool_depend>

<buildtool_export_depend>ament_cmake_auto</buildtool_export_depend>
<buildtool_export_depend>ament_cmake_gtest</buildtool_export_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
41 changes: 24 additions & 17 deletions obstacle_stop_planner_refine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,45 @@ if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -O3)
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wno-unused-parameter)
endif()

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED)

ament_auto_add_executable(obstacle_stop_planner_node
src/debug_marker.cpp
src/node.cpp
src/main.cpp
src/adaptive_cruise_control.cpp
)

target_include_directories(obstacle_stop_planner_node
PUBLIC
${OpenCV_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
file(GLOB_RECURSE OBSTACLE_STOP_PLANNER_NODES_NODE_SRC
src/*
)
file(GLOB_RECURSE OBSTACLE_STOP_PLANNER_NODES_NODE_HEADERS
include/obstacle_stop_planner/*
)

target_link_libraries(obstacle_stop_planner_node
${OpenCV_LIBRARIES}
${PCL_LIBRARIES}
# generate component node library
ament_auto_add_library(obstacle_stop_planner_node SHARED
${OBSTACLE_STOP_PLANNER_NODES_NODE_SRC}
${OBSTACLE_STOP_PLANNER_NODES_NODE_HEADERS}
)
rclcpp_components_register_node(obstacle_stop_planner_node
PLUGIN "obstacle_stop_planner::ObstacleStopPlannerNode"
EXECUTABLE obstacle_stop_planner_node_exe
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

add_ros_test(
test/obstacle_stop_planner_node_launch_test.py
TIMEOUT "30"
)

find_package(ament_cmake_auto_gtest REQUIRED)
ament_auto_add_gtest(test_obstacle_stop_planner
DIRECTORY "test/"
)
endif()

ament_auto_package(
Expand Down
11 changes: 11 additions & 0 deletions obstacle_stop_planner_refine/config/test_vehicle_info.param.yaml
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
Loading