dnatividade / VEINS-tutorials

Tutorials about VEINS, Sumo and OMNet++
GNU General Public License v3.0
15 stars 2 forks source link

Utilizing SUMO, OMNeT++, and VEINS to Control Vehicles and Send Messages in Simulation #1

Closed Y-AMDIAZ closed 1 year ago

Y-AMDIAZ commented 1 year ago

I would like to use SUMO and OMNeT++ to send a message to a vehicle using the VEINS framework. For example, I want to change the route or direct a vehicle to a specific destination by using a Roadside Unit (RSU). Can someone provide me with instructions on how to do this or suggest where I can start? I would appreciate an example or any guidance. Thank you

Y-AMDIAZ commented 1 year ago

the video is not working ? there is a problem ? https://youtu.be/Dbk2-m4UaFw

Y-AMDIAZ commented 1 year ago

can you send me the link or can you open the video please

barkhabaheti commented 1 year ago

thank you, i want to create a message logging system in this veins example so for this i have to make changes in myveinsapp.cc file do you have anything from which i can understand this. thank you

Here is an example of the message logging system: veins.zip

log

hey thank you it helped me alot. actually i want to send a messages between rsu and cars and want to save this communication using hash function so that noone can see the message and can't temper with it. i would really appreciate if you can help me with this. can you explain a veins example completely through a video. my coding is not good so it is very difficult for me to understand. thank you very much.

Y-AMDIAZ commented 1 year ago

the video it s not working for me , what about you ?

barkhabaheti commented 1 year ago

Okey thnak you very much , I will wait this video

Here's the video. Sorry for my poor English and hope this helps you. https://youtu.be/Dbk2-m4UaFw

Code: veins.zip

this video is private how to access it.

Y-AMDIAZ commented 1 year ago

I dont know is the same things for me , i can't access to it ,

Y-AMDIAZ commented 1 year ago

please can you give us the access to your video or opend just for 5 minute we need your video just to understand please ,

dnatividade commented 1 year ago

I removed that video. But here's another: https://www.youtube.com/watch?v=-QpHRkP2kXM

dnatividade commented 1 year ago

There is am error in your .ned file: ned

dnatividade commented 1 year ago

I am confused. send me all the code.

dnatividade commented 1 year ago

I found some problems: 1) there is no vehicle 104 (I configured 106 to test) 2) you will need to delete the content of the TraCIDemo11p::handlePositionUpdate(cObject* obj) method, otherwise you will have problems when vehicles are stopped on the road positionUpdate

3) when I configure vehicle 106 to receive the route, another invalid route error appears. So I tweaked the code, commenting out the first 2 routes, to work. route

I took the opportunity to adjust the size of the "playground".

New Code: veins.zip

dnatividade commented 1 year ago

I will check...

dnatividade commented 1 year ago

But the route given by you is wrong!

dnatividade commented 1 year ago

Ok, I found the errors...

Put these routes:

    std::string newRouteStr = "";
    newRouteStr = newRouteStr + "-E46" + ";";
    newRouteStr = newRouteStr + "-E45" + ";";
    newRouteStr = newRouteStr + "-E29" + ";";
    newRouteStr = newRouteStr + "-E3"  + ";";
    newRouteStr = newRouteStr + "E6"   + ";";
    newRouteStr = newRouteStr + "E7"   + ";";
    newRouteStr = newRouteStr + "-E13" + ";";
    newRouteStr = newRouteStr + "-E14";

Now, it's working!

dnatividade commented 1 year ago

video

Y-AMDIAZ commented 1 year ago

Thank you, it is working. I just have three questions:

1 - How did you create the effect of having a large green circle around the vehicle in the video? 2 - Can I send a message to two or three cars? For example, if I have car IDs, and the first car i made it green and the second red 3 - Is it possible to send a message to a car requesting its location in terms of coordinates (x, y, z)?"

dnatividade commented 1 year ago

Thank you, it is working. I just have three questions:

1 - How did you create the effect of having a large green circle around the vehicle in the video? 2 - Can I send a message to two or three cars? For example, if I have car IDs, and the first car i made it green and the second red 3 - Is it possible to send a message to a car requesting its location in terms of coordinates (x, y, z)?"

1- findHost()->getDisplayString().updateWith("r=16,green"); //when the vehicle to receive the msg where, r = radius green = color green

2- Yes, you need to check what your car ID is in the "onWSM" method. But I don't know if it is possible to send message via multicast. In my projects I send via broadcast and also send a list of destinations in a message field. Then you handle it in your app. OR you can send the message 3 times, each time to a different destination.

3- Yes, I did a project like this. You need to use a "Coord" variable in the message file. And to get the current coordinate of the vehicle, use: mobility->getCurrentPosition() NOTE: the coordinates have nothing to do with the street names. Do you need the coordinates to do some kind of distance calculation between one vehicle and another?

I'll make an example and post it for you.

dnatividade commented 1 year ago

colors

Y-AMDIAZ commented 1 year ago

can you send me the code of this video just to understand what you did and how ?

dnatividade commented 1 year ago

can you send me the code of this video just to understand what you did and how ?

Code: Code.zip

dnatividade commented 1 year ago

I want to send a message and reciev a message i saw you video so I have some erreur I still serach where I did the probleme just if you want to take a look where I did a probleme code o sending a message.zip

I want to send a message just like what you did in your video (Part2 ) image

See: https://www.youtube.com/watch?v=HDWxgS5frSk

When you using Omnet++, use CRTL+[ESPACE] to autocomplete the code.

Y-AMDIAZ commented 1 year ago

can you send me the code of this video just to understand what you did and how ?

Code: Code.zip

I did a copy to the fils that you sent take a look what it gives me image

Y-AMDIAZ commented 1 year ago

I did nt know where the probleme I try to use another fils that you sent me before the same problem .

dnatividade commented 1 year ago

Try to delete the VEINS directory (make a backup before) and download again from: https://veins.car2x.org/download/veins-5.2.zip. So, replace only the changed files.

dnatividade commented 1 year ago

You also forgot to replace the .msg file, which contains your message fields. Note, there is a compilation error there.

dnatividade commented 1 year ago

Send me the complete code (src/veins/modules/application/traci/)

dnatividade commented 1 year ago

Ok, I will try to run this code (feel.zip)....

dnatividade commented 1 year ago

You returned to the code some functions that I had already removed.

Try to keep your code clean. Leave only what you are going to use! Now it worked without errors. Later I will see the question of changing the route.

https://www.youtube.com/watch?v=yLkiDWJv6sk

Y-AMDIAZ commented 1 year ago

I did what you tell to do but not working , I dot konw if my omnet ++ is not working or I dont understand , last night was working good but today just to I want to send a message to a one car its not working ,

image
Y-AMDIAZ commented 1 year ago

I take the simple example ov veins and I take the fils taht you sent to me and just to know if my fils that is wrong or omnet++ i found the RSU send the message to all vehicules , last night it works Id ; 56 it change the rout and now noo it does not working . I m really blokked here I dont know what i would do is to delet the omnet++ and install it or what because I blokked last night it was good but today there are a probleme that I dont know

image
dnatividade commented 1 year ago

I did what you tell to do but not working , I dot konw if my omnet ++ is not working or I dont understand , last night was working good but today just to I want to send a message to a one car its not working , image

There is a compilation error (red X)

dnatividade commented 1 year ago

OK... I suggest you use Instant Veins (Virtual Machine with everything already configured). But if you want, I can remotely connect to your computer and see what's going on.

dnatividade commented 1 year ago

Try to use Instant Veins: https://veins.car2x.org/download/instant-veins-5.2-i1.ova

barkhabaheti commented 1 year ago

I removed that video. But here's another: https://www.youtube.com/watch?v=-QpHRkP2kXM

hey how can we send message from vehicle to rsu

barkhabaheti commented 1 year ago

VEINS: send a unicast message from RSU to Vehicle - PART 2 can you provide code of this tutorial

dnatividade commented 1 year ago

Sorry, but i dont have this code anymore. However, this code is very simple. Here, you can found several examples like this.

https://github.com/dnatividade/Vanet-Projects

Y-AMDIAZ commented 1 year ago

you did the example of finding the localisation of a cars you tell that you send me how can I did it but I thiink you forgot

dnatividade commented 1 year ago

mobility->getCurrentPosition()

dnatividade commented 1 year ago

Sorry. The correct is: mobility->getPositionAt(simTime()) This returns vehicle position now (simTime() = NOW)

getPositionAt

dnatividade commented 1 year ago

(51.849, 202.973, 0) is the vehicle coordenate at this moment.

dnatividade commented 1 year ago

Here is an example of exchanging coordinates between two vehicles.

coord.zip

coord

Y-AMDIAZ commented 1 year ago

I encountered an error while trying to establish communication between vehicles 82 and 76 to determine their respective locations. In the given scenario, I am aware of the location of the green car, numbered 76. However, my objective is to obtain the coordinates for both vehicles 82 ( i want to make 82 have a circle red) and 76 (circle green) within the same context. its important to note that I wont to touch my fils just I want to add the application of communication of 82 and 76 and know there localisation that what it s hard

Y-AMDIAZ commented 1 year ago

I would like to integrate this feature into my current project. The goal is to visually represent vehicle 82 with a red circle and vehicle 76 with a green circle. Additionally, I want to establish a communication mechanism between vehicle 82 and 76. This way, vehicle 82 can send a message to vehicle 76 to inquire about its current location

barkhabaheti commented 1 year ago

hey in my project i have to send message from rsu to cars and cars to rsu and then rsu send the received messages with car id to central authority and then central authority will check if the car is valid or and take the decision according to it. and store the message and there many rsu nodes who will communicate to central authority and if central authority receives same message from 2 rsu he will decide which message should it keep and other one discarded. my coding is very week it i will be benificial if you help me doing this thank you in advance

Y-AMDIAZ commented 1 year ago

okey , in my projet the Rsu that sent a message , but if I want too the cars to send a message also

image
Y-AMDIAZ commented 1 year ago

I have two objectif : 1 - I want to make two circle or tree on the screen but when I run just the crcle green that I saw

image

2 - i want when to know the coordination of two cars the are chosen (circle green and res for exemple )

image
Y-AMDIAZ commented 1 year ago

if just you can help here and thank you in advance

dnatividade commented 1 year ago

I have two objectif : 1 - I want to make two circle or tree on the screen but when I run just the crcle green that I saw

Just comment or remove the line highlighted in pink. All green circles will disappear.

001
Y-AMDIAZ commented 1 year ago

I don't want to remove the circle; it's the opposite. I want to add another circle are bleu and red.

dnatividade commented 1 year ago

Okay, look. But your code looks like this: all vehicles that receive a message have a green circle, including vehicle 100. Only vehicle 64 turns blue and vehicle 106 turns red