ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
setpointrequestconverter.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 
15 #pragma once
16 
17 #include <adore/fun/afactory.h>
19 #include <adore_if_ros_msg/NavigationGoal.h>
20 #include <adore_if_ros_msg/SetPointRequest.h>
21 #include <adore_if_ros_msg/TerminalRequest.h>
22 #include <adore_if_ros_msg/WheelSpeed.h>
23 #include <tf/tf.h>
24 #include <tf/LinearMath/Quaternion.h>
25 #include <std_msgs/Float64.h>
26 #include <std_msgs/Float32.h>
27 #include <std_msgs/Int8.h>
28 #include <std_msgs/Bool.h>
29 #include <nav_msgs/Odometry.h>
30 
31 namespace adore
32 {
33  namespace if_ROS
34  {
39  {
43  template<typename Tmsg>//adore_if_ros_msg::SetPointRequestConstPtr
45  {
46  spr->setPointRequestID = msg->requestId;
47  spr->setPoints.clear();
48  for(auto& it : msg->setPoints)
49  {
51  sp.maneuverID = it.maneuverId;
52  sp.tStart = it.tStart;
53  sp.tEnd = it.tEnd;
54  sp.x0ref.setX(it.X);
55  sp.x0ref.setY(it.Y);
56  sp.x0ref.setPSI(it.PSI);
57  sp.x0ref.setvx(it.vx);
58  sp.x0ref.setvy(it.vy);
59  sp.x0ref.setOmega(it.omega);
60  sp.x0ref.setAx(it.ax);
61  sp.x0ref.setDelta(it.delta);
62  sp.x0ref.setDAx(it.dax);
63  sp.x0ref.setDDelta(it.ddelta);
64  spr->setPoints.push_back(sp);
65  }
66  }
70  template<typename Tmsg>//adore_if_ros_msg::SetPointRequestConstPtr
71  void operator()(Tmsg msg,adore::fun::SetPoint* sp)
72  {
73  sp->maneuverID = msg->maneuverId;
74  sp->tStart = msg->tStart;
75  sp->tEnd = msg->tEnd;
76  sp->x0ref.setX(msg->X);
77  sp->x0ref.setY(msg->Y);
78  sp->x0ref.setPSI(msg->PSI);
79  sp->x0ref.setvx(msg->vx);
80  sp->x0ref.setvy(msg->vy);
81  sp->x0ref.setOmega(msg->omega);
82  sp->x0ref.setAx(msg->ax);
83  sp->x0ref.setDelta(msg->delta);
84  sp->x0ref.setDAx(msg->dax);
85  sp->x0ref.setDDelta(msg->ddelta);
86  }
90  adore_if_ros_msg::SetPoint operator()(const adore::fun::SetPoint* sp)
91  {
92  adore_if_ros_msg::SetPoint msg;
93  msg.maneuverId = sp->maneuverID;
94  msg.tStart = sp->tStart;
95  msg.tEnd = sp->tEnd;
96  msg.X = sp->x0ref.getX();
97  msg.Y = sp->x0ref.getY();
98  msg.PSI = sp->x0ref.getPSI();
99  msg.vx = sp->x0ref.getvx();
100  msg.vy = sp->x0ref.getvy();
101  msg.omega = sp->x0ref.getOmega();
102  msg.ax = sp->x0ref.getAx();
103  msg.delta = sp->x0ref.getDelta();
104  msg.dax = sp->x0ref.getDAx();
105  msg.ddelta = sp->x0ref.getDDelta();
106  return msg;
107  }
111  adore_if_ros_msg::SetPointRequest operator()(const adore::fun::SetPointRequest& spr)
112  {
113  adore_if_ros_msg::SetPointRequest msg;
114  msg.requestId = spr.setPointRequestID;
115  for(auto& it : spr.setPoints)
116  {
117  msg.setPoints.push_back((*this)(&it));
118  }
119  return msg;
120  }
121  };
122  }
123 }
Definition: setpointrequest.h:35
int setPointRequestID
Definition: setpointrequest.h:39
std::vector< SetPoint > setPoints
Definition: setpointrequest.h:38
Definition: setpoint.h:30
PlanarVehicleState10d x0ref
Definition: setpoint.h:32
double tStart
Definition: setpoint.h:34
int maneuverID
Definition: setpoint.h:36
double tEnd
Definition: setpoint.h:35
Definition: areaofeffectconverter.h:20
double getvx() const
Definition: planarvehiclestate10d.h:65
double getX() const
Definition: planarvehiclestate10d.h:62
void setDDelta(double value)
Definition: planarvehiclestate10d.h:82
double getDelta() const
Definition: planarvehiclestate10d.h:69
void setDAx(double value)
Definition: planarvehiclestate10d.h:81
double getPSI() const
Definition: planarvehiclestate10d.h:64
double getDDelta() const
Definition: planarvehiclestate10d.h:71
double getvy() const
Definition: planarvehiclestate10d.h:66
double getOmega() const
Definition: planarvehiclestate10d.h:67
void setvx(double value)
Definition: planarvehiclestate10d.h:76
void setY(double value)
Definition: planarvehiclestate10d.h:74
double getY() const
Definition: planarvehiclestate10d.h:63
void setOmega(double value)
Definition: planarvehiclestate10d.h:78
void setvy(double value)
Definition: planarvehiclestate10d.h:77
void setX(double value)
Definition: planarvehiclestate10d.h:73
double getAx() const
Definition: planarvehiclestate10d.h:68
void setDelta(double value)
Definition: planarvehiclestate10d.h:80
double getDAx() const
Definition: planarvehiclestate10d.h:70
void setPSI(double value)
Definition: planarvehiclestate10d.h:75
void setAx(double value)
Definition: planarvehiclestate10d.h:79
Definition: setpointrequestconverter.h:39
adore_if_ros_msg::SetPoint operator()(const adore::fun::SetPoint *sp)
Definition: setpointrequestconverter.h:90
void operator()(Tmsg msg, adore::fun::SetPointRequest *spr)
Definition: setpointrequestconverter.h:44
adore_if_ros_msg::SetPointRequest operator()(const adore::fun::SetPointRequest &spr)
Definition: setpointrequestconverter.h:111
void operator()(Tmsg msg, adore::fun::SetPoint *sp)
Definition: setpointrequestconverter.h:71