-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(autoware_trajectory): move trajectory_container from autoware_mo…
…tion_utils to a new package (#9253) * create trajectory container package Signed-off-by: Y.Hisaki <[email protected]> * update Signed-off-by: Y.Hisaki <[email protected]> * update Signed-off-by: Y.Hisaki <[email protected]> * style(pre-commit): autofix * update codeowner Signed-off-by: Y.Hisaki <[email protected]> * update Signed-off-by: Y.Hisaki <[email protected]> * fix cmake Signed-off-by: Y.Hisaki <[email protected]> --------- Signed-off-by: Y.Hisaki <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6c4de54
commit ca115d6
Showing
40 changed files
with
439 additions
and
374 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
|
@@ -22,6 +22,7 @@ common/autoware_signal_processing/** [email protected] [email protected] | |
common/autoware_test_utils/** [email protected] [email protected] [email protected] [email protected] | ||
common/autoware_testing/** [email protected] [email protected] [email protected] [email protected] | ||
common/autoware_time_utils/** [email protected] [email protected] [email protected] | ||
common/autoware_trajectory_container/** [email protected] [email protected] [email protected] | ||
common/autoware_universe_utils/** [email protected] [email protected] [email protected] | ||
common/autoware_vehicle_info_utils/** [email protected] [email protected] [email protected] [email protected] | ||
common/bag_time_manager_rviz_plugin/** [email protected] | ||
|
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
23 changes: 0 additions & 23 deletions
23
...autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator.hpp
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
...n/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/trajectory.hpp
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(autoware_trajectory) | ||
|
||
option(BUILD_EXAMPLES "Build examples" OFF) | ||
|
||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
ament_auto_add_library(autoware_trajectory SHARED | ||
DIRECTORY src | ||
) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_cmake_ros REQUIRED) | ||
|
||
file(GLOB_RECURSE test_files test/*.cpp) | ||
|
||
ament_add_ros_isolated_gtest(test_autoware_trajectory ${test_files}) | ||
|
||
target_link_libraries(test_autoware_trajectory | ||
autoware_trajectory | ||
) | ||
endif() | ||
|
||
if(BUILD_EXAMPLES) | ||
message(STATUS "Building examples") | ||
|
||
include(FetchContent) | ||
fetchcontent_declare( | ||
matplotlibcpp17 | ||
GIT_REPOSITORY https://github.com/soblin/matplotlibcpp17.git | ||
GIT_TAG master | ||
) | ||
fetchcontent_makeavailable(matplotlibcpp17) | ||
|
||
file(GLOB_RECURSE example_files examples/*.cpp) | ||
|
||
foreach(example_file ${example_files}) | ||
get_filename_component(example_name ${example_file} NAME_WE) | ||
ament_auto_add_executable(${example_name} ${example_file}) | ||
set_source_files_properties(${example_file} PROPERTIES COMPILE_FLAGS -Wno-error -Wno-attributes -Wno-unused-parameter) | ||
target_link_libraries(${example_name} | ||
autoware_trajectory | ||
matplotlibcpp17::matplotlibcpp17 | ||
) | ||
endforeach() | ||
endif() | ||
|
||
ament_auto_package() |
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,64 @@ | ||
# Autoware Trajectory | ||
|
||
This package provides classes to manage/manipulate Trajectory. | ||
|
||
## Example Usage | ||
|
||
This section describes Example Usage of `Trajectory<autoware_planning_msgs::msg::PathPoint>` | ||
|
||
- Load Trajectory from point array | ||
|
||
```cpp | ||
#include "autoware/trajectory/path_point.hpp" | ||
|
||
... | ||
|
||
std::vector<autoware_planning_msgs::msg::PathPoint> points = ... // Load points from somewhere | ||
|
||
using autoware::trajectory::Trajectory; | ||
|
||
std::optional<Trajectory<autoware_planning_msgs::msg::PathPoint>> trajectory = | ||
Trajectory<autoware_planning_msgs::msg::PathPoint>::Builder{} | ||
.build(points); | ||
``` | ||
|
||
- You can also specify interpolation method | ||
|
||
```cpp | ||
using autoware::trajectory::interpolator::CubicSpline; | ||
|
||
std::optional<Trajectory<autoware_planning_msgs::msg::PathPoint>> trajectory = | ||
Trajectory<autoware_planning_msgs::msg::PathPoint>::Builder{} | ||
.set_xy_interpolator<CubicSpline>() // Set interpolator for x-y plane | ||
.build(points); | ||
``` | ||
|
||
- Access point on Trajectory | ||
|
||
```cpp | ||
autoware_planning_msgs::msg::PathPoint point = trajectory->compute(1.0); // Get point at s=0.0. s is distance from start point on Trajectory. | ||
``` | ||
- Get length of Trajectory | ||
```cpp | ||
double length = trajectory->length(); | ||
``` | ||
|
||
- Set 3.0[m] ~ 5.0[m] part of velocity to 0.0 | ||
|
||
```cpp | ||
trajectory->longitudinal_velocity_mps(3.0, 5.0) = 0.0; | ||
``` | ||
- Crop Trajectory from 1.0[m] to 2.0[m] | ||
```cpp | ||
trajectory->crop(1.0, 2.0); | ||
``` | ||
|
||
- Restore points | ||
|
||
```cpp | ||
std::vector<autoware_planning_msgs::msg::PathPoint> points = trajectory->restore(); | ||
``` |
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
Oops, something went wrong.