27#include <Eigen/Geometry>
29#include <SimoxUtility/math/convert/mat3f_to_rpy.h>
30#include <VirtualRobot/CollisionDetection/CollisionChecker.h>
31#include <VirtualRobot/Robot.h>
32#include <VirtualRobot/SceneObjectSet.h>
42#include <range/v3/numeric/accumulate.hpp>
43#include <range/v3/range/conversion.hpp>
44#include <range/v3/view/transform.hpp>
52 sceneBounds(sceneBounds), parameters(parameters)
59 const auto humanPoses = getHumanPoses(humans);
60 return create(humanPoses, mode);
66 const auto grid = createUniformGrid(sceneBounds, parameters);
72 << costmap.
getGrid().cols() <<
")";
77 fillGridCostsMode1(costmap, humanPoses);
87 initializeMask(costmap);
97 ARMARX_VERBOSE <<
"Initializing mask: Fraction of valid elements: "
98 << costmap.
getMask()->cast<
float>().sum() / costmap.
getMask()->size();
110 size_t c_x = (sceneBounds.
max.x() - sceneBounds.
min.x()) / parameters.
cellSize + 1;
111 size_t c_y = (sceneBounds.
max.y() - sceneBounds.
min.y()) / parameters.
cellSize + 1;
116 Eigen::MatrixXf grid(c_x, c_y);
123 toM(Eigen::Isometry3f t) -> Eigen::Isometry3f
125 t.translation() *= 0.001;
130 toM(Eigen::Vector3f t) -> Eigen::Vector3f
138 const std::vector<navigation::core::Pose2D>& humanPoses)
143 float std_deviation = 1'000'000.0f;
144 float peak_height = 1.0f;
147 humanPoses | ranges::views::transform(
150 float result = peak_height * exp(-0.5 * (global_T_human_2d.translation() - position.head<2>()).squaredNorm() / std_deviation);
156 if (ranges::empty(costs))
160 return ranges::max(costs);
164 SocialCostmapBuilder::fillGridCostsMode1(navigation::algorithms::Costmap& costmap,
const std::vector<navigation::core::Pose2D>& humanPoses)
167 const std::size_t c_x = costmap.getGrid().rows();
168 const std::size_t c_y = costmap.getGrid().cols();
172 for (
unsigned int x = 0;
x < c_x;
x++)
174 for (
unsigned int y = 0; y < c_y; y++)
179 costmap.getMutableGrid()(x, y) =
185 std::vector<navigation::core::Pose2D>
188 return humans | ranges::views::transform(
192 }) | ranges::to_vector;
static DateTime Now()
Current time on the virtual clock.
const Grid & getGrid() const
std::optional< Costmap::Mask > & getMutableMask() noexcept
const std::optional< Mask > & getMask() const noexcept
navigation::algorithms::Costmap create(const navigation::human::Humans &humans, Mode mode)
SocialCostmapBuilder(const navigation::algorithms::SceneBounds sceneBounds, const navigation::algorithms::Costmap::Parameters ¶meters)
#define ARMARX_VERBOSE
The logging level for verbose information.
This file is part of ArmarX.
auto toM(Eigen::Isometry3f t) -> Eigen::Isometry3f
std::vector< Eigen::Vector3f > to3D(const std::vector< Eigen::Vector2f > &v)
std::vector< Human > Humans
This file offers overloads of toIce() and fromIce() functions for STL container types.
float cellSize
How big each cell is in the uniform grid.