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

accel{i}=traci.vehicle.getAcceleration(IDList); #6

Open
shuowang572875852 opened this issue Mar 15, 2019 · 0 comments
Open

accel{i}=traci.vehicle.getAcceleration(IDList); #6

shuowang572875852 opened this issue Mar 15, 2019 · 0 comments

Comments

@shuowang572875852
Copy link

I want to get the acceleration of the vehicle at each time step. Since the input parameter for obtaining acceleration is the vehicle ID, I obtained the vehicle ID for each time step, but the following error was obtained . The follows are my codes :

clc;
clear all;
import traci.constants
scenarioPath=['F:\software\SUMO配置文件\bin\quickstart\quickstart.sumocfg'];
system(['sumo-gui -c ' '"' scenarioPath '"' ' --remote-port 8813 --start&']);
traci.init

SIM_STEPS = [1 900];
beginTime = SIM_STEPS(1);
duration = SIM_STEPS(2);
endTime = SIM_STEPS(1) + SIM_STEPS(2) - 1;

for i = 1: duration
traci.simulation.step();
IDList{i} = traci.vehicle.getIDList();
accel{i}=traci.vehicle.getAcceleration(IDList);
end
traci.close()

I used the traci4matlab and the above are my codes , the ''duration'' is the "simulation duration time ",the error logs are :

error use uint8
Unable to convert from cell to uint8.

error traci.beginMessage (line 23)
traci.packInt32(length(objID)) uint8(objID)];

error traci.sendReadOneStringCmd (line 10)
traci.beginMessage(cmdID, varID, objID);

error traci.vehicle.getUniversal (line 21)
result = traci.sendReadOneStringCmd(constants.CMD_GET_VEHICLE_VARIABLE,varID,vehID);

error traci.vehicle.getAcceleration (line 12)
accel = traci.vehicle.getUniversal(constants.VAR_ACCELERATION, vehID);

error quickstart (line 19)
accel{i}=traci.vehicle.getAcceleration(IDList);

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