aron_conversions.cpp
Go to the documentation of this file.
1 #include "aron_conversions.h"
2 
7 
13 #include <armarx/navigation/global_planning/aron/AStarParams.aron.generated.h>
14 #include <armarx/navigation/global_planning/aron/GlobalPlannerParams.aron.generated.h>
15 #include <armarx/navigation/global_planning/aron/OrientationOptimizerParams.aron.generated.h>
16 #include <armarx/navigation/global_planning/aron/Point2PointParams.aron.generated.h>
17 #include <armarx/navigation/global_planning/aron/SPFAParams.aron.generated.h>
19 
21 {
22  void
23  toAron(arondto::GlobalPlannerParams& dto, const GlobalPlannerParams& bo)
24  {
25  }
26 
27  void
28  fromAron(const arondto::GlobalPlannerParams& dto, GlobalPlannerParams& bo)
29  {
30  }
31 
32  void
33  toAron(arondto::Point2PointParams& dto, const Point2PointParams& bo)
34  {
35  // fromAron(static_cast<const arondto::GlobalPlannerParams&>(dto), static_cast<const GlobalPlannerParams&>(bo));
36  aron::toAron(dto.includeStartPose, bo.includeStartPose);
37  aron::toAron(dto.velocity, bo.velocity);
38  }
39 
40  void
41  fromAron(const arondto::Point2PointParams& dto, Point2PointParams& bo)
42  {
43  // fromAron(static_cast<arondto::GlobalPlannerParams&>(dto), static_cast<GlobalPlannerParams&>(bo));
44  aron::fromAron(dto.includeStartPose, bo.includeStartPose);
45  aron::fromAron(dto.velocity, bo.velocity);
46  }
47 
48  void
49  toAron(arondto::AStarParams& dto, const AStarParams& bo)
50  {
51  // toAron(static_cast<arondto::GlobalPlannerParams&>(dto),
52  // static_cast<const GlobalPlannerParams&>(bo));
53 
54  aron::toAron(dto.linearVelocity, bo.linearVelocity);
55  aron::toAron(dto.resampleDistance, bo.resampleDistance);
56  }
57 
58  void
59  fromAron(const arondto::AStarParams& dto, AStarParams& bo)
60  {
61  // fromAron(static_cast<const arondto::GlobalPlannerParams&>(dto),
62  // static_cast<GlobalPlannerParams&>(bo));
63 
64  aron::fromAron(dto.linearVelocity, bo.linearVelocity);
65  aron::fromAron(dto.resampleDistance, bo.resampleDistance);
66  }
67 
68  void
69  toAron(arondto::SPFAParams& dto, const SPFAParams& bo)
70  {
71  // toAron(static_cast<arondto::GlobalPlannerParams&>(dto),
72  // static_cast<const GlobalPlannerParams&>(bo));
73 
74  aron::toAron(dto.linearVelocity, bo.linearVelocity);
75  aron::toAron(dto.resampleDistance, bo.resampleDistance);
76  algorithms::toAron(dto.algo, bo.algo);
77 
78  toAron(dto.optimizer, bo.optimizerParams);
79  }
80 
81  void
82  fromAron(const arondto::SPFAParams& dto, SPFAParams& bo)
83  {
84  // fromAron(static_cast<const arondto::GlobalPlannerParams&>(dto),
85  // static_cast<GlobalPlannerParams&>(bo));
86 
87  aron::fromAron(dto.linearVelocity, bo.linearVelocity);
88  aron::fromAron(dto.resampleDistance, bo.resampleDistance);
89 
90  algorithms::fromAron(dto.algo, bo.algo);
91 
92  fromAron(dto.optimizer, bo.optimizerParams);
93  }
94 
95  // std::optional
96  template <typename DtoT, typename BoT>
97  void
98  toAron(std::optional<DtoT>& dto, const std::optional<BoT>& bo)
99  {
100  if (bo.has_value())
101  {
102  dto = DtoT{};
103  toAron(*dto, *bo);
104  }
105  else
106  {
107  dto = std::nullopt;
108  }
109  }
110 
111  void
112  toAron(arondto::OrientationOptimizerParams& dto,
114  {
115  aron::toAron(dto.iterations, bo.iterations);
116  aron::toAron(dto.movementDirWeightStart, bo.movementDirWeightStart);
117  aron::toAron(dto.movementDirWeightEnd, bo.movementDirWeightEnd);
118 
119  aron::toAron(dto.smoothnessWeight, bo.smoothnessWeight);
120  aron::toAron(dto.smoothnessWeightStartGoal, bo.smoothnessWeightStartGoal);
121 
122  aron::toAron(dto.priorStartWeight, bo.priorStartWeight);
123  aron::toAron(dto.priorEndWeight, bo.priorEndWeight);
124 
125  aron::toAron(dto.startGoalDistanceThreshold, bo.startGoalDistanceThreshold);
126 
127  toAron(dto.predefinedRotationDirection, bo.predefinedRotationDirection);
128  }
129 
130  template <typename DtoT, typename BoT>
131  void
132  fromAron(const std::optional<DtoT>& dto, std::optional<BoT>& bo)
133  {
134  if (dto.has_value())
135  {
136  bo = BoT{};
137  fromAron(*dto, *bo);
138  }
139  else
140  {
141  bo = std::nullopt;
142  }
143  }
144 
145  void
146  fromAron(const arondto::OrientationOptimizerParams& dto,
148  {
149  aron::fromAron(dto.iterations, bo.iterations);
150  aron::fromAron(dto.movementDirWeightStart, bo.movementDirWeightStart);
151  aron::fromAron(dto.movementDirWeightEnd, bo.movementDirWeightEnd);
152 
153  aron::fromAron(dto.smoothnessWeight, bo.smoothnessWeight);
154  aron::fromAron(dto.smoothnessWeightStartGoal, bo.smoothnessWeightStartGoal);
155 
156  aron::fromAron(dto.priorStartWeight, bo.priorStartWeight);
157  aron::fromAron(dto.priorEndWeight, bo.priorEndWeight);
158 
159  aron::fromAron(dto.startGoalDistanceThreshold, bo.startGoalDistanceThreshold);
160 
161  fromAron(dto.predefinedRotationDirection, bo.predefinedRotationDirection);
162  }
163 
164  void
166  {
167  switch (bo)
168  {
170  dto.value = arondto::RotationDirection::CLOCK_WISE;
171  break;
173  dto.value = arondto::RotationDirection::COUNTER_CLOCK_WISE;
174  break;
175  }
176  }
177 
178  void
180  {
181  switch (dto.value)
182  {
183  case arondto::rotation_direction_details::Enum::CLOCK_WISE:
185  break;
186  case arondto::rotation_direction_details::Enum::COUNTER_CLOCK_WISE:
188  break;
189  }
190  }
191 
192 
193 } // namespace armarx::navigation::global_planning::aron_conv
SPFA.h
armarx::navigation::global_planning::AStarParams
Parameters for AStar.
Definition: AStar.h:35
aron_conversions.h
armarx::navigation::algorithms::fromAron
Costmap fromAron(const armem::wm::EntityInstance &entityInstance)
Definition: aron_conversions.cpp:61
OrientationOptimizer.h
stl.h
armarx::navigation::global_planning::GlobalPlannerParams
Parameters for GlobalPlanner.
Definition: GlobalPlanner.h:48
aron_conversions.h
armarx::navigation::global_planning::aron_conv::toAron
void toAron(arondto::GlobalPlannerParams &dto, const GlobalPlannerParams &bo)
Definition: aron_conversions.cpp:23
armarx::navigation::global_planning::optimization::OrientationOptimizerParams
Definition: OrientationOptimizer.h:37
Point2Point.h
armarx::navigation::global_planning::optimization::RotationDirection::CounterClockwise
@ CounterClockwise
armarx::navigation::global_planning::aron_conv::fromAron
void fromAron(const arondto::GlobalPlannerParams &dto, GlobalPlannerParams &bo)
Definition: aron_conversions.cpp:28
armarx::navigation::global_planning::aron_conv
Definition: aron_conversions.cpp:20
core.h
armarx::navigation::algorithms::toAron
aron::data::NDArrayPtr toAron(const Costmap::Grid &grid)
Definition: aron_conversions.cpp:17
GlobalPlanner.h
aron_conversions.h
armarx::aron::toAron
void toAron(T &dto, const T &bo)
Framework for converting ARON DTOs (Data Transfer Objects) to C++ BOs (Business Objects) and back.
Definition: aron_conversions.h:74
armarx::navigation::global_planning::Point2PointParams
Parameters for Point2Point.
Definition: Point2Point.h:35
armarx::navigation::global_planning::optimization::RotationDirection::Clockwise
@ Clockwise
armarx::navigation::global_planning::optimization::RotationDirection
RotationDirection
Definition: OrientationOptimizer.h:31
armarx::aron::fromAron
void fromAron(const T &dto, T &bo)
Definition: aron_conversions.h:79
armarx::aron::bo
const std::optional< BoT > & bo
Definition: aron_conversions.h:168
armarx::navigation::global_planning::SPFAParams
Parameters for AStar.
Definition: SPFA.h:41
AStar.h