How to implement Lane Change Models using VEINS?

407 views
Skip to first unread message

kh...@ismll.de

unread,
Feb 5, 2014, 10:31:28 AM2/5/14
to omn...@googlegroups.com
Hi All,

Is there any method in VEINS (Traci) for implementing a default lane change scenario? 

Any help will be appreciated.

thanks,

Umer

Christoph Sommer

unread,
Feb 6, 2014, 4:14:30 AM2/6/14
to omn...@googlegroups.com
kh...@ismll.de wrote:
> Is there any method in VEINS (Traci) for implementing a default lane
> change scenario?

If you want to change the lane change model: you will have to modify the
road traffic simulator.

If you only want to temporarily force a vehicle to a certain lane: the
SUMO TraCI documentation has a page on that at. See [1]

Best,

Christoph


[1] http://sumo-sim.org/wiki/TraCI/Change_Vehicle_State

--
Dr.-Ing. Christoph Sommer
Institute of Computer Science
University of Innsbruck, Austria
Phone: +43 512 507-53285 / Fax: -53079
http://ccs.uibk.ac.at/~sommer/

Umer Khan

unread,
Feb 6, 2014, 9:02:54 AM2/6/14
to omn...@googlegroups.com
Thanks Christoph,

Yes, I can control the vehilce's current lane by implementing a customized policy.

But does Veins has a default lane-change policy or model ? like MOBIL or Incentive criterion based lane changes? 

best

Umer

Christoph Sommer

unread,
Feb 6, 2014, 10:10:59 AM2/6/14
to omn...@googlegroups.com
Umer Khan wrote:
> But does Veins has a default lane-change policy or model ? like MOBIL

Yes.

Please see the SUMO documentation.


Best,

Christoph

Wellington Lobato Junior

unread,
Jun 7, 2017, 4:05:15 PM6/7/17
to OMNeT++ Users
Hello Umer,

You need to modify the TraCICommandInterface.cc file and the TraCICommandInterface.h file. 

TraCICommandInterface.cc




void TraCICommandInterface::Vehicle::changeLane(uint8_t laneIndex, int32_t timeGo) {
    uint8_t variableId = CMD_CHANGELANE;
    uint8_t variableType = TYPE_COMPOUND;
    int32_t count = 2;
    uint8_t laneIndexT = TYPE_BYTE;
    uint8_t timeT = TYPE_INTEGER;
    TraCIBuffer buf = traci->connection.query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType << count << laneIndexT << laneIndex << timeT << timeGo);
    ASSERT(buf.eof());
}

TraCICommandInterface.h

void changeLane(uint8_t laneIndex, int32_t timeGo);

You can call the function in the application, like BaseWaveApplLayer.cc file. Something like that:
traciVehicle->changeLane(0,5000); //
changeLane(laneIndex,time)

Jia Guo

unread,
Apr 6, 2018, 10:28:58 PM4/6/18
to OMNeT++ Users
Hi Wellington, 

Can you explain what the laneIndex is, and if I want to change the vehicle from the current lane to the left, how can I get the laneIndex? I know there is a vehicle method called getLaneIndex. But using the current vehicle, I can only get the current laneIndex, how could I get the left laneIndex? Thanks.
Reply all
Reply to author
Forward
0 new messages