ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
funfactory.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2023 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/fun/afactory.h>
18 #include <adore_if_ros_msg/NavigationGoal.h>
19 #include <adore_if_ros_msg/SetPointRequest.h>
20 #include <adore_if_ros_msg/TerminalRequest.h>
21 #include <adore_if_ros_msg/WheelSpeed.h>
22 #include <tf/tf.h>
23 #include <tf/LinearMath/Quaternion.h>
24 #include <std_msgs/Float64.h>
25 #include <std_msgs/Float32.h>
26 #include <std_msgs/Int8.h>
27 #include <std_msgs/Bool.h>
28 #include <nav_msgs/Odometry.h>
42 namespace adore
43 {
44  namespace if_ROS
45  {
50  {
51  private:
52  ros::NodeHandle* n_;
53 
54  public:
55  FUN_Factory(ros::NodeHandle *n) : n_(n)
56  {
57  }
58 
59  public: //overloading virtual AFactory methods:
60  //get updates on the navigation goal
62  {
64  adore_if_ros_msg::NavigationGoalConstPtr,
65  NavigationGoalConverter>(n_, "ENV/NavigationGoal", 1);
66  }
67  //get updates on the setpoint request
69  {
71  adore_if_ros_msg::SetPointRequestConstPtr,
72  SetPointRequestConverter>(n_, "FUN/SetPointRequest", 1);
73  }
74  //write updates on the setpoint request
76  {
78  adore_if_ros_msg::SetPointRequest,
79  SetPointRequestConverter>(n_, "FUN/SetPointRequest", 1);
80  }
83  {
85  adore_if_ros_msg::SetPointRequestConstPtr,
86  SetPointRequestConverter>(n_, "FUN/NominalTrajectory", 1);
87  }
90  {
92  adore_if_ros_msg::SetPointRequest,
93  SetPointRequestConverter>(n_, "FUN/NominalTrajectory", 1);
94  }
96  virtual TSetPointRequestReader* getOdomSetPointRequestReader()override
97  {
99  adore_if_ros_msg::SetPointRequestConstPtr,
100  SetPointRequestConverter>(n_, "FUN/SetPointRequest_odom", 1);
101  }
103  virtual TSetPointRequestWriter* getOdomSetPointRequestWriter()override
104  {
106  adore_if_ros_msg::SetPointRequest,
107  SetPointRequestConverter>(n_, "FUN/SetPointRequest_odom", 1);
108  }
109  //get updates on the terminal request
111  {
113  adore_if_ros_msg::TerminalRequestConstPtr,
114  TerminalRequestConverter>(n_, "FUN/TerminalRequest", 1);
115  }
116  //write updates on the terminal request
118  {
120  adore_if_ros_msg::TerminalRequest,
121  TerminalRequestConverter>(n_, "FUN/TerminalRequest", 1);
122  }
123  //write a motion command
125  {
126  return new MotionCommandWriter(n_,
127  "FUN/MotionCommand/acceleration",
128  "FUN/MotionCommand/steeringAngle", 1);
129  }
130  //read a motion command
132  {
133  return new MotionCommandReader(n_,
134  "FUN/MotionCommand/acceleration",
135  "FUN/MotionCommand/steeringAngle", 1);
136  }
137 
138  //write a gear selection command
140  {
142  std_msgs::Int8,
143  GearSelectionCommandConverter>(n_, "FUN/GearSelectionCommand", 1);
144  }
145  //read a gear selection command
147  {
149  std_msgs::Int8ConstPtr,
150  GearSelectionCommandConverter>(n_, "FUN/GearSelectionCommand", 1);
151  }
152  //write an indicator command
154  {
155  return new IndicatorCommandWriter(n_, "FUN/IndicatorCommand/left", "FUN/IndicatorCommand/right", 1);
156  }
157  //read an indicator command
159  {
160  return new IndicatorCommandReader(n_, "FUN/IndicatorCommand/left", "FUN/IndicatorCommand/right", 1);
161  }
162  //get updates on the vehicle motion state
164  {
165  return new MotionStateReader(n_, "localization", "VEH/ax", "VEH/steering_angle_measured", 1);
166  }
169  {
170  return new MotionStateReader(n_, "odom", "VEH/ax", "VEH/steering_angle_measured", 1);
171  }
174  {
175  return new MotionStateFeed(n_, "odom", "VEH/ax", "VEH/steering_angle_measured", 1);
176  }
178  virtual TMotionStateFeed* getVehicleLocalizationMotionStateFeed() override
179  {
180  return new MotionStateFeed(n_, "localization", "VEH/ax", "VEH/steering_angle_measured", 1);
181  }
182 
183  //get updates on the vehicle extended state (buttons, etc.)
185  {
186  return new VehicleExtendedStateReader(n_,
187  "VEH/gear_state",
188  "VEH/AutomaticControlState/acceleration",
189  "VEH/AutomaticControlState/accelerationActive",
190  "VEH/AutomaticControlState/steering",
191  "VEH/IndicatorState/left",
192  "VEH/IndicatorState/right",
193  "VEH/Checkpoints/clearance",
194  1);
195  }
196  //get updates on the vehicle extended state (buttons, etc.)
198  {
199  return new VehicleExtendedStateWriter(n_,
200  "VEH/gear_state",
201  "VEH/AutomaticControlState/acceleration",
202  "VEH/AutomaticControlState/accelerationActive",
203  "VEH/AutomaticControlState/steering",
204  "VEH/IndicatorState/left",
205  "VEH/IndicatorState/right",
206  "VEH/Checkpoints/clearance",
207  1);
208  }
211  {
212  return new VehicleBaseMeasurementWriter(n_,
213  "VEH/steering_angle_measured",
214  "VEH/wheel_speed",
215  "VEH/yaw_rate",
216  "VEH/ax",
217  "VEH/ay", 1);
218  }
221  {
223  adore_if_ros_msg::PlanningResult,
224  PlanningResultConverter>(n_, "FUN/PlanningResult", 10 );
225  }
228  {
230  adore_if_ros_msg::PlanningResult,
231  PlanningResultConverter>(n_, "FUN/PlanningSelect", 10 );
232  }
235  {
236  return new Feed<adore::fun::PlanningResult,
237  adore_if_ros_msg::PlanningResultConstPtr,
238  PlanningResultConverter>(n_, "FUN/PlanningResult", 100);
239  }
242  {
243  return new Feed<adore::fun::PlanningResult,
244  adore_if_ros_msg::PlanningResultConstPtr,
245  PlanningResultConverter>(n_, "FUN/PlanningSelect", 100);
246  }
248  {
250  adore_if_ros_msg::PlanningRequest,
251  PlanningRequestConverter>(n_, "FUN/PlanningRequest", 1 );
252  }
254  {
256  adore_if_ros_msg::PlanningRequest,
257  PlanningRequestConverter>(n_,"FUN/PlanningRequest", 1);
258  }
261  {
262  return new MissionDataWriter(n_, "FUN/mission_data/mission_state", 1);
263 
264  }
267  {
268  return new MissionDataReader(n_, "FUN/mission_data/mission_state", 1);
269  }
270  //get updates on the platooning state
272  {
274  adore_if_ros_msg::CooperativePlanningConstPtr,
275  PlatooningInformationConverter>(n_, "FUN/PlatooningInformation", 1);
276  }
277  //write updates on the platooning state
279  {
281  adore_if_ros_msg::CooperativePlanning,
282  PlatooningInformationConverter>(n_, "FUN/PlatooningInformation", 1);
283  }
284  //TODO: instead of seperate packages this should be compounded in a user input message
285  //read lanechange suppression msgs
287  {
288  return new Reader<bool,
289  std_msgs::BoolPtr,
290  StdConverter>(n_, "FUN/LangeChangeSuppresion", 1);
291  }
292  //read force lanechange left msgs
294  {
295  return new Reader<bool,
296  std_msgs::BoolPtr,
297  StdConverter>(n_, "FUN/ForceLanechange/left", 1);
298  }
299  //read force lanechange right msgs
301  {
302  return new Reader<bool,
303  std_msgs::BoolPtr,
304  StdConverter>(n_, "FUN/ForceLanechange/right", 1);
305  }
306  //read force slow maneuvers msgs
308  {
309  return new Reader<bool,
310  std_msgs::BoolPtr,
311  StdConverter>(n_, "FUN/ForceSlowManeuvers", 1);
312  }
313  };
314  } // namespace if_ROS
315 } // namespace adore
abstract factory for adore::env communication
Definition: afactory.h:41
Definition: platooningInformation.h:28
Definition: setpointrequest.h:35
Definition: terminalrequest.h:27
Definition: funfactory.h:50
virtual adore::mad::AWriter< adore::fun::PlanningRequest > * getPlanningRequestWriter() override
Definition: funfactory.h:247
virtual adore::mad::AReader< adore::fun::GearSelectionCommand > * getGearSelectionCommandReader() override
Definition: funfactory.h:146
virtual adore::mad::AReader< bool > * getForceSlowManeuversReader() override
Definition: funfactory.h:307
virtual adore::mad::AWriter< adore::fun::SetPointRequest > * getNominalTrajectoryWriter() override
write updates on the nominal trajectory
Definition: funfactory.h:89
virtual TSetPointRequestWriter * getOdomSetPointRequestWriter() override
write updates on the odom setpoint request: this is used by planner, if controller is operating in od...
Definition: funfactory.h:103
virtual adore::mad::AWriter< adore::fun::SetPointRequest > * getSetPointRequestWriter() override
Definition: funfactory.h:75
virtual adore::mad::AWriter< adore::fun::PlanningResult > * getPlanningResultWriter() override
writes PlanningResult as general information about decision making and planning performance
Definition: funfactory.h:220
virtual TMotionStateFeed * getVehicleLocalizationMotionStateFeed() override
get updates on the vehicle motion state: best estimate from localization module
Definition: funfactory.h:178
virtual adore::mad::AReader< bool > * getLanechangeSuppressionReader() override
Definition: funfactory.h:286
ros::NodeHandle * n_
Definition: funfactory.h:52
virtual adore::mad::AFeed< adore::fun::PlanningResult > * getPlanningSelectFeed() override
reads selected PlanningResult as general information about decision-making
Definition: funfactory.h:241
virtual adore::mad::AFeedWithCallback< adore::fun::PlanningRequest > * getPlanningRequestTrigger() override
Definition: funfactory.h:253
virtual adore::mad::AReader< adore::fun::MotionCommand > * getMotionCommandReader() override
Definition: funfactory.h:131
virtual adore::mad::AReader< bool > * getForceLanechangeLeftReader() override
Definition: funfactory.h:293
FUN_Factory(ros::NodeHandle *n)
Definition: funfactory.h:55
virtual adore::fun::AFactory::TMotionStateReader * getVehicleOdometryMotionStateReader() override
get updates on the vehicle motion state: best estimate from odometry module
Definition: funfactory.h:168
virtual TSetPointRequestReader * getOdomSetPointRequestReader() override
get updates on the odom setpoint request: this is used by tracking controller, if controller is opera...
Definition: funfactory.h:96
virtual adore::mad::AWriter< adore::fun::PlatooningInformation > * getPlatooningStateWriter() override
Definition: funfactory.h:278
virtual adore::mad::AWriter< adore::fun::TerminalRequest > * getTerminalRequestWriter() override
Definition: funfactory.h:117
virtual adore::mad::AReader< adore::fun::TerminalRequest > * getTerminalRequestReader() override
Definition: funfactory.h:110
virtual adore::mad::AWriter< adore::fun::GearSelectionCommand > * getGearSelectionCommandWriter() override
Definition: funfactory.h:139
virtual adore::mad::AReader< adore::fun::MissionData > * getMissionDataReader() override
read mission data
Definition: funfactory.h:266
virtual adore::mad::AReader< adore::fun::PlatooningInformation > * getPlatooningStateReader() override
Definition: funfactory.h:271
virtual adore::fun::AFactory::TMotionStateFeed * getVehicleOdometryMotionStateFeed() override
get updates on the vehicle motion state: best estimate from odometry module
Definition: funfactory.h:173
virtual adore::mad::AReader< adore::fun::SetPointRequest > * getSetPointRequestReader() override
Definition: funfactory.h:68
virtual adore::mad::AFeed< adore::fun::PlanningResult > * getPlanningResultFeed() override
reads PlanningResult as general information about decision making and planning performance
Definition: funfactory.h:234
virtual adore::mad::AWriter< adore::fun::MissionData > * getMissionDataWriter() override
write mission data
Definition: funfactory.h:260
virtual adore::mad::AWriter< adore::fun::VehicleBaseMeasurement > * getVehicleBaseMeasurementWriter() override
writes measurements of base vehicle system into automation system
Definition: funfactory.h:210
virtual adore::mad::AReader< adore::fun::SetPointRequest > * getNominalTrajectoryReader() override
get updates on the nominal trajectory
Definition: funfactory.h:82
virtual adore::mad::AReader< adore::fun::VehicleExtendedState > * getVehicleExtendedStateReader() override
Definition: funfactory.h:184
virtual adore::mad::AReader< bool > * getForceLanechangeRightReader() override
Definition: funfactory.h:300
virtual adore::mad::AWriter< adore::fun::IndicatorCommand > * getIndicatorCommandWriter() override
Definition: funfactory.h:153
virtual adore::mad::AWriter< adore::fun::VehicleExtendedState > * getVehicleExtendedStateWriter() override
Definition: funfactory.h:197
virtual adore::mad::AReader< adore::fun::NavigationGoal > * getNavigationGoalReader() override
Definition: funfactory.h:61
virtual adore::mad::AWriter< adore::fun::PlanningResult > * getPlanningSelectWriter() override
writes PlanningResult for maneuver selected for execution
Definition: funfactory.h:227
virtual adore::mad::AWriter< adore::fun::MotionCommand > * getMotionCommandWriter() override
Definition: funfactory.h:124
virtual adore::mad::AReader< adore::fun::IndicatorCommand > * getIndicatorCommandReader() override
Definition: funfactory.h:158
virtual adore::fun::AFactory::TMotionStateReader * getVehicleMotionStateReader() override
Definition: funfactory.h:163
Definition: ros_com_patterns.h:67
Definition: ros_com_patterns.h:32
Definition: indicatorcommandconverter.h:72
Definition: indicatorcommandconverter.h:41
Definition: missiondataconverter.h:31
Definition: missiondataconverter.h:77
Definition: motioncommandconverter.h:70
Definition: motioncommandconverter.h:40
Definition: funvehiclemotionstateconverter.h:139
Definition: funvehiclemotionstateconverter.h:47
Definition: ros_com_patterns.h:113
Definition: vehiclebasemeasurementwriter.h:50
Definition: funvehiclemotionstateconverter.h:235
Definition: funvehiclemotionstateconverter.h:347
Definition: ros_com_patterns.h:153
Definition: com_patterns.h:29
Definition: areaofeffectconverter.h:20
Definition: gearselectioncommand.h:26
Definition: navigationgoal.h:26
Definition: planning_request.h:22
Definition: planning_result.h:29
Definition: gearselectioncommandconverter.h:39
Definition: navigationgoalconverter.h:39
Definition: planningrequestconverter.h:26
Definition: planningresultconverter.h:28
Definition: platooninginformationconverter.h:28
Definition: setpointrequestconverter.h:39
Definition: stdconverter.h:39
Definition: terminalrequestconverter.h:39