ProxemicZoneCreator.cpp
Go to the documentation of this file.
1 #include "ProxemicZoneCreator.h"
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
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::movementInfluence
float movementInfluence
Definition: ProxemicZoneCreator.h:40
armarx::navigation::human::Human
Definition: types.h:36
basic_types.h
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::intimateWeight
float intimateWeight
Definition: ProxemicZoneCreator.h:34
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::intimateRadius
float intimateRadius
Definition: ProxemicZoneCreator.h:37
armarx::navigation::human::Human::pose
core::Pose2D pose
Definition: types.h:38
types.h
armarx::navigation::human
This file is part of ArmarX.
Definition: aron_conversions.cpp:10
armarx::navigation::core::Pose2D
Eigen::Isometry2f Pose2D
Definition: basic_types.h:34
armarx::navigation::human::ProxemicZones
std::vector< ProxemicZone > ProxemicZones
Definition: types.h:84
GfxTL::Matrix2f
MatrixXX< 2, 2, float > Matrix2f
Definition: MatrixXX.h:648
armarx::navigation::human::ProxemicZone::pose
core::Pose2D pose
Definition: types.h:77
armarx::navigation::human::ProxemicZone
Definition: types.h:75
ProxemicZoneCreator.h
armarx::navigation::human::ProxemicZoneCreator::createProxemicZones
ProxemicZones createProxemicZones(const Human &human)
Definition: ProxemicZoneCreator.cpp:14
armarx::navigation::human::Human::linearVelocity
Eigen::Vector2f linearVelocity
Definition: types.h:39
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::personalWeight
float personalWeight
Definition: ProxemicZoneCreator.h:35
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::personalRadius
float personalRadius
Definition: ProxemicZoneCreator.h:38
armarx::navigation::human::ProxemicZoneCreator::ProxemicParameters::offset
Eigen::Vector2f offset
Definition: ProxemicZoneCreator.h:44