Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traci-python(getNeighbors) #1

Open
shuowang572875852 opened this issue Apr 24, 2019 · 0 comments
Open

traci-python(getNeighbors) #1

shuowang572875852 opened this issue Apr 24, 2019 · 0 comments

Comments

@shuowang572875852
Copy link

Hello,
Sorry to bother you,I want to add some new functions to traci4matlab in the same way as traci-python: such as getNeighbors(vehID, mode).
1、I add VAR_NEIGHBORS = '0xbf' to constants.m
2、add traci.constants.VAR_NEIGHBORS,... and {'traci.vehicle.readNeighbors'} to RETURN_VALUE_FUNC.m
3、write readNeighbors.m
function [vehID, dist] = readNeighbors(result)
%读取周围车辆相关信息
N=result.readInt();
neighs = [];
for i =1:N
vehID = result.readString();
dist = result.readDouble();
neighs.append(vehID,dist);
end

 4、write getNeighbors.m

function [vehicleID, dist] = getNeighbors(vehID, mode)
import traci.constants
global message
traci.beginMessage(constants.CMD_GET_VEHICLE_VARIABLE,constants.VAR_NEIGHBORS,...
vehID, 2);
message.string = [message.string uint8(sscanf(constants.TYPE_UBYTE,'%x'))...
uint8(mode)];
[vehicleID, dist] = traci.vehicle.readNeighbors(traci.checkResult(...
constants.CMD_GET_VEHICLE_VARIABLE, constants.VAR_NEIGHBORS, vehID));

But when i run getNeighbors.m , the matlab commandline get follow errors:
error use traci.sendExact (line 46)
64 164 255 Error Get Vehicle Variable: unsupported variable 0xbf specified
The sumo-gui error:
Error: Answered with error to command 0xa4: Get Vehicle Variable: unsupported variable 0xbf specified

So how can i do for it ?Can you give me some help?Looking forward to your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant