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 12 months 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

dnatividade commented 1 year ago

It is possible to do that yes. First of all, have you had any contact with OMNet++? It would be interesting if you first try to familiarize yourself with the environment, doing some basic examples, like sending a message from one vehicle to another.

barkhabaheti 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

hey did you find anything. i want a example

dnatividade commented 1 year ago

I'll try to make an example and post it here.

dnatividade commented 1 year ago

Use the method: traciVehicle->changeVehicleRoute(newRoute) newRoute is a string list

Using the "Erlangen" example:

void TraCIDemo11p::onWSM(BaseFrame1609_4* frame)
{
    if (TraCIDemo11pMessage* wsm = check_and_cast<TraCIDemo11pMessage*>(frame)) {

        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //Original route (file: erlangen.rou.xml):
        //-39539626 -5445204#2 -5445204#1 113939244#2 -126606716 23339459 30405358#1 85355912 85355911#0 85355911#1 30405356 5931612 30350450#0 30350450#1 30350450#2 4006702#0 4006702#1 4900043 4900041#1
        //New route (arbitrarily created):
        //-39539626 -5445204#2 -5445204#1 113939244#2 -126606716 -4006668 -15259223 15259223 4006668 126606716 113939242#0 113939242#1 113939242#2 113939241 32320329

        //Create route list
        std::list<std::string> newRoute;
        newRoute.clear();
        newRoute.push_back("-39539626");
        newRoute.push_back("-5445204#2");
        newRoute.push_back("-5445204#1");
        newRoute.push_back("113939244#2");
        newRoute.push_back("-126606716");
        newRoute.push_back("-4006668");
        newRoute.push_back("-15259223");
        newRoute.push_back("15259223");
        newRoute.push_back("4006668");
        newRoute.push_back("126606716");
        newRoute.push_back("113939242#0");
        newRoute.push_back("113939242#1");
        newRoute.push_back("113939242#2");
        newRoute.push_back("113939241");
        newRoute.push_back("32320329");

        //Change Vechicle Route
        traciVehicle->changeVehicleRoute(newRoute);
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    }
}

I tested it and it worked fine! I hope that helps.

dnatividade 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

This weekend I will post a video running a simulation using this example.

dnatividade 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

hey did you find anything. i want a example

I hope that helps.

Y-AMDIAZ commented 1 year ago

I would like to see your video please and if you want to send me your fils by using zip just to understand more , and thanks

dnatividade commented 1 year ago

Here is the video: https://www.youtube.com/watch?v=XWG3fBwjLxQ

The speech is in Portuguese but I believe that only by the video you will be able to understand. The code is the same as shown here.

I hope that helps.

Y-AMDIAZ commented 1 year ago

Can you explain what is the subject of this video that you did , because I watched but I didn’t understand the subject of this video if you can just explain what you did or the resume of your works because in your video that you did there are a car that takes a lot of wayside and are there a communication with cars … I want just see if there is a relation with what you did and what I want please And thanks Also

dnatividade commented 1 year ago

It works like this: to put it simply, when a vehicle receives any message (regardless of the message content, as I said, I want to simplify) it changes route (changes the path it will travel).

To improve, you can:

The only thing I demonstrated in the video was how to dynamically change the vehicle's route.

Just that! Remembering that I did my tests using the standard Veins template that you can download from https://veins.car2x.org/download/veins-5.2.zip

Y-AMDIAZ commented 1 year ago

I'm working on creating an example involving SUMO and OMNeT++, and I'm trying to establish a connection between the two. I started with a standard example, but now I'm attempting to create my own project and transfer it to OMNeT++. However, I'm encountering difficulties in this process, particularly because I'm not using the TraCI (Traffic Control Interface) protocol. I'm wondering if the use of TraCI is essential for transferring a project to OMNeT++. Could you please help with this?

image image

v

image
dnatividade commented 1 year ago

Ok, first of all.... You are running sumo-launchd.py? It is your first simulation?

I recommend you start with Instant Veins (Virtual Machine with all the simulation environment already configured). Download: https://veins.car2x.org/download/instant-veins-5.2-i1.ova About Instant Veins: https://veins.car2x.org/documentation/instant-veins/

Y-AMDIAZ commented 1 year ago

Yes it’s my first simulation ? And I want to run my simulation from sumo but I’m blocking here

dnatividade commented 1 year ago

This error occurs when there is no communication between Omnet and Sumo.

Y-AMDIAZ commented 1 year ago

And to creat a communication between sumo and omnet++ should I use traci , because for now I created just a simple projet from sumo and I want to transfer it to omnet++

dnatividade commented 1 year ago

I do not know if I understand..... So you want to do a vehicle traffic simulation? If you only want to run a simulation related to traffic engineering, you don't need Omnet or TraCi. SUMO only.

What are you trying to do? Is it some task related to computer science (like VANET) or traffic engineering? Explain to me exactly what you need to do?

Y-AMDIAZ commented 1 year ago

would like to create a simulation in which I can modify the route of a car on a map I've created using SUMO, complete with traffic and cars. I've already developed the project in SUMO, including the files for the road network (now.net), the car routes (now.rou), and additional components (now.add). Now, I want to transfer this project to OMNeT++ to integrate Roadside Units (RSUs) and enable route changes similar to what I've seen in a video. The key difference is that I want to apply this to my own project and map. Could you help me achieve this?

image
dnatividade commented 1 year ago

Ok, I got it.

Can you send me your project files? I want to test in my environment.

If you cannot post here, please send it to me at this temporary email address: cemeni1037@touchend.com

Y-AMDIAZ commented 1 year ago

Done and I wih to find a solution to this problem

dnatividade commented 1 year ago

Ok, I'm testing now....

dnatividade commented 1 year ago

I'm testing...

now-1

Y-AMDIAZ commented 1 year ago

yes , you did it you used traci ? or what normaly

dnatividade commented 1 year ago

Yes, I used (SUMO + OMNet + Veins). But I didn't write any code. I just configured the XML and INI files so that the simulation works correctly.

Please test with these new files. now.zip

Y-AMDIAZ commented 1 year ago

it works thanks , just I try to do a new fils by my self so I have an erreur , i dont know where I did the erreur , i thnik i forgot somethings , i dont know a new fils that I try : projet You.zip

image
dnatividade commented 1 year ago

In the projectyou.add.xml file you referenced the e1_0.xml file. But I didn't find this file.

proj

barkhabaheti commented 1 year ago

can you plz explain this veins example for message passing between rsu and nodes where this message is generating from and the content of the message. but plz provide english subtitles.

dnatividade commented 1 year ago

Hi. This weekend I'm going to do an example of exchanging messages with RSU for you. As for the subtitles, you can try to automatically generate them on Youtube.

Y-AMDIAZ commented 1 year ago

at first, it was functioning, but later it stopped working. Is it possible that something was tampered with or I don't know, just trying to figure out where the issue might be? but now there are not a communucation between nodes and rsu .

image
dnatividade commented 1 year ago

Send me your code. Let me try to help you.

Y-AMDIAZ commented 1 year ago

I would like to establish , I saw the cars move but there are not a communication between vehicles and Roadside Units (RSUs), then i want to change the route for certain specific vehicles. In essence, I want to modify the road only for the chosen vehicle , Nouveau dossier.zip

Y-AMDIAZ commented 1 year ago

I did another exemple but not working :

image

there are not a communication , ? koko.zip

dnatividade commented 1 year ago

OK. But for there to be V2V (vehicle-to-vehicle) or V2I (vehicle-to-infrastructure) communication, you need to code that. Send me the codes you made. Because the codes you sent refer only to the road network configuration. It does not deal with communication and messages.

Y-AMDIAZ commented 1 year ago

But firstly why there is not a communication Between RSU and cars , and you did the communication please where Did I the problem just I want firstly have a projet that you did a communication between cars and rsu and than I will change a ways and routs of some cars ? Where I did a errour

dnatividade commented 1 year ago

Ahh.. OK. I think I understood!

In the DEMO code that comes with VEINS, there is a method called handlePositionUpdate, which is called every time a vehicle changes its position on the road. DEMO is configured as follows: if the vehicle is stopped for at least 10 seconds, send a message. In its new project, vehicles are stopped on the road for a short period of time (less than 10 seconds). That's why the send message routine (sendDown(wsm)) is not triggered.

Make the following change in the handlePositionUpdate method of the TraCIDemo11p.cc file:

omnet

What I did was change the time from 10 seconds to 1 second (simTime() - lastDroveAt >= 1)

Run your project called "koko" again (I don't know what "koko" means in my language ;) and you will notice that at 99 minutes of simulation there will be an exchange of messages, because at that moment the traffic was congested and the vehicles were stopped for more than 1 second.

dnatividade commented 1 year ago

"koko" simulation time = 99 omnet2

dnatividade commented 1 year ago

Just remembering that in this case it is not the RSU that is sending the messages, but the vehicles. If you want, you can enable RSU to send beacons by changing the following line in your omnetpp.ini file from false to true: .rsu[].appl.sendBeacons = true

And here you set the sending frequency. .rsu[].appl.beaconInterval = 1s

rsu

But this way, you will notice that your simulation will be much slower.

Y-AMDIAZ commented 1 year ago

yes it works on 99 second on the exemple of koko but i try to use it in another exemple the cars not send a message so the message routine (sendDown(wsm)) is not triggered nec.zip

Y-AMDIAZ commented 1 year ago

so will I run the exemple standard of veins the cars send a message but in my exemple no , why ?

image
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

Y-AMDIAZ commented 1 year ago

yes but in this case the RSU send a message but what i want to send and receive a message

Le ven. 18 août 2023 à 12:39, dnatividade @.***> a écrit :

yes it works on 99 second on the exemple of koko but i try to use it in another exemple the cars not send a message so the message routine (sendDown(wsm)) is not triggered nec.zip https://github.com/dnatividade/VEINS-tutorials/files/12373927/nec.zip

Just remembering that in this case it is not the RSU that is sending the messages, but the vehicles. If you want, you can enable RSU to send beacons by changing the following line in your omnetpp.ini file from false to true: .rsu[].appl.sendBeacons = true

And here you set the sending frequency. .rsu[].appl.beaconInterval = 1s

[image: rsu] https://user-images.githubusercontent.com/43869367/261453375-7176fb15-45fe-4442-8814-7c43865557c4.png

But this way, you will notice that your simulation will be much slower.

— Reply to this email directly, view it on GitHub https://github.com/dnatividade/VEINS-tutorials/issues/1#issuecomment-1683716989, or unsubscribe https://github.com/notifications/unsubscribe-auth/A62KHXNBZCURBZ5NBEMKMDLXV5A4JANCNFSM6AAAAAAZ5PKL7Q . You are receiving this because you authored the thread.Message ID: @.***>

Y-AMDIAZ commented 1 year ago

I want to clarify that my intention is not to change the routes of all the cars on the map. Instead, I am interested in modifying the route of specific cars. For example, if I have a car named Car A, when Car A communicates with an RSU and subsequently receives a message to change its route from Route 1 to Route 2, that is my objective. I observed in your video that you modified the routes of multiple cars, but my requirement is to adjust the routes of just one or two cars. I hope this explanation makes my request clearer. If you have knowledge of how to achieve this, I would greatly appreciate your guidance.

dnatividade commented 1 year ago

so will I run the exemple standard of veins the cars send a message but in my exemple no , why ? image

In the standard example of VEINS, in the omnetpp.ini file there is a traffic accident configuration for all vehicles with id ending in 0 (id 10, id 20, id 30...). The accident happens when the vehicle has been on the road for 73 seconds. The duration of the crash is 50 seconds. This is like simulating a road accident. As the vehicle is stopped for 40 seconds, this time is enough to trigger the message sending function.

mobi

dnatividade commented 1 year ago

I want to clarify that my intention is not to change the routes of all the cars on the map. Instead, I am interested in modifying the route of specific cars. For example, if I have a car named Car A, when Car A communicates with an RSU and subsequently receives a message to change its route from Route 1 to Route 2, that is my objective. I observed in your video that you modified the routes of multiple cars, but my requirement is to adjust the routes of just one or two cars. I hope this explanation makes my request clearer. If you have knowledge of how to achieve this, I would greatly appreciate your guidance.

You can use Vehicle ID. Today I don't think I can set an example for you. But tomorrow I'll do what you're asking and post it on YouTube. I'll do an example (using the VEINS pattern), where the RSU will be sending route messages, but only a specific vehicle will receive the message and make the decision to change the route.

Y-AMDIAZ commented 1 year ago

Okey thnak you very much , I will wait this video

dnatividade 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

Yes, on my channel there are some examples where I program the sending of messages. However, due to my language, it might be a bit difficult for you to understand...

But what would this message logging system look like? Perhaps I can make an example for you.

dnatividade 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

Y-AMDIAZ commented 1 year ago

Yes thanks , the car id 40 it modified the rout or not ? because on video , it received the message but it didn’t change the route

dnatividade commented 1 year ago

No. In this example I only showed how to send a message to a specific vehicle (unicast communication). I will post here a more complete code, where the vehicle changes its route when receiving the message.

dnatividade commented 1 year ago

Change route: veins.zip

route

dnatividade 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