HandoverCostmapBuilder.h
Go to the documentation of this file.
1/**
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author ( )
17 * @date 2026
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <optional>
25#include <vector>
26
30
32
34{
35
37 {
38 public:
40 {
41 // radial distance from human to handover location
42 float handoverDistanceMin = 700.0f; // in mm
43 float handoverDistanceMax = 1500.0f; // in mm
44 float handoverDistancePreference = 1000.0f; // in mm
45
46 // angular sector in front of human where handover location is preferred
47 float handoverAngleMin = -30.0f; // in degrees
48 float handoverAngleMax = 30.0f; // in degrees
49 float handoverAnglePreference = 0; // in degrees
50
51 // scene bound params from human position
52 float humanSceneBoundOffsetBehind = 1000.0f; // in mm
53 float humanSceneBoundOffsetFront = 2000.0f; // in mm
54 float humanSceneBoundOffsetSideLeft = 1500.0f; // in mm
55 float humanSceneBoundOffsetSideRight = 1500.0f; // in mm
56
57 // additive cost penalty applied to candidates whose distance to the
58 // nearest obstacle is below `obstacleProximityThreshold` (instead of
59 // scaling the whole cost by the distance to the nearest obstacle)
60 float obstacleProximityThreshold = 50.0f; // in mm
62
63 // If robotPosition is provided and weight > 0, the SPFA path cost from
64 // the robot to each candidate is added to the handover cost. This favors
65 // placements that are closer to the robot and reachable without passing
66 // through narrow spaces (the SPFA edge cost penalizes proximity to
67 // obstacles).
68 float robotPathCostWeight = 0.5f; // 0 disables the term
69 float robotPathMaxCostMM = 5000.0f; // saturation distance
70
71 // Parameters for the internal SPFA run used to compute robotPathCost.
73 };
74
76 {
77 //! information about the human for handover
79
80 //! information about other humans in the scene
81 std::vector<armarx::armem::human::HumanPose> otherHumans;
82
83 //! distance to obstacles in the environment
85
86 //! Optional override for the human's 2-D pose. When set, the builder uses this
87 //! instead of deriving the pose from the skeleton in \c humanPose.
88 std::optional<armarx::navigation::core::Pose2D> humanPose2DOverride;
89
90 //! Optional global 2-D position of the robot. When set, the builder runs an
91 //! SPFA from this position on the distance map and adds the path cost to
92 //! every handover candidate, while masking out unreachable cells.
93 std::optional<Eigen::Vector2f> robotPosition;
94 };
95
96 HandoverCostmapBuilder(const Costmap::Parameters& costmapParameters,
97 const Parameters& handoverParameters);
98
99 [[nodiscard]] std::optional<Costmap> create(const SceneInformation& sceneInfo);
100
101 std::optional<core::Pose2D> getOptimalHandoverPose(const SceneInformation& sceneInfo);
102
103 protected:
104 private:
105 const navigation::algorithms::Costmap::Parameters costmapParameters_;
106 const Parameters handoverParameters_;
107 };
108
109} // namespace armarx::navigation::algorithms::costmap
std::optional< core::Pose2D > getOptimalHandoverPose(const SceneInformation &sceneInfo)
std::optional< Costmap > create(const SceneInformation &sceneInfo)
HandoverCostmapBuilder(const Costmap::Parameters &costmapParameters, const Parameters &handoverParameters)
std::optional< armarx::navigation::core::Pose2D > humanPose2DOverride
Optional override for the human's 2-D pose.
armarx::armem::human::HumanPose humanPose
information about the human for handover
std::optional< Eigen::Vector2f > robotPosition
Optional global 2-D position of the robot.
std::vector< armarx::armem::human::HumanPose > otherHumans
information about other humans in the scene