Hi all,

 

I found the function vehicle.getLeader() missing in the TraCI4Matlab
contribution. 

I’m now struggling to get it implemented since some time, because I still 

have problems understanding the TraCI-protocol. 

 

With the documentation from
http://sumo.dlr.de/wiki/TraCI/Vehicle_Value_Retrieval 

in mind I at least managed to get some answer from SUMO. But reading the

compound result (string vehID, double dist) again is somehow very difficult
to me. 

 

Could those of you familiar with the Matlab Code please have a short look at
my attempt:

 

function data = getLeader(vehID,dist)

import traci.constants

global message

traci.beginMessage(constants.CMD_GET_VEHICLE_VARIABLE, '0x68',...

    vehID, 1+4+1+8);

message.string = [message.string
uint8(sscanf(constants.TYPE_DOUBLE,'%x'))...

    traci.packInt32(1) uint8(sscanf(constants.TYPE_DOUBLE,'%x'))...

    traci.packInt64(dist)];

    

result = traci.checkResult(constants.CMD_GET_VEHICLE_VARIABLE, '0x68',
vehID);

result.readLength();

nbData = result.readInt();

data = {};

for i=1:nbData

    result.read(1);

    leader = result.readDouble();

    result.read(1);

    ldist = result.readString();    

    data = [data, leader, ldist];

end

 

 

 

Many thanks in advance,

 

marcus 

------------------------------------------------------------------------------
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to