mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
make sure bikes can actually start moving
This commit is contained in:
parent
2f812e6265
commit
177f639f7b
@ -78,7 +78,9 @@ impl Vehicle {
|
||||
vehicle_type: VehicleType::Bike,
|
||||
debug: false,
|
||||
// http://eprints.uwe.ac.uk/20767/ says mean 0.231
|
||||
max_accel: Acceleration::meters_per_second_squared(rng.gen_range(0.2, 0.3)),
|
||||
// TODO But it's too slow, bikes can't accelerate past a non-zeroish speed in 0.1s.
|
||||
// Workaround properly... perhaps with a continuous time approach.
|
||||
max_accel: Acceleration::meters_per_second_squared(rng.gen_range(1.1, 1.3)),
|
||||
// Much easier deaccel. Partly to avoid accel_to_stop_in_dist bugs with bikes running
|
||||
// stop signs.
|
||||
max_deaccel: Acceleration::meters_per_second_squared(rng.gen_range(-1.3, -1.2)),
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::runner::TestRunner;
|
||||
use geom::{Distance, Speed, EPSILON_DIST};
|
||||
use geom::{Acceleration, Distance, Speed, EPSILON_DIST};
|
||||
use sim::kinematics::{results_of_accel_for_one_tick, Vehicle};
|
||||
use sim::{Tick, TIMESTEP};
|
||||
|
||||
@ -59,6 +59,13 @@ pub fn run(t: &mut TestRunner) {
|
||||
Some(Tick::testonly_from_raw(35 + 1200 + 36000))
|
||||
);
|
||||
});
|
||||
|
||||
t.run_fast("min_accel_doesnt_round_to_zero", |_| {
|
||||
// Copied from kinematics.rs, for bikes.
|
||||
let min_accel = Acceleration::meters_per_second_squared(1.1);
|
||||
let speed = min_accel * TIMESTEP;
|
||||
assert!(!speed.is_zero(TIMESTEP));
|
||||
});
|
||||
}
|
||||
|
||||
// TODO Make sure speed never exceeds the vehicle's cap
|
||||
|
Loading…
Reference in New Issue
Block a user