Skip to content

Commit 8d4f6f4

Browse files
SteveMacenskiruffsldoisygGuillaume Doisy
authored
Adding new MPPI controller to Nav2 (ros-navigation#3350)
* adding new MPPI controller to Nav2 * fixing rename for Nav2 staging * using larger resource class * fix plugin name * wz typo * add mppi gif * Update defaults.yaml * Update makeflags to match core count of resource_class: large * Bump cache version for testing CI changes * fixing tests * remove unused function * Update config.yml * adding a little more detail * adding contextual note * adding contextual exceptions * Fix using different frame for global and local costmap (ros-navigation#3425) * getGlobalPlanConsideringBoundsInCostmapFrame Replace transformPlanPosesToCostmapFrame and getGlobalPlanConsideringBounds by getGlobalPlanConsideringBoundsInCostmapFrame * use stamp from robot pose for transform * style * fix test * lint test --------- Co-authored-by: Guillaume Doisy <[email protected]> --------- Co-authored-by: ruffsl <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]>
1 parent 8dea742 commit 8d4f6f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+9141
-4
lines changed

.circleci/config.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ _commands:
3333
- restore_cache:
3434
name: Restore Cache << parameters.key >>
3535
keys:
36-
- "<< parameters.key >>-v12\
36+
- "<< parameters.key >>-v13\
3737
-{{ arch }}\
3838
-{{ .Branch }}\
3939
-{{ .Environment.CIRCLE_PR_NUMBER }}\
4040
-{{ checksum \"<< parameters.workspace >>/lockfile.txt\" }}"
41-
- "<< parameters.key >>-v12\
41+
- "<< parameters.key >>-v13\
4242
-{{ arch }}\
4343
-main\
4444
-<no value>\
@@ -58,7 +58,7 @@ _commands:
5858
steps:
5959
- save_cache:
6060
name: Save Cache << parameters.key >>
61-
key: "<< parameters.key >>-v12\
61+
key: "<< parameters.key >>-v13\
6262
-{{ arch }}\
6363
-{{ .Branch }}\
6464
-{{ .Environment.CIRCLE_PR_NUMBER }}\
@@ -453,6 +453,7 @@ executors:
453453
release_exec:
454454
docker:
455455
- image: ghcr.io/ros-planning/navigation2:main
456+
resource_class: large
456457
working_directory: /opt/overlay_ws
457458
environment:
458459
<<: *common_environment

.circleci/defaults.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ _common: &common
66
"build":
77
<<: *common
88
"executor": "parallel"
9-
"parallel-workers": 2
9+
"parallel-workers": 4
1010
"symlink-install": true
1111
"test":
1212
<<: *common

codecov.yml

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ ignore:
77
- "*/test/**/*" # ignore package test directories, e.g. nav2_costmap_2d/tests
88
- "**/test_*.*" # ignore files starting with test_ e.g. nav2_map_server/test/test_constants.cpp
99
- "**/*_tests.*" # ignore files ending with _tests e.g. nav2_voxel_grid/test/voxel_grid_tests.cpp
10+
- "*/**/benchmark/*" # ignore package test directories, e.g. nav2_dwb_controller/costmap_queue/tests
11+
- "*/benchmark/**/*" # ignore package test directories, e.g. nav2_costmap_2d/tests
12+
- "**/benchmark_*.*" # ignore files starting with test_ e.g. nav2_map_server/test/test_constants.cpp
13+
- "**/*_benchmark.*" # ignore files ending with _tests e.g. nav2_voxel_grid/test/voxel_grid_tests.cpp

nav2_mppi_controller/CMakeLists.txt

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(nav2_mppi_controller)
3+
4+
add_definitions(-DXTENSOR_ENABLE_XSIMD)
5+
add_definitions(-DXTENSOR_USE_XSIMD)
6+
7+
set(XTENSOR_USE_TBB 0)
8+
set(XTENSOR_USE_OPENMP 0)
9+
10+
11+
find_package(ament_cmake REQUIRED)
12+
find_package(xtensor REQUIRED)
13+
14+
set(dependencies_pkgs
15+
rclcpp
16+
nav2_common
17+
pluginlib
18+
tf2
19+
geometry_msgs
20+
visualization_msgs
21+
nav_msgs
22+
nav2_core
23+
nav2_costmap_2d
24+
nav2_util
25+
tf2_geometry_msgs
26+
tf2_eigen
27+
tf2_ros
28+
)
29+
30+
foreach(pkg IN LISTS dependencies_pkgs)
31+
find_package(${pkg} REQUIRED)
32+
endforeach()
33+
34+
nav2_package()
35+
add_compile_options(-O3 -mavx2 -mfma -finline-limit=1000000 -ffp-contract=fast -ffast-math)
36+
37+
add_library(mppi_controller SHARED
38+
src/controller.cpp
39+
src/optimizer.cpp
40+
src/critic_manager.cpp
41+
src/trajectory_visualizer.cpp
42+
src/path_handler.cpp
43+
src/parameters_handler.cpp
44+
src/noise_generator.cpp
45+
)
46+
47+
add_library(mppi_critics SHARED
48+
src/critics/obstacles_critic.cpp
49+
src/critics/goal_critic.cpp
50+
src/critics/goal_angle_critic.cpp
51+
src/critics/path_align_critic.cpp
52+
src/critics/path_follow_critic.cpp
53+
src/critics/path_angle_critic.cpp
54+
src/critics/prefer_forward_critic.cpp
55+
src/critics/twirling_critic.cpp
56+
src/critics/constraint_critic.cpp
57+
)
58+
59+
set(libraries mppi_controller mppi_critics)
60+
61+
foreach(lib IN LISTS libraries)
62+
target_compile_options(${lib} PUBLIC -fconcepts)
63+
target_include_directories(${lib} PUBLIC include ${xsimd_INCLUDE_DIRS} ${OpenMP_INCLUDE_DIRS})
64+
target_link_libraries(${lib} xtensor xtensor::optimize xtensor::use_xsimd)
65+
ament_target_dependencies(${lib} ${dependencies_pkgs})
66+
endforeach()
67+
68+
install(TARGETS mppi_controller mppi_critics
69+
ARCHIVE DESTINATION lib
70+
LIBRARY DESTINATION lib
71+
RUNTIME DESTINATION bin
72+
)
73+
74+
install(DIRECTORY include/
75+
DESTINATION include/
76+
)
77+
78+
if(BUILD_TESTING)
79+
find_package(ament_lint_auto REQUIRED)
80+
find_package(ament_cmake_gtest REQUIRED)
81+
set(ament_cmake_copyright_FOUND TRUE)
82+
ament_lint_auto_find_test_dependencies()
83+
add_subdirectory(test)
84+
# add_subdirectory(benchmark)
85+
endif()
86+
87+
ament_export_libraries(${libraries})
88+
ament_export_dependencies(${dependencies_pkgs})
89+
ament_export_include_directories(include)
90+
pluginlib_export_plugin_description_file(nav2_core mppic.xml)
91+
pluginlib_export_plugin_description_file(nav2_mppi_controller critics.xml)
92+
93+
ament_package()

nav2_mppi_controller/LICENSE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2021-2022 Fast Sense Studio
4+
Copyright (c) 2022-2023 Samsung Research America
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

0 commit comments

Comments
 (0)