Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
MockLightBarDriver.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019-2021 LEIDOS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17
18
19#include <ros/ros.h>
20#include <ros/node_handle.h>
21#include <iostream>
22#include <ros/service_client.h>
23#include <ros/service_server.h>
24#include <cav_srvs/GetDriverApi.h>
25#include <cav_srvs/GetDriverApiRequest.h>
26#include <cav_srvs/GetDriverApiResponse.h>
27#include <cav_srvs/Bind.h>
28#include <cav_srvs/BindRequest.h>
29#include <cav_srvs/BindResponse.h>
30#include <cav_msgs/DriverStatus.h>
31#include <cav_srvs/GetDriverStatus.h>
32#include <cav_srvs/GetDriverStatusRequest.h>
33#include <cav_srvs/GetDriverStatusResponse.h>
34#include <cav_srvs/GetLights.h>
35#include <cav_srvs/GetLightsRequest.h>
36#include <cav_srvs/GetLightsResponse.h>
37#include <cav_srvs/SetLights.h>
38#include <cav_srvs/SetLightsRequest.h>
39#include <cav_srvs/SetLightsResponse.h>
40#include <cav_msgs/LightBarStatus.h>
41#include "carma_utils/CARMANodeHandle.h"
42using namespace std;
43
44namespace mock_drivers{
46
47
48
49 private:
50
51 cav_msgs::DriverStatus driverStatus;
52 //topics published
53 ros::Publisher lbPub;
55 ros::Publisher discoveryPub;
56
57 //service server
58 ros::ServiceServer getLightsService;
59 ros::ServiceServer setLightsService;
60 ros::ServiceServer getApiService;
61 ros::ServiceServer bindService;
62 ros::ServiceServer getDriverStatusService;
67
68 //lightbar states
77
78
79 //get driver status call back
80 bool getDriverStatus_cb(cav_srvs::GetDriverStatusRequest& req, cav_srvs::GetDriverStatusResponse& resp);
81
82 //bind call back
83 bool bind_cb(cav_srvs::BindRequest& req, cav_srvs::BindResponse& resp);
84
85
86 //get api service call back
87 bool getApiService_cb(cav_srvs::GetDriverApiRequest& req, cav_srvs::GetDriverApiResponse& resp);
88
89 //set light service call back
90 bool setLightService_cb(cav_srvs::SetLightsRequest& req, cav_srvs::SetLightsResponse& resp);
91
92 //get light service call back
93 bool getLightService_cb(cav_srvs::GetLightsRequest& req, cav_srvs::GetLightsResponse& resp);
94
99 cav_msgs::LightBarStatus getLightBarStatus();
100
101 cav_msgs::DriverStatus getDriverStatus();
102
103 vector<string> getDriverApi();
104
105 public:
106 MockLightBarDriver(ros::CARMANodeHandle node);
107
108 //publishes lightbar status
109 void publishData();
110
111 //publishes driver status
112 void publishDriverStatus();
113
114 //name of node
115 string getNodeName();
116
117 vector<string> getDriverTypesList();
118 };
119
120}
bool getApiService_cb(cav_srvs::GetDriverApiRequest &req, cav_srvs::GetDriverApiResponse &resp)
cav_msgs::LightBarStatus getLightBarStatus()
MockLightBarDriver(ros::CARMANodeHandle node)
bool setLightService_cb(cav_srvs::SetLightsRequest &req, cav_srvs::SetLightsResponse &resp)
cav_msgs::DriverStatus getDriverStatus()
bool getLightService_cb(cav_srvs::GetLightsRequest &req, cav_srvs::GetLightsResponse &resp)
bool getDriverStatus_cb(cav_srvs::GetDriverStatusRequest &req, cav_srvs::GetDriverStatusResponse &resp)
bool bind_cb(cav_srvs::BindRequest &req, cav_srvs::BindResponse &resp)