Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
critic_data.hpp
1 // Copyright (c) 2022 Samsung Research America, @artofnothingness Alexey Budyakov
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_MPPI_CONTROLLER__CRITIC_DATA_HPP_
16 #define NAV2_MPPI_CONTROLLER__CRITIC_DATA_HPP_
17 
18 #include <memory>
19 #include <vector>
20 
21 // xtensor creates warnings that needs to be ignored as we are building with -Werror
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Warray-bounds"
24 #pragma GCC diagnostic ignored "-Wstringop-overflow"
25 #include <xtensor/xtensor.hpp>
26 #pragma GCC diagnostic pop
27 
28 #include "geometry_msgs/msg/pose_stamped.hpp"
29 #include "nav2_core/goal_checker.hpp"
30 #include "nav2_mppi_controller/models/state.hpp"
31 #include "nav2_mppi_controller/models/trajectories.hpp"
32 #include "nav2_mppi_controller/models/path.hpp"
33 #include "nav2_mppi_controller/motion_models.hpp"
34 
35 
36 namespace mppi
37 {
38 
44 struct CriticData
45 {
46  const models::State & state;
47  const models::Trajectories & trajectories;
48  const models::Path & path;
49  const geometry_msgs::msg::Pose & goal;
50 
51  xt::xtensor<float, 1> & costs;
52  float & model_dt;
53 
54  bool fail_flag;
55  nav2_core::GoalChecker * goal_checker;
56  std::shared_ptr<MotionModel> motion_model;
57  std::optional<std::vector<bool>> path_pts_valid;
58  std::optional<size_t> furthest_reached_path_point;
59 };
60 
61 } // namespace mppi
62 
63 #endif // NAV2_MPPI_CONTROLLER__CRITIC_DATA_HPP_
Function-object for checking whether a goal has been reached.
Data to pass to critics for scoring, including state, trajectories, pruned path, global goal,...
Definition: critic_data.hpp:45
Path represented as a tensor.
Definition: path.hpp:33
State information: velocities, controls, poses, speed.
Definition: state.hpp:36
Candidate Trajectories.