aron_conversions.cpp
Go to the documentation of this file.
1#include "aron_conversions.h"
2
4#include <armarx/navigation/human/aron/Human.aron.generated.h>
6
7#include <range/v3/range/conversion.hpp>
8#include <range/v3/view/transform.hpp>
9
11{
12 void
13 toAron(arondto::Human& dto, const Human& bo)
14 {
15 dto.pose = conv::to3D(bo.pose).matrix();
16 dto.linearVelocity = conv::to3D(bo.linearVelocity);
17 dto.detectionTime = bo.detectionTime;
18 }
19
20 void
21 fromAron(const arondto::Human& dto, Human& bo)
22 {
23 bo.pose = conv::to2D(core::Pose(dto.pose));
24 bo.linearVelocity = conv::to2D(dto.linearVelocity);
25 bo.detectionTime = dto.detectionTime;
26 }
27
28 void
29 toAron(arondto::HumanGroup& dto, const HumanGroup& bo)
30 {
31 dto.shape = bo.shape.vertices |
32 ranges::views::transform([](const Eigen::Vector2f& boVer) -> Eigen::Vector3f
33 { return conv::to3D(boVer); }) |
34 ranges::to_vector;
35
36 dto.humans = bo.humans |
37 ranges::views::transform(
38 [](const Human& boHuman) -> arondto::Human
39 {
40 arondto::Human dtoHuman;
41 toAron(dtoHuman, boHuman);
42 return dtoHuman;
43 }) |
44 ranges::to_vector;
45 dto.detectionTime = bo.detectionTime;
46 }
47
48 void
49 fromAron(const arondto::HumanGroup& dto, HumanGroup& bo)
50 {
51 bo.shape.vertices =
52 dto.shape |
53 ranges::views::transform([](const Eigen::Vector3f& dtoVer) -> Eigen::Vector2f
54 { return conv::to2D(dtoVer); }) |
55 ranges::to_vector;
56
57 bo.humans = dto.humans |
58 ranges::views::transform(
59 [](const arondto::Human& dtoHuman) -> Human
60 {
61 Human boHuman;
62 fromAron(dtoHuman, boHuman);
63 return boHuman;
64 }) |
65 ranges::to_vector;
66 bo.detectionTime = dto.detectionTime;
67 }
68
69} // namespace armarx::navigation::human
std::vector< Eigen::Vector2f > to2D(const std::vector< Eigen::Vector3f > &v)
Definition eigen.cpp:29
std::vector< Eigen::Vector3f > to3D(const std::vector< Eigen::Vector2f > &v)
Definition eigen.cpp:14
Eigen::Isometry3f Pose
Definition basic_types.h:31
This file is part of ArmarX.
void toAron(arondto::Human &dto, const Human &bo)
void fromAron(const arondto::Human &dto, Human &bo)
Eigen::Vector2f linearVelocity
Definition types.h:39
std::vector< Eigen::Vector2f > vertices
Definition shapes.h:45