Hi Mahima,
if you want to control the vehicle dynamics completely with your own logic,
then please refer to vehicle.setSpeed and vehicle.moveToXY functions. You
will have to call them in every time step you want the vehicle to follow
your custom rules. On the opposite calling vehicle.slowDown with a positive
duration > 0 will make the vehicle adapt its speed taking into account
safety and dynamic constraints (gap, max. accel/decel). If you want to
deactivate some constraints regarding speed, there is vehicle.setSpeedMode
(see docs
<https://sumo.dlr.de/docs/TraCI/Change_Vehicle_State.html#speed_mode_0xb3>
).
Best regards
Mirko
-----Original-Nachricht-----
Betreff: [sumo-user] sumo vehicle speed
Datum: 2023-01-23T16:36:07+0100
Von: "Mahima" <mahim...@gmail.com>
An: "Sumo project User discussions" <sumo-user@eclipse.org>
Hi,
I want to move the vehicle to some edge.
I read speed, accel and position using these commands which give values of
the last timestep.
libsumo::Vehicle::getLanePosition(veh));
libsumo::Vehicle::getSpeed(veh));
libsumo::Vehicle::getAcceleration(veh)
And then I use the following commands in the current timestep so that I get
the desired position and speed in the next timestep.
libsumo::Vehicle::setPreviousSpeed(veh, speed, accel);
libsumo::Vehicle::moveTo(veh, cmd.lane_id(), lane_pos);
Then, I check the leader
double frontGapNeeded = libsumo::Vehicle::getSecureGap(veh, speed,
libsumo::Vehicle::getSpeed(leader.first),
libsumo::Vehicle::getDecel(leader.first));
double followSpeed=libsumo::Vehicle::getFollowSpeed(veh, speed,
frontGapNeeded, libsumo::Vehicle::getSpeed(leader.first),
libsumo::Vehicle::getDecel(leader.first), leader.first);
double frontMax = frontGapNeeded + (-leader.second);
double new_speed = std::min(speed, followSpeed);
double pos = std::min(lane_pos, frontMax);
Then, i set the vehicle speed as per the leader.
libsumo::Vehicle::slowDown(veh, followSpeed, 0);
But, I am not getting desired results. Is there any way to get speed in
the current timestep?
Thanks
_______________________________________________
sumo-user mailing list
sumo-user@eclipse.org
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user