Hi Divus,
my reply inline
On 14/10/16 13:12, Divus Iulius wrote:
> <
https://s17.postimg.org/65lgi20j3/2platoons.png>
>
> Hello Michele:
>
> Thank you so much for the speedy reply. :)
>
> Following your indications I was able to add a second platoon—I
> discovered that I did not read the documentation for the
> PlatoonsTrafficManager by oversight, and now I understand that the
> injected platoons will have all the same size.
Yes you are right. PlatoonsTrafficManager is given as an example, so it
simply injects same size platoons. Obviously, you can personalize it
according to your needs, but together with this you will need to modify
the PositionHelper (located in the "utilities" folder). The position
helper gives you some functionalities to understand who is the leader,
who is your front vehicle, which platoon a vehicle is in, etc. As
written in the website, the position helper gives you answers for
platoons injected by the sample traffic manager, so if you change it,
you need to touch the position helper as well.
>
> Still, with my limited knowledge I still don't quit catch what you mean
> by "discriminate between the platooning and non platooning vehicles
> inside veins modules." My guess is, inside the veins modules
> (SinusoidalScenario.cc .h .ned? or maybe the PlatoonsTrafficManager.cc)
> the logic programmed should only be used when the
> traciVehicle->getVType() is equal to the platoonType, instead of everytime.
Exactly. You should do this for every module involved, including the
scenario (scenarios folder), the protocol (protocols folder), and the
application (apps folder).
There is another (more elegant) way to do this, which is to create a set
of different modules for your non-platooning vehicles (e.g., a new
beaconing module that simply sends beacons to interfere with your
platoons), and create a new type of OMNeT++ node like Car.ned in
examples/platooning. You can create, for example, InterferingCar.ned and
change the modules inside to use the ones you created. Finally, you will
need to change the omnetpp.ini file to tell Veins that a module with a
certain vehicle type should be instantiated as an InterferingCar. To do
so, you will need to change
*.manager.moduleType = "Car"
*.manager.moduleName = "node"
to something like
*.manager.moduleType = "vtypeauto=Car yourvtype=InterferingCar"
*.manager.moduleName = "vtypeauto=node yourvtype=inode"
where yourvtype is the vehicle type you defined in your SUMO config file
(freeway.rou.xml) and inode is a symbolic name that you use in the
omnetpp.ini to set the parameters. For example, for "node" you already
find something like
*.node[*].mobility.x = 0
*.node[*].mobility.y = 0
*.node[*].mobility.z = 1.895
If you want to configure your new vehicle as well, you will need to add
*.inode[*].mobility.x = 0
*.inode[*].mobility.y = 0
*.inode[*].mobility.z = 1.895
for all the parameters you need.
I know this might look complicated but it's the way (very elegant, in my
opinion) Veins works. I am still preparing the tutorials on these
advanced features, but it will take me some more time.
>
> My current issue is how positioning all the cars of the platoon in a
> specific lane. So far tried adding the following code at the end of the
> inside "if (stage == 1) {" "void SinusoidalScenario::initialize(int
> stage)" at "SinusoidalScenario.cc" and then "make -j 2 MODE=release"
> with two plattons of 8 cars each one:
>
> void SinusoidalScenario::initialize(int stage) {
>
> BaseScenario::initialize(stage);
>
> if (stage == 1) {
> //all the code is identical except for the following two lines
> at the end of the if clause
> //...
>
> int platoonLane = 1;
> traciVehicle->setFixedLane(platoonLane);
> positionHelper->setPlatoonLane(platoonLane);
>
>
> }
>
>
> }
>
> But the result is that every car starts at lane 1, but the leader of the
> second platoon, which starts at lane 0. (Nevertheless, the code doesn't
> work for platoonLane=2, 3, 4, 5...). So far very puzzling. :)
I guess the problem is that the PlatoonsTrafficManager class injects
vehicles in a specific lane. If you later change lane you might face
problems with the SUMO lane change logic, which says that if you are too
close to a vehicle on the lane you want to move, you can't change lane
because it would be "unsafe" in a real-world situation. I'm already
working on this, trying to ignore the safety logic if the vehicle is a
platooning vehicle.
For the time being, try to change the PlatoonsTrafficManager class to
inject the vehicles in the lane you want, and keep also the changes you
made to the SinusoidalScenario class.
>
>
> Thank you again. :)
>
> Regards,
> Divus
Best,
Michele
> > an email to
omnetpp+u...@googlegroups.com <javascript:>
> > <mailto:
omnetpp+u...@googlegroups.com <javascript:>>.
> <
https://groups.google.com/group/omnetpp>.
> <
https://groups.google.com/d/optout>.