Navigation: rerouting off the route (30 m for 3 fixes, HDOP ≤ 5, every 15 s at most) from the position to the points not reached yet; lanes as SVG arrows, the ones to take bold; dashboard background see-through with a slider; the GNSS simulation starts at a random place in the offline countries, the map jumping there
This commit is contained in:
1 parent
fbccb2acc9
commit
5f4c7c6ee8
9 files changed
+176
-35
No files matched your search
@@ -21,4 +21,24 @@ class GnssSimTest < Minitest::Test
|
||||
assert fixes.each_cons(2).all? { |a, b| b[:lat] >= a[:lat] } # never backwards
|
||||
assert_in_delta (1000 / (36 / 3.6) / 2 + 500 / (45 / 3.6)) / Maptool::GnssSim::TICK_S, fixes.size, 3 # a fix every TICK_S
|
||||
end
|
||||
|
||||
# No road at the first random place: another one, inside the bbox.
|
||||
class FirstPlaceAtSea < Maptool::GnssSim
|
||||
attr_reader :tried
|
||||
|
||||
def random_route(position)
|
||||
(@tried ||= []) << position
|
||||
raise Maptool::Routing::RouteError, "no road" if @tried.size == 1
|
||||
|
||||
{ geometry: { coordinates: [position, position] }, properties: {} }
|
||||
end
|
||||
end
|
||||
|
||||
def test_a_random_start_is_inside_an_offline_country_with_a_road
|
||||
sim = FirstPlaceAtSea.new("http://valhalla", random: Random.new(3))
|
||||
position, route = sim.random_start([[17.0, 48.0, 18.0, 49.0]])
|
||||
assert_equal 2, sim.tried.size
|
||||
assert position[0].between?(17.0, 18.0) && position[1].between?(48.0, 49.0)
|
||||
assert_equal position, route[:geometry][:coordinates].first
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user