pipeacosta / traci4matlab

An implementation of the Traffic Control Interface for Matlab
BSD 2-Clause "Simplified" License
12 stars 15 forks source link

error setCompleteRedYellowGreenDefinition #19

Open symonsg88 opened 2 years ago

symonsg88 commented 2 years ago

I am using sumo through traci4matlab. I generated the complete definition of the semaphore through traci.traffilights.gCompleteRedYellowGreenDefinition At this point I intervened as per attachment for the duration of the green on the definition generated. I would now like to restore this modified definition via traci.trafficlights.setCompleteRedYellowGreenDefinition however the code keeps giving me error. Can anyone tell me where am I wrong? Thank you all

logic_list = traci.trafficlights.getCompleteRedYellowGreenDefinition('B1');

for tt = 1:numel(logic_list{1, 1}.phases) if contains(logic_list{1, 1}.phases{tt}.state,'G') logic_list{1, 1}.phases{tt}.duration = 10; logic_list{1, 1}.phases{tt}.minDur=10; logic_list{1, 1}.phases{tt}.maxDur=10; end end

logic = traci.trafficlights.Logic("1", 0, 0, logic_list{1, 1}.phases); traci.trafficlights.setCompleteRedYellowGreenDefinition('B1',logic);

SUMO-version 1.11.0:

windows 10:

Error is:

"Error using uint8 Conversion to uint8 from string is not possible.

Error in traci.trafficlights.setCompleteRedYellowGreenDefinition (line 29) traci.packInt32(length(tls.programID)) uint8(tls.programID)];

Error in untitled2 (line 107) traci.trafficlights.setCompleteRedYellowGreenDefinition('B1',logic);"

while using directly traci.trafficlights.setCompleteRedYellowGreenDefinition('B1',logic_list);

error is:

"Dot indexing is not supported for variables of this type.

Error in traci.trafficlights.setCompleteRedYellowGreenDefinition (line 15) len = 1+4 + 1+4 + length(tls.programID) + 1+4 + 1+4 + 1+4; % tls parameter

Error in untitled2 (line 107) traci.trafficlights.setCompleteRedYellowGreenDefinition('B1',logic_list);"

sjh30 commented 4 months ago

hello,sorry to interrupt you.I just wanna ask if you solve the problem or not.Because i met the same error two years after you met the problem.And i can hardly find any solution right now.So i just wanna know can you give me some suggestions.Sorry to bother you