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