Modules
Automotive module
The automotive module is the main module of ms-van3t containing all the sample applications, ETSI C-ITS sub-modules, and additional auxiliary sub-modules, all listed below:
Facilities layer
Cooperative Awareness basic service (CABasicService)
-
class CABasicService : public Object, public SignalInfoUtils
This class implements the Cooperative Awareness Basic Service.
This class implements the Cooperative Awareness Basic Service (CA Basic Service) as defined in ETSI EN 302 637-2-1 V1.3.1 (2018-09). The CA Basic Service is a service that allows vehicles and RSUs to exchange information about their current status and position.
Public Functions
-
CABasicService()
Default constructor.
This constructor creates a CA Basic Service object with default values.
-
CABasicService(unsigned long fixed_stationid, long fixed_stationtype, VDP *vdp, bool real_time, bool is_vehicle)
Constructor.
This constructor creates a CA Basic Service object with the given station ID and station type.
- Parameters:
fixed_stationid – The station ID of the vehicle or RSU
fixed_stationtype – The station type of the vehicle or RSU
vdp – The VDP object to be used by the CA Basic Service
real_time – If true, the CA Basic Service will generate CAM messages using real time timestamps
is_vehicle – If true, the CA Basic Service will generate CAM messages as a vehicle, otherwise it will generate CAM messages as an RSUs
-
CABasicService(unsigned long fixed_stationid, long fixed_stationtype, VDP *vdp, bool real_time, bool is_vehicle, Ptr<Socket> socket_tx)
Constructor.
This constructor creates a CA Basic Service object with the given station ID, station type and socket.
- Parameters:
fixed_stationid – The station ID of the vehicle or RSU
fixed_stationtype – The station type of the vehicle or RSU
vdp – The VDP object to be used by the CA Basic Service
real_time – If true, the CA Basic Service will generate CAM messages using real time timestamps
is_vehicle – If true, the CA Basic Service will generate CAM messages as a vehicle, otherwise it will generate CAM messages as an RSUs
socket_tx – The socket used to send CAM messages
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the station properties.
This function sets the station ID and station type of the vehicle or RSU.
- Parameters:
fixed_stationid – The station ID of the vehicle or RSU
fixed_stationtype – The station type of the vehicle or RSU
-
void setFixedPositionRSU(double latitude_deg, double longitude_deg)
Set the fixed position of the RSU.
This function sets the fixed position of the RSU.
- Parameters:
latitude_deg –
longitude_deg –
-
void setStationID(unsigned long fixed_stationid)
Set the vehicle station ID.
- Parameters:
fixed_stationid –
-
void setStationType(long fixed_stationtype)
Set the station type.
- Parameters:
fixed_stationtype –
-
inline void setSocketTx(Ptr<Socket> socket_tx)
Set the socket used to send CAM messages.
This function passes the socket used to send CAM messages to the underlying BTP object.
- Parameters:
socket_tx – The socket used to send CAM messages
-
void setSocketRx(Ptr<Socket> socket_rx)
Set the socket used to receive CAM messages.
This function sets the socket used to receive CAM messages.
- Parameters:
socket_rx – The socket used to receive CAM messages
-
inline void setVDP(VDP *vdp)
Set the VDP object.
This function sets the VDP object to be used by the CA Basic Service.
- Parameters:
vdp – The VDP object to be used by the CA Basic Service
-
inline void setLDM(Ptr<LDM> LDM)
Set the LDM object.
This function sets the LDM object to be used by the CA Basic Service.
- Parameters:
LDM – The LDM object to be used by the CA Basic Service
-
inline void setBTP(Ptr<btp> btp)
Set the BTP object.
This function sets the BTP object to be used by the CA Basic Service.
- Parameters:
btp – The BTP object to be used by the CA Basic Service
-
void receiveCam(BTPDataIndication_t dataIndication, Address from)
Callback function for processing received CAM messages.
This function is called by the BTP object when a CAM message is received. It decodes the received CAM message and calls the callback application function set by the user.
- Parameters:
dataIndication – The received CAM message
from – The address of the sender
-
inline void addCARxCallback(std::function<void(asn1cpp::Seq<CAM>, Address)> rx_callback)
Set the callback function for processing received CAM messages.
This function sets the callback function to be called when a CAM message is received.
- Parameters:
rx_callback – The callback function to be called when a CAM message is received
-
void startCamDissemination()
Start the CAM dissemination.
This function starts the CAM dissemination process.
-
void startCamDissemination(double desync_s)
Start the CAM dissemination with a desynchronization interval.
This function starts the CAM dissemination process with a desynchronization interval to avoid CAM synchronization.
- Parameters:
desync_s – The desynchronization interval in seconds
-
inline void setCheckCamGenMs(long nextCAM)
Set the future time to check CAM condition.
- Parameters:
nextCAM – The next time to check CAM condition
-
void toffUpdateAfterDeltaUpdate(double delta)
Used for DCC Adaptive approach to set the future time to check CAM condition after an update of delta value.
- Parameters:
delta – new delta value calculated through DCC adaptive approach
-
void toffUpdateAfterTransmission()
Used for DCC Adaptive approach to set the future time to check CAM condition after a transmission.
- Parameters:
delta – new delta value calculated through DCC adaptive approach
-
uint64_t terminateDissemination()
Stop the CAM dissemination.
This function stops the CAM dissemination process.
-
CABasicService()
Decentralized Environmental Notification basic service (DENBasicService)
-
class DENBasicService : public Object, public SignalInfoUtils
This class implements the Dencentralized Environmental Notification Basic Service.
This class implements the Dencentralized Environmental Notification Basic Service as defined in ETSI EN 302 637-3 V1.3.1 (2019-04). Decentralized Environmental Notification Message (DENM) is a facilities layer message that is mainly used by ITS applications in order to alert road users of a detected event using ITS communication technologies. DENM is used to describe a variety of events that can be detected by ITS stations (ITS-S).
Public Functions
-
DENBasicService()
Constructor.
This constructor creates a DENBasicService object with the default values.
-
DENBasicService(unsigned long fixed_stationid, long fixed_stationtype, Ptr<Socket> socket_tx)
Constructor.
This constructor creates a DENBasicService object with the specified values.
- Parameters:
fixed_stationid – The station ID of the DENM sender.
fixed_stationtype – The station type of the DENM sender.
socket_tx – The socket used to send the DENM messages.
-
inline void addDENRxCallback(std::function<void(denData, Address)> rx_callback)
Set the callback function for the reception of a DENM message.
This function sets the callback function that will be called when a DENM message is received.
- Parameters:
rx_callback – The callback function to be called when a DENM message is received.
-
DENBasicService_error_t appDENM_trigger(denData data, DEN_ActionID_t &actionid)
trigger a DENM message
This function triggers the transmission of a DENM message.
- Parameters:
data – The data to be included in the DENM message.
actionid – The action ID of the DENM message.
-
DENBasicService_error_t appDENM_update(denData data, const DEN_ActionID_t actionid)
update a DENM message
This function updates a DENM message.
- Parameters:
data – The data to be included in the DENM message.
actionid – The action ID of the DENM message.
-
DENBasicService_error_t appDENM_termination(denData data, const DEN_ActionID_t actionid)
termination of a DENM message
This function terminates a DENM message.
- Parameters:
data – The data to be included in the DENM message.
actionid – The action ID of the DENM message.
data – The data to be included in the DENM message.
actionid – The action ID of the DENM message.
-
void receiveDENM(BTPDataIndication_t dataIndication, Address address)
reception of a DENM message
This function is called when a DENM message is received by the BTP layer.
- Parameters:
dataIndication – The data indication of the received DENM message.
address – The address of the sender of the DENM message.
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the station properties.
- Parameters:
fixed_stationid – Station ID of the ITS-S
fixed_stationtype – Station type of the ITS-S
-
void setFixedPositionRSU(double latitude_deg, double longitude_deg)
Set the fixed position of the RSU (ITS-S)
- Parameters:
latitude_deg – Latitude of the ITS-S in degrees
longitude_deg – Longitude of the ITS-S in degrees
-
void setStationID(unsigned long fixed_stationid)
Set the station ID of the ITS-S.
- Parameters:
fixed_stationid –
-
void setStationType(long fixed_stationtype)
Set the station type of the ITS-S.
- Parameters:
fixed_stationtype –
-
inline void setVDP(VDP *vdp)
Set the VDP object.
- Parameters:
vdp –
-
void setSocketTx(Ptr<Socket> socket_tx)
Set the socket used to send the DENM messages.
- Parameters:
socket_tx –
-
void setSocketRx(Ptr<Socket> socket_rx)
Set the socket used to receive the DENM messages.
- Parameters:
socket_rx –
-
inline void setGeoArea(GeoArea_t geoArea)
Set the GeoArea for which the DENM messages are intended.
- Parameters:
geoArea –
-
inline void setRealTime(bool real_time)
Use real time for timestamps.
- Parameters:
real_time – If true, the timestamps will be based on the real time. If false, the timestamps will be based on the simulation time.
-
DENBasicService()
Infrastructure to Vehicle Information basic service (IVIBasicService)
-
class IVIBasicService : public SignalInfoUtils
This class implements the basic service for the Infrastructure to Vehicle Information (IVI) service defined in ETSI TS 103 301 V1.3.1 (2020-02).
IVI service is one instantiation of the infrastructure services to manage the generation, transmission and reception of the IVIM messages. An IVIM supports mandatory and advisory road signage such as contextual speeds and road works warnings. IVIM either provides information of physical road signs such as static or variable road signs, virtual signs or road works.
Public Functions
-
IVIBasicService()
Constructor.
This constructor initializes the IVIBasicService object.
-
IVIBasicService(unsigned long fixed_stationid, long fixed_stationtype, Ptr<Socket> socket_tx)
Constructor.
This constructor initializes the IVIBasicService object.
- Parameters:
fixed_stationid – The station ID of the ITS-S.
fixed_stationtype – The station type of the ITS-S.
socket_tx – The socket used for transmitting IVIM messages.
-
inline void addIVIRxCallback(std::function<void(iviData, Address)> rx_callback)
Set Reception callback for IVI messages.
- Parameters:
rx_callback –
-
IVIBasicService_error_t appIVIM_trigger(iviData Data)
Trigger an IVIM message.
- Parameters:
Data – The IVI data to be transmitted.
- Returns:
error code.
-
IVIBasicService_error_t appIVIM_repetition(iviData Data)
Repetition of an IVIM message.
- Parameters:
Data – The IVI data to be transmitted.
- Returns:
error code.
-
IVIBasicService_error_t appIVIM_update(iviData Data, ActionID_t actionID)
Update an IVIM message.
- Parameters:
Data – The IVI data to be transmitted.
actionID – The action ID of the IVIM message.
- Returns:
error code.
-
IVIBasicService_error_t appIVIM_termination(iviData Data, ivimTerminationType term, ActionID_t actionID)
Termination of an IVIM message.
- Parameters:
Data – The IVI data to stop being transmitted.
term – The termination type.
actionID – The action ID of the IVIM message.
- Returns:
error code.
-
void receiveIVIM(BTPDataIndication_t dataIndication, Address address)
Process a received IVIM message.
- Parameters:
dataIndication – The received data indication from BTP/GeoNet.
address – The address of the sender of the IVIM message.
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the station ID and station type of the ITS-S.
- Parameters:
fixed_stationid –
fixed_stationtype –
-
void setFixedPositionRSU(double latitude_deg, double longitude_deg)
Set the fixed position of the ITS-S.
- Parameters:
latitude_deg –
longitude_deg –
-
void setStationID(unsigned long fixed_stationid)
Set the station ID of the ITS-S.
- Parameters:
fixed_stationid –
-
void setStationType(long fixed_stationtype)
Set the station type of the ITS-S.
- Parameters:
fixed_stationtype –
-
IVIBasicService()
Collective Perception basic service (CPBasicService)
-
class CPBasicService : public Object, public SignalInfoUtils
This class implements the basic service for the Collective Perception Service.
This class implements the basic functionalities of the Collective Perception Service defined in ETSI TS 103 324 V2.1.1 (2023-06). Collective Perception Messages (CPMs) are transmitted by ITS-Ss in order to share information about perceived objects (non-connected vehicles in our framework). This enhances the environmental perception of CPS-enabled ITS-Ss by providing information about non-V2X-equipped road users and also increases the number of information sources for V2X-equipped road users.
Public Functions
-
CPBasicService()
Constructor.
This constructor initializes the CPBasicService object.
-
void setStationID(unsigned long fixed_stationid)
Set the station ID of the ITS-S.
- Parameters:
fixed_stationid – The station ID to be set.
-
void setStationType(long fixed_stationtype)
Set the station type of the ITS-S.
- Parameters:
fixed_stationtype – The station type to be set.
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the station properties of the ITS-S.
- Parameters:
fixed_stationid –
fixed_stationtype –
-
inline void setSocketTx(Ptr<Socket> socket_tx)
Set the socket to be used by BTP/GeoNet for transmitting CPMs.
- Parameters:
socket_tx – The socket to be set.
-
void setSocketRx(Ptr<Socket> socket_rx)
Set the socket to be used for receiving CPMs.
- Parameters:
socket_rx – The socket to be set.
-
inline void setLDM(Ptr<LDM> LDM)
Set the LDM object to be used by the CPBasicService.
- Parameters:
LDM – The LDM object to be set.
-
inline void setVDP(VDP *vdp)
Set the VDP object to be used by the CPBasicService.
- Parameters:
vdp – The VDP object to be set.
-
inline void setBTP(Ptr<btp> btp)
Set the BTP object to be used by the CPBasicService.
- Parameters:
btp – The BTP object to be set.
-
void receiveCpm(BTPDataIndication_t dataIndication, Address from)
Callback function used for the processing of received CPMs.
- Parameters:
dataIndication – The received data indication from BTP/GeoNet.
from – The address of the sender of the CPM.
-
inline void addCPRxCallback(std::function<void(asn1cpp::Seq<CollectivePerceptionMessage>, Address)> rx_callback)
Set the callback function to be used for the processing of received CPMs.
- Parameters:
rx_callback – The callback function to be set.
-
inline void setRealTime(bool real_time)
Specify if using the real time or simulation time for the CPM timestamps.
- Parameters:
real_time –
-
void startCpmDissemination()
Start the dissemination of CPMs.
-
uint64_t terminateDissemination()
Stop the dissemination of CPMs.
-
inline void setRedundancyMitigation(bool choice)
Specify if using redundancy mitigation defined for the CPM generation.
This method is used to specify the value of the ObjectInclusionConfig value defined in ETSI TS 103 324 V2.1.1 (2023-06) Section 6.1.2.3 True (default) –> The inclusion rules defined in ETSI TS 103 324 V2.1.1 (2023-06) are applied False –> The inclusion rules defined in ETSI TS 103 324 V2.1.1 (2023-06) are not applied
- Parameters:
choice –
-
void toffUpdateAfterDeltaUpdate(double delta)
Used for DCC Adaptive approach to set the future time to check CPM condition after an update of delta value.
- Parameters:
delta – new delta value calculated through DCC adaptive approach
-
void toffUpdateAfterTransmission()
Used for DCC Adaptive approach to set the future time to check CPM condition after a transmission.
- Parameters:
delta – new delta value calculated through DCC adaptive approach
-
CPBasicService()
Vehicle Data Provider (VDP)
-
class VDPTraCI : public ns3::VDP
This class is used to represent a VDP object that gathers information from TraCI.
Public Functions
-
VDPTraCI(Ptr<TraciClient> traci_client, std::string node_id)
Constructor.
This constructor initializes the VDPTraCI object.
- Parameters:
traci_client – The TraCI client object.
node_id – The node ID of the SUMO vehicle.
-
virtual CAM_mandatory_data_t getCAMMandatoryData()
This function returns the mandatory data of the CAM message.
This method returns the mandatory data of the CAM message in the units used for the ASN.1 encoding.
- Returns:
The mandatory data of the CAM message.
-
virtual CPM_mandatory_data_t getCPMMandatoryData()
This function returns the mandatory data of the CPM message.
This method returns the mandatory data of the CPM message in the units used for the ASN.1 encoding.
- Returns:
The mandatory data of the CPM message.
-
inline virtual double getSpeedValue()
This functio returns the vehicle’s speed.
- Returns:
-
inline virtual double getTravelledDistance()
This function returns the vehicle’s travelled distance.
- Returns:
-
inline virtual double getHeadingValue()
This function returns the vehicle’s heading.
- Returns:
-
virtual VDP_position_latlon_t getPosition()
This function returns the vehicle’s position in lat/lon coordinates.
- Returns:
-
virtual VDP_position_cartesian_t getPositionXY()
This function returns the vehicle’s position in cartesian coordinates.
- Returns:
-
virtual VDP_position_cartesian_t getXY(double lon, double lat)
This function converts the vehicle’s position in lat/lon coordinates to cartesian coordinates.
- Parameters:
lon – The vehicle’s longitude.
lat – The vehicle’s latitude.
- Returns:
-
virtual double getCartesianDist(double lon1, double lat1, double lon2, double lat2)
This function returns the distance between two points in lat/lon coordinates.
- Parameters:
lon1 –
lat1 –
lon2 –
lat2 –
- Returns:
-
virtual VDPDataItem<int> getLanePosition()
This function returns the vehicle’s lane position in the road.
- Returns:
lane id
-
virtual VDPDataItem<uint8_t> getExteriorLights()
This function returns the vehicle’s exterior lights state in the format used in CAM ASN.1 structure.
- Returns:
bit map of the exterior lights state
-
VDPTraCI(Ptr<TraciClient> traci_client, std::string node_id)
Local Dynamic Map (LDM)
-
class LDM : public Object
Public Functions
-
void clear()
This function clears the whole database (to be used only when the dabatase and its content is not going to be accessed again)
-
LDM_error_t insert(vehicleData_t newVehicleData)
This function inserts or updates a vehicle in the database.
This function inserts or updates a vehicle in the database The vehicle data should be passed inside a vehicleData_t structure and vehicles are univocally identified by their stationID This function returns LDMMAP_OK if a new vehicle has been inserted, LDMMAP_UPDATED is an existing vehicle entry has been updated, LDMMAP_MAP_FULL if the database if full and the insert operation failed (this should never happen, in any case)
- Parameters:
newVehicleData – the vehicle data to be inserted or updated
- Returns:
LDM_error_t the result of the operation
-
LDM_error_t remove(uint64_t stationID)
This function removes from the database the vehicle entry with station ID == stationID.
This function removes from the database the vehicle entry with station ID == stationID It returns LDMMAP_ITEM_NOT_FOUND if no vehicle with the given stationID was found for removal It returns LDMMAP_OK if the vehicle entry was succesfully removed
- Parameters:
stationID – the station ID of the vehicle to be removed
- Returns:
LDM_error_t the result of the operation
-
LDM_error_t lookup(uint64_t stationID, returnedVehicleData_t &retVehicleData)
This function returns the vehicle entry with station ID == stationID - the entry data is returned in retVehicleData.
This function returns the vehicle entry with station ID == stationID - the entry data is returned in retVehicleData This function returns LDMMAP_ITEM_NOT_FOUND if no vehicle with the given stationID was found for removal, while it returns LDMMAP_OK if the retVehicleData structure was properly filled with the requested vehicle data
- Parameters:
stationID – the station ID of the vehicle to be looked up
retVehicleData – the structure in which the vehicle data will be returned
- Returns:
LDM_error_t the result of the operation
-
LDM_error_t rangeSelect(double range_m, double lat, double lon, std::vector<returnedVehicleData_t> &selectedVehicles)
This function returns a vector of vehicles, including their Path History points, located within a certain radius.
This function returns a vector of vehicles, including their Path History points, located within a certain radius centered on a given latitude and longitude For the time being, this function should always return LDMMAP_OK (i.e. to understand if no vehicles are returned, you should check the size of the selectedVehicles vector)
- Parameters:
range_m – the radius in meters around the vehicle
lat – the latitude of the center of the search area
lon – the longitude of the center of the search area
selectedVehicles – the vector in which the selected vehicles will be returned
- Returns:
vector of vehicles, including their Path History points, located within the radius
-
LDM_error_t rangeSelect(double range_m, uint64_t stationID, std::vector<returnedVehicleData_t> &selectedVehicles)
This function returns a vector of vehicles, including their Path History points, located within a certain radius.
This function is the same as the other method with the same name, but it will return all the vehicles around another vehicle (which is also included in the returned vector), given it stationID This function may return LDMMAP_ITEM_NOT_FOUND if the specified stationID is not stored inside the database
- Parameters:
range_m – the radius in meters around the vehicle
stationID – the station ID of the vehicle around which the search is performed
selectedVehicles – the vector in which the selected vehicles will be returned
- Returns:
vector of vehicles, including their Path History points, located within the radius
-
LDM_error_t updateCPMincluded(uint64_t stationID, uint64_t timestamp)
This function updates the timestamp indicating the last time the given object has been included in a CPM.
This function updates the timestamp indicating the last time the given object has been included in a CPM The timestamp is updated to the current simulation time This function returns LDMMAP_ITEM_NOT_FOUND if the specified stationID is not stored inside the database
- Parameters:
stationID – the station ID of the vehicle for which the timestamp should be updated
timestamp – the timestamp to be set
-
bool getAllPOs(std::vector<returnedVehicleData_t> &selectedVehicles)
This function returns all Perceived Objects (POs) that are currently in the LDM, false if there are not POs in LDM.
- Parameters:
selectedVehicles –
- Returns:
-
bool getAllCVs(std::vector<returnedVehicleData_t> &selectedVehicles)
This function returns all Connected Vehicles (CVs) that are currently in the LDM, false if there are not CVs in LDM.
- Parameters:
selectedVehicles –
- Returns:
-
bool getAllIDs(std::set<int> &IDs)
This function returns all the IDs currently stored in the LDM.
This function returns all the IDs currently stored in the LDM
- Parameters:
IDs – the set in which the IDs will be returned
- Returns:
-
void deleteOlderThan()
This function deletes from the database all the entries older than time_milliseconds ms.
The entries are deleted if their age is > time_milliseconds ms if greater_equal == false, or >= time_milliseconds ms if greater_equal == true This function performs a full database read operation
-
void deleteOlderThanAndExecute(double time_milliseconds, void (*oper_fcn)(uint64_t, void*), void *additional_args)
This function is a combination of deleteOlderThan() and executeOnAllContents(), calling the open_fcn() callback for every deleted entry.
- Parameters:
time_milliseconds – the time in milliseconds, older than which the entries will be deleted
oper_fcn – the callback function to be called for each deleted entry
additional_args – the additional arguments to be passed to the callback
-
void writeAllContents()
This function can be used to write all the content of the database in a log file.
-
void executeOnAllContents(void (*oper_fcn)(vehicleData_t, void*), void *additional_args)
This function reads the whole database, and, for each entry, it executes the “oper_fcn” callback.
This callback should return void (i.e. nothing) and have two arguments:
a vehicleData_t structure, in which the data stored in each entry will be made available to the callback
a void * pointer, by means of which possible additional arguments can be passed to the callback The additional arguments to be passed to the callback, each time it is called, can be specified by setting void *additional_args to a value different than “nullptr” If additional_args == nullptr, also the second argument of each callback call will be nullptr
- Parameters:
oper_fcn – the callback function to be called for each entry
additional_args – the additional arguments to be passed to the callback
-
void updatePolygons()
This function updates all the Perceived Object polygon’s showing the current perception of them.
The function is called every 100 ms
-
struct returnedVehicleData_t
-
void clear()
Networking and Transport layers
Basic Transport Protocol (BTP)
-
class btp : public Object
This class implements the Basic Transport Protocol (BTP) as defined in ETSI EN 302 636-5-1 The btp class provides an interface for transmitting and receiving BTP messages, integrating with GeoNetworking protocols for vehicular communication.
Public Functions
-
btp()
Construct a new btp object.
Default constructor for the btp class.
-
inline void setGeoNet(Ptr<GeoNet> geoNet)
Sets the associated GeoNet pointer.
- Parameters:
geoNet – Pointer to GeoNet instance.
-
inline void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the station properties.
- Parameters:
fixed_stationid – The station ID of the ITS-S.
fixed_stationtype – The station type of the ITS-S.
-
inline void setFixedPositionRSU(double latitude_deg, double longitude_deg)
Set the fixed position of the RSU for GeoNet object.
- Parameters:
latitude_deg – The latitude of the RSU.
longitude_deg – The longitude of the RSU.
-
inline void setStationID(unsigned long fixed_stationid)
Set the station ID of the ITS-S for GeoNet object.
- Parameters:
fixed_stationid – The station ID of the ITS-S.
-
inline void setStationType(long fixed_stationtype)
Set the station type of the ITS-S for GeoNet object.
- Parameters:
fixed_stationtype – The station type of the ITS-S.
-
inline void setVDP(VDP *vdp)
Set the VDP object for GeoNet object.
- Parameters:
vdp – Pointer to VDP object.
-
inline void addCAMRxCallback(std::function<void(BTPDataIndication_t, Address)> rx_callback)
Add a callback for CAM message reception.
- Parameters:
rx_callback –
-
inline void addDENMRxCallback(std::function<void(BTPDataIndication_t, Address)> rx_callback)
Add a callback for DENM message reception.
- Parameters:
rx_callback –
-
inline void addIVIMRxCallback(std::function<void(BTPDataIndication_t, Address)> rx_callback)
Add a callback for IVIM message reception.
- Parameters:
rx_callback –
-
inline void addCPMRxCallback(std::function<void(BTPDataIndication_t, Address)> rx_callback)
Add a callback for CPM message reception.
- Parameters:
rx_callback –
-
inline void addVAMRxCallback(std::function<void(BTPDataIndication_t, Address)> rx_callback)
Add a callback for VAM message reception.
- Parameters:
rx_callback –
-
btp()
GeoNetworking (GeoNet)
-
class GeoNet : public Object
This class implements the GeoNetworking protocol as defined in ETSI EN 302 636-4-1.
Public Functions
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Set the Station properties.
- Parameters:
fixed_stationid –
fixed_stationtype –
-
void setFixedPositionRSU(double latitude_deg, double longitude_deg)
Set the fixed position of the RSU.
- Parameters:
latitude_deg –
longitude_deg –
-
void setStationID(unsigned long fixed_stationid)
Set the station ID of the ITS-S.
- Parameters:
fixed_stationid –
-
void setStationType(long fixed_stationtype)
Set the station type of the ITS-S.
- Parameters:
fixed_stationtype –
-
void setVDP(VDP *vdp)
Set the VDP object.
- Parameters:
vdp –
-
void setSocketTx(Ptr<Socket> socket_tx)
Set the socket to transmit packets.
- Parameters:
socket_tx –
-
inline void addRxCallback(std::function<void(GNDataIndication_t, Address)> rx_callback)
Set the callback function to receive packets.
- Parameters:
rx_callback –
-
GNDataConfirm_t sendGN(GNDataRequest_t dataRequest)
Create GeoNet PDU with the correct headers (GBC or TSB) and send it.
- Parameters:
dataRequest –
- Returns:
-
void receiveGN(Ptr<Socket> socket)
Receive a GeoNet PDU and send a data indication to BTP layer.
- Parameters:
socket –
-
inline void setMetricSupervisor(Ptr<MetricSupervisor> metric_supervisor_ptr)
Set the Metric supervisor object.
- Parameters:
MetricSupervisor_ptr –
-
inline void disablePRRsupervisorForBeacons()
Disable the PRR supervisor for beacons.
This method disables the PRR supervisor for beacons, ignoring them for PRR computations.
-
struct _egoPositionVector
Public Members
-
VDP::VDP_position_latlon_t POS_EPV
ETSI EN 302 636-4-1 [8.2.2].
-
VDP::VDP_position_latlon_t POS_EPV
-
struct _LocTableEntry
-
void setStationProperties(unsigned long fixed_stationid, long fixed_stationtype)
Measurements
Packet Reception Ratio supervisor (PRRsupervisor)
-
class PRRSupervisor : public Object, public Object
Utilities
SUMO sensor
-
class SUMOSensor : public Object
This class implements a sensor that detects vehicles in its vicinity for a given SUMO vehicle.
This class provides capabilities for detecting vehicles in the vicinity of a SUMO vehicle.
Public Functions
-
SUMOSensor()
Construct a new SUMOSensor object.
-
inline void setStationID(std::string id)
Set the station ID.
- Parameters:
id – The station ID.
-
inline void setTraCIclient(Ptr<TraciClient> client)
Set the TraCI client.
- Parameters:
client – The TraCI client.
-
inline void setVDP(VDP *vdp)
Set the VDP object.
- Parameters:
vdp – The VDP object.
-
inline void setSensorRange(double sensorRange)
Set the sensor perception range.
(Default = 50 meters)
- Parameters:
sensorRange – The sensor range.
-
SUMOSensor()
GPS-tc module
The gps-tc module provides classes and functions to leverage offline-collected GNSS traces. This module allows realistic positioning data rather than artificial traces created with SUMO.
Vehicle Visualizer module
Requirement: if you want to use this module, Node.js should be installed (on Ubuntu/Debian you can install it with sudo apt install nodejs).
ms-van3t also comes with a web-based vehicle visualizer, able to display the vehicles travelling
during the simulation on a map, rendered directly inside the user’s browser.
It can be particularly useful when working with GPS Traces (see the gps-tc module), which are not
coupled with a GUI (as opposed to SUMO).
If you want to fully exploit its potentiality, you need a Mapbox token, as the visualizer relies on Mapbox to draw the street, hybrid and satellite map layers.
Once you get it, the mapbox token shall be copied inside the file ``mapbox_token`` in ``src/vehicle-visualizer/js``
You can find more information on Mapbox here. They currently have quite good free tier options (allowing, at least in March 2021, up to 200000 free tile requests/month), which should be enough to use the ms-van3t vehicle visualizer without the need of paying anything. Please check them before signing up to Mapbox and getting a token to be used here. In general, we found out that a normal simulation, in which some sporadic zoom in/zoom out and three layer changes are performed, may require around 150/200 tile requests (we advise you to check often the tile request count on the Mapbox website, when you use your token).
In general, you should disable the vehicle visualizer when doing long batches of simulations.
If you do not own a Mapbox token (i.e. the mapbox_token file is empty), the visualizer will work in any case, with the following limitations:
You must make an occasional use of the visualizer (i.e. no heavy usage allowed, no derivative apps can be developed starting from the visualizer). Not making an occasional usage will conflict with the Tile Usage Policy of OpenStreetMap, which is not considered acceptable. So, you must disable the vehicle-visualizer when doing batches of simulations to gather some results. You are responsible for this!
Only one map layer (standard streets view from OpenStreetMap) will be available for use
In order to use the visualizer in your application, you need to add, in the main function (i.e. int main()),
the following code, which creates a new vehicleVisualizer object:
vehicleVisualizer vehicleVisObj;
Ptr<vehicleVisualizer> vehicleVis = &vehicleVisObj;
vehicleVis->startServer();
vehicleVis->connectToServer ();
Do not create a new vehicleVisualizer object with CreateObject or new, unless you plan to manually
call delete on it, as we rely on the object destructor in order to send a terminate message to the web visualizer
server and gracefully terminate it.
After creating a new vehicle visualizer object, you need to pass its pointer to the module which manages the vehicle’s mobility. If you are using SUMO and TraCI, you can call:
sumoClient->SetAttribute ("VehicleVisualizer", PointerValue (vehicleVis));
Where sumoClient is a pointer to TraCI client object (Ptr<TraciClient>) you previously created.
If you are using, instead, GPS-tc, you can call:
GPSTCHelper.setVehicleVisualizer(vehicleVis);
Where GPSTCHelper is a GPSTraceClientHelper object. In this case, setVehicleVisualizer()
must be called before createTraceClientsFromCSV(), otherwise the vehicle visualizer
reference will not be passed to the GPS Trace Client objects managing the mobility of the
vehicles and no moving vehicles will appear on the map.
The vehicles displayed by the visualizer can also be inserted and updated from user applications (e.g. in an emulator application, you can use the CAMs received from the external world to add real vehicles to the map, together with the simulated ones).
In order to add and update a moving object from an application, the latter should have, first of all,
a reference to the visualizer object (i.e. Ptr<vehicleVisualizer>). Then, it will be able to use
<name of pointer to the vehicleVisualizer>->sendObjectUpdate() to add and update any object in the map.
In this case it is important to specify, as first argument of the sendObjectUpdate() function, an object ID which must be different from the IDs of the simulated
vehicles.
You can also refer to the examples inside src/automotive/examples, which all (but the V2X emulator) include the possibility
of using the web-based vehicle visualizer via the --vehicle-visualizer=true option.
The visualizer, once a simulation has been started, can be opened inside any browser, as long as the simulation is running, at localhost:8080 (if a different HTTP port is not specified with the setHTTPPort() method of the vehicleVisualizer object).