Closed MartinaBarbiFivecomm closed 4 months ago
CAM reception signals are emitted by the CaService
, i.e. if your non-police cars are not equipped with this service, your implementation will not get triggered.
However, you may receive CAMs in your custom ClearLaneService
if it is assigned the same port (2001) as the CaService
run by police cars. You will need to handle message reception on your own, though, i.e. by ClearLaneService::indicate
.
Ok Thanks.
And how can I define for example inside the CaService.cc that the police car is an emergency vehicle through the field EmergencyContainer_t ?
I suggest adding a NED parameter to the CaService
such as isEmergencyVehicle
or similar. If this parameter is set, your customized CaService
fills the EmergencyContainer_t
when preparing the CAM. You can configure NED parameters in the omnetpp.ini
then. Alternatively, you can modify the CaService
by checking the SUMO vehicle name. The vehicle name is accessible through the VehicleController
, see getFacilities()
how to access this object.
In the CaService.cc there is no bool like isEmergencyVehicle neither the definition of specialVehcileContainer, so where is this field supposed to be filled if it is not retrieved in the service?
also trying retrieving it using like the other methods:
SpecialVehicleContainer_t& svc = cam.camParameters.specialVehicleContainer; // ADDED SpecialVehicleContainer& svc = svc.choice.emergencyContainer;
it gives me errors. And How am I supposed to fill it?
This parameter and the container are not implemented. The suggestion only hinted at how the emergency container could be implemented and enabled via a parameter (or based on the vehicle type).
I did manage to put some of the fields of SpecialVehicleContainer in the function createCooperativeAwarenessMessage as: if (header.stationID == 226) { cam.camParameters.specialVehicleContainer->present == SpecialVehicleContainer_PR_emergencyContainer; EmergencyContainer_t& ec = cam.camParameters.specialVehicleContainer->choice.emergencyContainer; ec.incidentIndication->causeCode = 95; } It does not give me building errors but when running the scenario it just crashes. If I remove this code it works. Do I have to add this container somewhere else besides in this function?
I suspect you forgot to allocate the SpecialVehicleContainer. Take a look at the LowFrequencyContainer implementation in the CaService. A good rule of thumb is to use vanetza::asn1::allocate()
whenever a parameter is marked as optional.
I have added the container as per the LowFrequency one :
void addSpecialVehicleContainer(vanetza::asn1::Cam& message, const VehicleDataProvider& vdp)
{
if (vdp.station_id() == 226)
{
SpecialVehicleContainer& svc = message->cam.camParameters.specialVehicleContainer;
svc = vanetza::asn1::allocate
}
As soon as it gets triggered the sim crashes. I don't actually know what I am doing wrong. Is there any other place where I have to declare this special container?
Unfortunately, "sim crashes" is a rather fuzzy problem description. I suggest running Artery with a debugger attached. Every run_X target has an accompanying debug_X target if CMAKE_BUILD_TYPE
is set to Debug. Then, the debugger usually stops at the point where the simulation crash occurs. That should help you with analyzing the problematic code section.
Hi,
I would like to replicate the same behaviour of the police scenario, but using CAMs. So I equipped the police car with the CaService but then in the service ClearLaneService running on the other cars, which have to receive the message and slow down I cannot make it to work.
I have added this function reveiveSignal
also I have subscribed to the receivedCam signal.
but it does not do anything.
Do I have to define in this service the same method as in indicate() in CaService?
How do I access the CAM content?
Many thanks,
Martina