ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
gapconverter.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Daniel Heß - initial API and implementation
13  ********************************************************************************/
14 #pragma once
15 
16 #include <adore/env/afactory.h>
17 #include <adore_if_ros_msg/GapQueue.h>
18 
19 
20 namespace adore
21 {
22  namespace if_ROS
23  {
24  struct GapConverter
25  {
30  {
32  for(const auto& entry:value)
33  {
34  msg.data.push_back(this->operator()(entry));
35  }
36  return msg;
37  }
38  adore_if_ros_msg::GapData operator()(const adore::env::GapData& value)
39  {
40  adore_if_ros_msg::GapData msg;
41  msg.rating = value.rating;
42  msg.feasible = value.feasible;
43  msg.anchor_X = value.anchor_X;
44  msg.anchor_Y = value.anchor_Y;
45  msg.anchor_Z = value.anchor_Z;
46  msg.anchor_dX = value.anchor_dX;
47  msg.anchor_dY = value.anchor_dY;
48  msg.anchor_dZ = value.anchor_dZ;
49  msg.anchor_vt = value.anchor_vt;
50  msg.t_obs = value.t_obs;
51  msg.lead_exists = value.lead_exists;
52  msg.chase_exists = value.chase_exists;
53  msg.s_lead = value.s_lead;
54  msg.s_chase = value.s_chase;
55  msg.v_lead = value.v_lead;
56  msg.v_chase = value.v_chase;
57  msg.s_anchor = value.s_anchor;
58  msg.s_gate_opening = value.s_gate_opening;
59  msg.s_gate_closure = value.s_gate_closure;
60  return msg;
61  }
62  void operator()(const adore_if_ros_msg::GapData* msg,adore::env::GapData* value)
63  {
64  value->rating = msg->rating;
65  value->feasible = msg->feasible;
66  value->anchor_X = msg->anchor_X;
67  value->anchor_Y = msg->anchor_Y;
68  value->anchor_Z = msg->anchor_Z;
69  value->anchor_dX = msg->anchor_dX;
70  value->anchor_dY = msg->anchor_dY;
71  value->anchor_dZ = msg->anchor_dZ;
72  value->anchor_vt = msg->anchor_vt;
73  value->t_obs = msg->t_obs;
74  value->lead_exists = msg->lead_exists;
75  value->chase_exists = msg->chase_exists;
76  value->s_lead = msg->s_lead;
77  value->s_chase = msg->s_chase;
78  value->v_lead = msg->v_lead;
79  value->v_chase = msg->v_chase;
80  value->s_anchor = msg->s_anchor;
81  value->s_gate_opening = msg->s_gate_opening;
82  value->s_gate_closure = msg->s_gate_closure;
83  }
87  void operator()(adore_if_ros_msg::GapQueueConstPtr msg,adore::env::GapQueue* queue)
88  {
89  queue->clear();
90  for(const auto& entry:msg->data)
91  {
93  this->operator()(&entry,&gap);
94  queue->push_back(gap);
95  }
96  }
97  };
98  }
99 }
std::vector< GapData > GapQueue
Definition: gapdata.h:53
Definition: areaofeffectconverter.h:20
Definition: gapdata.h:27
double v_lead
Definition: gapdata.h:43
bool lead_exists
Definition: gapdata.h:39
double anchor_dY
Definition: gapdata.h:35
double s_lead
Definition: gapdata.h:41
bool chase_exists
Definition: gapdata.h:40
double s_gate_opening
Definition: gapdata.h:46
double anchor_Z
Definition: gapdata.h:33
double anchor_X
Definition: gapdata.h:31
bool feasible
Definition: gapdata.h:30
double v_chase
Definition: gapdata.h:44
double anchor_dX
Definition: gapdata.h:34
double anchor_Y
Definition: gapdata.h:32
double rating
Definition: gapdata.h:29
double anchor_vt
Definition: gapdata.h:37
double t_obs
Definition: gapdata.h:38
double s_chase
Definition: gapdata.h:42
double anchor_dZ
Definition: gapdata.h:36
double s_anchor
Definition: gapdata.h:45
double s_gate_closure
Definition: gapdata.h:47
Definition: gapconverter.h:25
void operator()(adore_if_ros_msg::GapQueueConstPtr msg, adore::env::GapQueue *queue)
Definition: gapconverter.h:87
void operator()(const adore_if_ros_msg::GapData *msg, adore::env::GapData *value)
Definition: gapconverter.h:62
adore_if_ros_msg::GapData operator()(const adore::env::GapData &value)
Definition: gapconverter.h:38
adore_if_ros_msg::GapQueue operator()(const adore::env::GapQueue &value)
Definition: gapconverter.h:29