Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] sumo vehicle speed

Hi Minko

Thanks for your reply.
I just want to get the speed and position in the current timestep and not the last timestep.
Is there any way?

Thanks 


On Tue, 24 Jan 2023, 10:45 m.barthauer@xxxxxxxxxxx, <m.barthauer@xxxxxxxxxxx> wrote:

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).

 

Best regards

Mirko

 

 

 

 

-----Original-Nachricht-----

Betreff: [sumo-user] sumo vehicle speed

Datum: 2023-01-23T16:36:07+0100

Von: "Mahima" <mahima13@xxxxxxxxx>

An: "Sumo project User discussions" <sumo-user@xxxxxxxxxxx>

 

 

 

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@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top