riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 131 forks source link

Some questions about CPM! #228

Closed yangjavaios closed 1 year ago

yangjavaios commented 2 years ago

Hi,Riebl,I have some questions ,please help me! I am studying your Artery and doing extended research, but I have encountered some problems. I am using CPM for message transmission in a V2X scene. This is how I did it:

if (msg->isSelfMessage()) { if (!strcmp(msg->getName(), "selfSender")) {//for(auto n=0;n>1;n++){ const auto& objects = mlocalEnvmod->allObjects(); if(objects.size() > 0){ destAddress_ = inet::L3AddressResolver().resolve(par("destAddress")); sendVoIPPacket(); }scheduleAt(simTime() + samplingtime, selfSender); } else initTraffic(); }

The package generated by the perceived CPM information is used to determine the size of the package. If the size of the package is greater than 0, it proves that our CPM package contains vehicle information. Of course, this excludes the self-information of the vehicle itself, but how do I perceive the vehicle Woolen cloth? In other words, how to obtain the number of perceived objects for statistics. In the follow-up, I hope to use the evaluation index EAR and the environmental perception ratio to measure this process. Then how do I count the total number of objects obtained and the number of objects perceived? This is my current concern. I hope you can provide me with some help!

riebl commented 2 years ago

I am lost in translation: What do you mean by perceiving the vehicle woolen cloth?

The LocalEnvironmentModel is unique to every vehicle and its allObjects method returns all objects that can be seen at the moment by any of its sensors. You can use the number of those objects as your reference in statistics. The matching number of actually included objects in a CPM should be included in the respective CPM.

yangjavaios commented 2 years ago

oh,this is my problem! I want to count when perceive a car! Then I can obtain the number of vehicles detected by RSU . But from the LocalEnvironmentModel I only get the content of the CPM,the count I don't know how to get?

yangjavaios commented 2 years ago

Riebl,from the CPM,I can only get the content,the code you offer like this :

struct ObjectContainer
{
    omnetpp::SimTime timeOfMeasurement = omnetpp::SimTime::ZERO;
    int objectId = 0;
    int sensorId = 0;
    std::weak_ptr<EnvironmentModelObject> object;
};

from the code ,I can only get the objectId and sensorId,so as you see! I have a big problem!

riebl commented 2 years ago

https://github.com/riebl/artery/blob/bc7013066c2f00aa84324d71cf0a9e9ffdf07b00/src/artery/envmod/service/CollectivePerceptionMockService.cc#L111 grants you access to the complete received CPM, including a std::vector<ObjectContainer>. Either extend the indicate method or subscribe to the CpmReceived signal emitted there, which also conveys a pointer to the received CPM.

yangjavaios commented 2 years ago

OK,now I can run the Artery example successfully,and I can get the number of CPM received or transmission.But I also have a problem! From the EnvmodPrinter.cc,I can get the list of objects,and from the Qtenv I can obtain the number of the objects,I know that you get the number of objects through the size(objs),If I want to statistic the number of obj in the result , emit the size(obj) in the EnvmodPrinter.cc is or not a good idea? or you have the other ideas to statistic the number of objects in the result? thanks for your reply! Best

yangjavaios commented 2 years ago

Hi,riebl If I want to use the AOI(age of information), I need to statistic the update time of CPM. But I don't know how to get it! At the moment,I use the

      simtime_t latency = simTime() - cpm->getCreationTime();
       emit(latency_,latency);

Is it true?can you tell me ! Also I want to know why I can only get the one result of it.such as word.node[0].udpApp[0],but I have many nodes,so it puzzle me all the time?

Best

riebl commented 2 years ago

Your line simtime_t latency = simTime() - cpm->getCreationTime(); looks fine to me for calculating the latency at the application layer. Also emitting the calculated time difference as a signal is fine and enables you to add accompanying @statistic to the service's NED file; it is then easy to record these latencies. The OMNeT++ manual covers this topic in great detail.

You can enable the recording of these values for individual nodes or just all of them; just use the * wildcard in your omnetpp.ini to configure all nodes at once, e.g. World.node[*]… matches all nodes.

yangjavaios commented 2 years ago

ok,I will do it now!thanks for your help!