1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file CC_Const.h 11 /// @author Michele Segata 12 /// @date Fri, 11 Apr 2014 13 /// @version $Id$ 14 /// 15 // File defining constants, structs, and enums for cruise controllers 16 /****************************************************************************/ 17 #ifndef CC_CONST_H 18 #define CC_CONST_H 19 20 #include <string> 21 #include <sstream> 22 23 namespace Plexe { 24 25 /** 26 * @brief action that might be requested by the platooning management 27 */ 28 enum PLATOONING_LANE_CHANGE_ACTION { 29 DRIVER_CHOICE = 0, //the platooning management is not active, so just let the driver choose the lane 30 STAY_IN_CURRENT_LANE = 3, //the car is part of a platoon, so it has to stay on the dedicated platooning lane 31 MOVE_TO_FIXED_LANE = 4 //move the car to a specific lane 32 }; 33 34 /** 35 * @brief TraCI modes for lane changing 36 */ 37 #define FIX_LC 0b1000000000 38 #define DEFAULT_NOTRACI_LC 0b1010101010 39 40 /** @enum ACTIVE_CONTROLLER 41 * @brief Determines the currently active controller, i.e., ACC, CACC, or the 42 * driver. In future we might need to switch off the automatic controller and 43 * leave the control to the mobility model which reproduces a human driver 44 */ 45 enum ACTIVE_CONTROLLER 46 {DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6}; 47 48 /** 49 * @brief struct used as header for generic data passing to this model through 50 * traci 51 */ 52 struct CCDataHeader { 53 int type; //type of message. indicates what comes after the header 54 int size; //size of message. indicates how many bytes comes after the header 55 }; 56 57 /** 58 * Struct defining data passed about a vehicle 59 */ 60 struct VEHICLE_DATA { 61 int index; //position in the platoon (0 = first) 62 double speed; //vehicle speed 63 double acceleration; //vehicle acceleration 64 double positionX; //position of the vehicle in the simulation 65 double positionY; //position of the vehicle in the simulation 66 double time; //time at which such information was read from vehicle's sensors 67 double length; //vehicle length 68 double u; //controller acceleration 69 double speedX; //vehicle speed on the X axis 70 double speedY; //vehicle speed on the Y axis 71 double angle; //vehicle angle in radians 72 }; 73 74 #define MAX_N_CARS 8 75 76 #define CC_ENGINE_MODEL_FOLM 0x00 //first order lag model 77 #define CC_ENGINE_MODEL_REALISTIC 0x01 //the detailed and realistic engine model 78 79 //parameter names for engine models 80 #define FOLM_PAR_TAU "tau_s" 81 #define FOLM_PAR_DT "dt_s" 82 83 #define ENGINE_PAR_VEHICLE "vehicle" 84 #define ENGINE_PAR_XMLFILE "xmlFile" 85 #define ENGINE_PAR_DT "dt_s" 86 87 #define CC_PAR_VEHICLE_DATA "ccvd" //data about a vehicle, like position, speed, acceleration, etc 88 #define CC_PAR_VEHICLE_POSITION "ccvp" //position of the vehicle in the platoon (0 based) 89 #define CC_PAR_PLATOON_SIZE "ccps" //number of cars in the platoon 90 91 //set of controller-related constants 92 #define CC_PAR_CACC_XI "ccxi" //xi 93 #define CC_PAR_CACC_OMEGA_N "ccon" //omega_n 94 #define CC_PAR_CACC_C1 "ccc1" //C1 95 #define CC_PAR_ENGINE_TAU "cctau" //engine time constant 96 97 #define CC_PAR_UMIN "ccumin" //lower saturation for u 98 #define CC_PAR_UMAX "ccumax" //upper saturation for u 99 100 #define CC_PAR_PLOEG_H "ccph" //time headway of ploeg's CACC 101 #define CC_PAR_PLOEG_KP "ccpkp" //kp parameter of ploeg's CACC 102 #define CC_PAR_PLOEG_KD "ccpkd" //kd parameter of ploeg's CACC 103 104 #define CC_PAR_FLATBED_KA "ccfka" //ka parameter of flatbed CACC 105 #define CC_PAR_FLATBED_KV "ccfkv" //kv parameter of flatbed CACC 106 #define CC_PAR_FLATBED_KP "ccfkp" //kp parameter of flatbed CACC 107 #define CC_PAR_FLATBED_H "ccfh" //h parameter of flatbed CACC 108 #define CC_PAR_FLATBED_D "ccfd" //distance parameter of flatbed CACC 109 110 #define CC_PAR_VEHICLE_ENGINE_MODEL "ccem" //set the engine model for a vehicle 111 112 #define CC_PAR_VEHICLE_MODEL "ccvm" //set the vehicle model, i.e., engine characteristics 113 #define CC_PAR_VEHICLES_FILE "ccvf" //set the location of the vehicle parameters file 114 115 // set CACC constant spacing 116 #define PAR_CACC_SPACING "ccsp" 117 118 // get ACC computed acceleration when faked CACC controller is enabled 119 #define PAR_ACC_ACCELERATION "ccacc" 120 121 // determine whether a vehicle has crashed or not 122 #define PAR_CRASHED "cccr" 123 124 // set a fixed acceleration to a vehicle controlled by CC/ACC/CACC 125 #define PAR_FIXED_ACCELERATION "ccfa" 126 127 // get vehicle speed and acceleration, needed for example by the platoon leader (get: vehicle) 128 #define PAR_SPEED_AND_ACCELERATION "ccsa" 129 130 // set speed and acceleration of the platoon leader 131 #define PAR_LEADER_SPEED_AND_ACCELERATION "cclsa" 132 133 // set whether CACCs should use real or controller acceleration 134 #define PAR_USE_CONTROLLER_ACCELERATION "ccca" 135 136 // get lane count for the street the vehicle is currently traveling 137 #define PAR_LANES_COUNT "cclc" 138 139 // set the cruise control desired speed 140 #define PAR_CC_DESIRED_SPEED "ccds" 141 142 // set the currently active vehicle controller which can be either the driver, or the ACC or the CACC 143 #define PAR_ACTIVE_CONTROLLER "ccac" 144 145 // get radar data from the car 146 #define PAR_RADAR_DATA "ccrd" 147 148 // communicate with the cruise control to give him fake indications. this can be useful when you want 149 // to advance a vehicle to a certain position, for example, for joining a platoon. clearly the ACC 150 // must always take into consideration both fake and real data 151 #define PAR_LEADER_FAKE_DATA "cclfd" 152 #define PAR_FRONT_FAKE_DATA "ccffd" 153 154 // get the distance that a car has to travel until it reaches the end of its route 155 #define PAR_DISTANCE_TO_END "ccdte" 156 157 // get the distance from the beginning of the route 158 #define PAR_DISTANCE_FROM_BEGIN "ccdfb" 159 160 // set speed and acceleration of preceding vehicle 161 #define PAR_PRECEDING_SPEED_AND_ACCELERATION "ccpsa" 162 163 // set ACC headway time 164 #define PAR_ACC_HEADWAY_TIME "ccaht" 165 166 // return engine information (for the realistic engine model) 167 #define PAR_ENGINE_DATA "cced" 168 169 // enabling/disabling auto feeding 170 #define PAR_USE_AUTO_FEEDING "ccaf" 171 172 // enabling/disabling data prediction 173 #define PAR_USE_PREDICTION "ccup" 174 175 // add/remove members from own platoon 176 #define PAR_ADD_MEMBER "ccam" 177 #define PAR_REMOVE_MEMBER "ccrm" 178 179 // let the leader automatically change lane for the whole platoon if there is a speed advantage 180 #define PAR_ENABLE_AUTO_LANE_CHANGE "ccalc" 181 182 } 183 184 #endif /* CC_CONST_H */ 185