ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
occupancyconverter.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/OccupancyCylinderPredictionSet.h>
18 
19 
20 namespace adore
21 {
22  namespace if_ROS
23  {
25  {
30  {
32  for(auto& prediction: set)
33  {
34  adore_if_ros_msg::OccupancyCylinderPrediction msgi;
35  msgi.trackingID = prediction.trackingID_;
36  msgi.v2xStationID = prediction.v2xStationID_;
37  msgi.branchID = prediction.branchID_;
38  msgi.predecessorID = prediction.predecessorID_;
39  msgi.confidence = prediction.confidence_;
40  for(const auto& pair: prediction.occupancy_.getLevel(0))
41  {
42  const auto& cylinder = pair.second;
43  adore_if_ros_msg::OccupancyCylinder msgij;
44  msgij.rxy = cylinder.rxy_;
45  msgij.x = cylinder.x_;
46  msgij.y = cylinder.y_;
47  msgij.t0 = cylinder.t0_;
48  msgij.t1 = cylinder.t1_;
49  msgij.z0 = cylinder.z0_;
50  msgij.z1 = cylinder.z1_;
51  msgi.occupancy.push_back(msgij);
52  }
53  msg.data.push_back(msgi);
54  }
55 
56  return msg;
57  }
61  void operator()(adore_if_ros_msg::OccupancyCylinderPredictionSetConstPtr msg,adore::env::OccupancyCylinderPredictionSet* set)
62  {
63  set->clear();
64  for(auto& msgi:msg->data)
65  {
67  prediction.trackingID_ = msgi.trackingID;
68  prediction.v2xStationID_ = msgi.v2xStationID;
69  prediction.branchID_ = msgi.branchID;
70  prediction.predecessorID_ = msgi.predecessorID;
71  prediction.confidence_ = msgi.confidence;
72  for(auto& msgij:msgi.occupancy)
73  {
75  cylinder.rxy_ = msgij.rxy;
76  cylinder.x_ = msgij.x;
77  cylinder.y_ = msgij.y;
78  cylinder.t0_ = msgij.t0;
79  cylinder.t1_ = msgij.t1;
80  cylinder.z0_ = msgij.z0;
81  cylinder.z1_ = msgij.z1;
82  prediction.occupancy_.insert(cylinder);
83  }
84  set->push_back(prediction);
85  }
86  }
87  };
88  }
89 }
void insert(const VolumeType &volume)
Definition: vectorbasedvolumetree.h:90
std::vector< OccupancyCylinderPrediction > OccupancyCylinderPredictionSet
Definition: occupancycylinderprediction.h:40
void set(T *data, T value, int size)
Definition: adoremath.h:39
Definition: areaofeffectconverter.h:20
Definition: occupancycylinderprediction.h:27
int branchID_
Definition: occupancycylinderprediction.h:31
int trackingID_
Definition: occupancycylinderprediction.h:30
int v2xStationID_
Definition: occupancycylinderprediction.h:29
adore::mad::OccupancyCylinderTree occupancy_
Definition: occupancycylinderprediction.h:33
float confidence_
Definition: occupancycylinderprediction.h:34
int predecessorID_
Definition: occupancycylinderprediction.h:32
Definition: occupancyconverter.h:25
void operator()(adore_if_ros_msg::OccupancyCylinderPredictionSetConstPtr msg, adore::env::OccupancyCylinderPredictionSet *set)
Definition: occupancyconverter.h:61
adore_if_ros_msg::OccupancyCylinderPredictionSet operator()(const adore::env::OccupancyCylinderPredictionSet &set)
Definition: occupancyconverter.h:29
Definition: occupancycylinder.h:25
double rxy_
Definition: occupancycylinder.h:26
double t0_
Definition: occupancycylinder.h:28
double y_
Definition: occupancycylinder.h:27
double z1_
Definition: occupancycylinder.h:29
double t1_
Definition: occupancycylinder.h:28
double z0_
Definition: occupancycylinder.h:29
double x_
Definition: occupancycylinder.h:27