Skip to content

Commit

Permalink
Updated traci.simulation.findRoute and traci.trafficlights.getComplet…
Browse files Browse the repository at this point in the history
…eRedYellowGreenDefinition for TraCI version 20
  • Loading branch information
pipeacosta committed Jun 4, 2021
1 parent 95b22ef commit a2fb0f1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
26 changes: 20 additions & 6 deletions +traci/+simulation/readStage.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
result.read(1);
stageType = result.readInt();
result.read(1);
vType = result.readString();
result.read(1);
line = result.readString();
result.read(1);
destStop = result.readString();
Expand All @@ -14,13 +16,25 @@
result.read(1);
cost = result.readDouble();
result.read(1);
result.read(1);
length = result.readDouble();
intended = result.readString();
result.read(1);
depart = result.readDouble();
result.read(1);
departPos = result.readDouble();
result.read(1);
arrivalPos = result.readDouble();
result.read(1);
description = result.readString();

stage = struct('stageType', stageType, 'line', line, 'destStop', destStop);
stage.edges = edges;
stage.travelTime = travelTime;
stage.cost = cost;
stage.intended = intended;
stage.depart = depart;
stage = struct('stageType', stageType, 'vType', vType, 'line', line,...
'destStop', destStop, 'edges', edges, 'travelTime', travelTime,...
'cost', cost, 'length', length, 'intended', intended, 'depart',...
depart, 'departPos', departPos, 'arrivalPos', arrivalPos,...
'description', description);
% stage.edges = edges;
% stage.travelTime = travelTime;
% stage.cost = cost;
% stage.intended = intended;
% stage.depart = depart;
5 changes: 5 additions & 0 deletions +traci/+trafficlights/Phase.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
minDur
maxDur
next
name
end
methods
function this = Phase(duration, state, varargin)
Expand All @@ -27,13 +28,17 @@
this.minDur = -1;
this.maxDur = -1;
this.next = -1;
this.name = '';

if nargin > 2
this.minDur = varargin{1};
if nargin > 3
this.maxDur = varargin{2};
if nargin > 4
this.next = varargin{3};
if nargin > 5
this.name = varargin(4);
end
end
end
end
Expand Down
11 changes: 8 additions & 3 deletions +traci/+trafficlights/readLogics.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
numPhases = result.readCompound();
phases = cell(1, numPhases);
for j=1:numPhases
result.readCompound(5);
result.readCompound(6);
duration = result.readTypedDouble();
state = result.readTypedString();
minDur = result.readTypedDouble();
maxDur = result.readTypedDouble();
next = result.readTypedInt();
phases{j} = traci.trafficlights.Phase(duration, state, minDur, maxDur, next);
numNext = result.readCompound();
next = zeros(1, numNext);
for k = 1:numNext
next(k) = resut.readTypedInt();
end
name = result.readTypedString();
phases{j} = traci.trafficlights.Phase(duration, state, minDur, maxDur, next, name);
end
logic.phases = phases;
numParams = result.readCompound();
Expand Down
2 changes: 1 addition & 1 deletion +traci/connect.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
c.connect(host, port);
break
catch err
fprintf('Could not connect to TraCI server at %s:%s. %s\n', host, port, err);
fprintf('Could not connect to TraCI server at %s:%s. %s\n', host, port, err.message);
pause(i)
end
end
Expand Down

1 comment on commit a2fb0f1

@symonsg88
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, can you help me with this? eclipse-sumo/sumo#10174 (comment)

it's relative to setCompleteRedYellowGreenDefinition, thanks

Please sign in to comment.