Unipisa / Simu5G

Simu5G - 5G NR and LTE/LTE-A user-plane simulation model for OMNeT++ & INET
https://simu5g.org
Other
146 stars 83 forks source link

simu5G1.2.1 to obtain vehicle information (such as speed, position, direction angle) #103

Closed hezhongyi closed 1 year ago

hezhongyi commented 1 year ago

Hi Dear All, Is there any way to run NR/cars in simu5G1.2.1 to obtain vehicle information (such as speed, position, direction angle)

joahannes commented 1 year ago

Hi @hezhongyi.

You can use /veins_inet/VeinsInetSampleApplication.cc as the basis for your implementation. This application already has the necessary (/veins_inet/VeinsInetMobility) for what you want to do.

In summary, you can adapt the /veins_inet/VeinsInetSampleApplication.cc to work similarly to the AlertSender/AlertReceiver.cc application used in the NR/cars examples.

You can consult an adaptation of AlertSender/Receiver for SimuLTE (which can be easily ported to Simu5G) in this repository: veins_hetvnet.

Best regards.

gehirndienst commented 1 year ago

if you use any of inet's mobility modules then:

 IMobility* mobility = check_and_cast<IMobility*>(getContainingNode(this)->getSubmodule("mobility"));
 Coord pos = mobility->getCurrentPosition();
 Coord vel = mobility->getCurrentVelocity();
 // and so on, a full list of methods you could see in IMobility.h

if you use veins/veins_inet aka TraCI vehicles mobility then:

auto* traciVeh = veins::VeinsInetMobilityAccess().get(getParentModule())->getVehicleCommandInterface();
double speed = traciVeh->getSpeed();
// and so on, a full list of methods you could see in TraCICommandInterface.h
hezhongyi commented 1 year ago

Hello,@gehirndienst Thanks for the answer. I have solved the problem according to the method you gave me。 Thanks for your help, Best regards, hezhongyi.

hezhongyi commented 1 year ago

Hello,@Joahannes Thanks for the answer. I solved the problem in the way @gehirndienst gave me. Thanks for your help, Best regards, hezhongyi.