ProxemicZoneCreator.cpp
Go to the documentation of this file.
2
3#include <math.h>
4
5#include <cmath>
6
9
11{
12
15 {
16 const Eigen::Matrix2f global_R_human = human.pose.linear();
17 const Eigen::Vector2f global_V_offset = global_R_human * params.offset;
18
19 core::Pose2D pose = human.pose;
20 pose.translation() += global_V_offset;
21
22 // intimate zone
23 ProxemicZone intimate{
24 .pose = pose,
25 .shape = {.a = params.intimateRadius, .b = params.intimateRadius},
26 .penalty = intimatePenalty,
27 .weight = params.intimateWeight,
28 .homotopicRelevance = true,
29 };
30
31 // personal zone
32 float velocityNorm = human.linearVelocity.norm();
33 // stretch with velocity in m/s as factor
34 float movementStretch = 1 + velocityNorm * params.movementInfluence / 1000; // [mm] to [m]
35 if (velocityNorm != 0)
36 {
37 // y pointing forward
38 float movementDirection =
39 std::atan2(human.linearVelocity.y(), human.linearVelocity.x()) - M_PI_2;
40 pose.linear() = Eigen::Rotation2Df(movementDirection).toRotationMatrix();
41 pose.translation() +=
42 human.linearVelocity / velocityNorm * params.personalRadius * (movementStretch - 1);
43 }
44
45 ProxemicZone personal{
46 .pose = pose,
47 .shape = {.a = params.personalRadius, .b = movementStretch * params.personalRadius},
48 .penalty = personalPenalty,
49 .weight = params.personalWeight,
50 .homotopicRelevance = false,
51 };
52
53 return {intimate, personal};
54 }
55
56
57} // namespace armarx::navigation::human
ProxemicZones createProxemicZones(const Human &human)
Eigen::Isometry2f Pose2D
Definition basic_types.h:34
This file is part of ArmarX.
std::vector< ProxemicZone > ProxemicZones
Definition types.h:84