Skip to content

Commit

Permalink
Merged v5.5.4
Browse files Browse the repository at this point in the history
Merge commit '54ab5373cf9b883f1d791182f218c33a2b5bd22b' into develop-ultimaterides-buildmain-integration

* commit '54ab5373cf9b883f1d791182f218c33a2b5bd22b': (23 commits)
  Fix tests - backported changes need old namespace.
  Update changelog and version for 5.5.4
  fix emitting invalid turn types, now surfacing due to changes in obvious detection
  Changelog Item for Project-OSRM#3561
  Added missing backward_speed for cycleways
  cherry-pick Project-OSRM#3555
  Fix possible division by zero by clamping latitude to 85.05°
  Adjusted number of `nodes` in `annotation`, resolves Project-OSRM#3515
  Update version and CHANGELOG for 5.5.3.
  Backport NumLanesToTheRight/NumLanesToTheLeft to support 6ea9f9f
  fix coordinate assertion for walking profile with steps
  Remove assertions that could be triggered by bad data. (Project-OSRM#3469)
  Make a hard reset of named barrier mutexes on signal
  Fix copying vector on std::sort comparator (Project-OSRM#3504)
  Consider number of lanes to cross, resolves Project-OSRM#3025.
  Make Travis buildit.
  Update changelog and version.
  Revert "Smarter search radius formula for map matching"
  Revert "Fix capture"
  Revert "Hardcode search radius parameters"
  ...
  • Loading branch information
raymond0 committed Feb 24, 2017
2 parents 568e180 + 54ab537 commit ada276b
Show file tree
Hide file tree
Showing 28 changed files with 511 additions and 116 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ notifications:
branches:
only:
- master
- 5.5

cache:
ccache: true
Expand Down
30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# 5.5.4
- Changes from 5.5.3
- Bugfixes
- PR #3561 - added missing backwards speeds for cycleways in bicycle profile
- PR #3515 - adjusted number of `nodes` in `annotation`
- Ticket #3430 - Fix possible division by zero by clamping latitude to +/- 85.05
- PR #3555 - Fix an error that occurs when a road forks immediately after exiting a ferry
- PR #3575 - Don't emit invalid turn types for obvious turns at sliproads and roundabouts.

# 5.5.3
- Changes from 5.5.2
- Bugfixes:
- PR #3504 - debug tiles were very slow to generate due to unnecessarily copying data in a hot loop.
- PR #3556 - fix an assertion in the walking profile triggered by tight spiral stairwells
- PR #3469 - don't assert when identical coordinates are supplied to some calculations - OSM data contains these, we shouldn't crash.
- Enhancements:
- backported 6ea9f9fdf19 - when anticipating upcoming lanes, consider how many lanes need to be crossed to get there.
- when using osrm-datastore, it will attempt to clean up locks if it crashes.

# 5.5.2
- Changes from 5.5.1
- Revert smarter map-matching search radius. The increased radius causes performance degredation when map-matching against non-car road networks with more edges.

# 5.5.1
- Changes from 5.5.0
- Bugfixes
- Fixes #3455 where a deadlock could occur if re-loading new data under heavy load with multiple consumers osrm-datastore

# 5.5.0
- Changes from 5.4.0
- API:
Expand Down Expand Up @@ -377,5 +405,3 @@
- `properties.use_turn_restrictions`
- `properties.u_turn_penalty`
- `properties.allow_u_turn_at_via`


2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endif()
project(OSRM C CXX)
set(OSRM_VERSION_MAJOR 5)
set(OSRM_VERSION_MINOR 5)
set(OSRM_VERSION_PATCH 0)
set(OSRM_VERSION_PATCH 4)
set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}")

add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
35 changes: 35 additions & 0 deletions features/guidance/anticipate-lanes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -783,3 +783,38 @@ Feature: Turn Lane Guidance
| waypoints | route | turns | lanes |
| a,f | start,first,second,third,fourth,fourth | depart,turn left,turn left,turn left,turn right,arrive | ,left:false left:true none:false none:false,left:false left:true none:false none:false,left:false left:true none:false none:false,left:false left:false right:true, |
| a,g | start,first,second,third,fourth,fourth | depart,turn left,turn left,turn left,turn left,arrive | ,left:true left:true none:false none:false,left:true left:true none:false none:false,left:true left:true none:false none:false,left:true left:true right:false, |

@anticipate
Scenario: Complex lane scenarios scale threshold for triggering Lane Anticipation
Given the node map
"""
a – b – x
|
|
|
|
|
|
|
|
|
|
c
|
e – d – y
"""
# With a grid size of 20m the duration is ~20s but our default threshold for Lane Anticipation is 15s.
# The additional lanes left and right of the turn scale the threshold up so that Lane Anticipation still triggers.

And the ways
| nodes | turn:lanes:forward | name |
| ab | through\|through\|right\|right | MySt |
| bx | | XSt |
| bc | | MySt |
| cd | left\|right | MySt |
| de | | MySt |
| dy | | YSt |

When I route I should get
| waypoints | route | turns | lanes |
| a,e | MySt,MySt,MySt,MySt | depart,continue right,turn right,arrive | ,straight:false straight:false right:false right:true,left:false right:true, |
37 changes: 37 additions & 0 deletions features/guidance/dedicated-turn-roads.feature
Original file line number Diff line number Diff line change
Expand Up @@ -782,3 +782,40 @@ Feature: Slipways and Dedicated Turn Lanes
When I route I should get
| waypoints | route | turns |
| s,g | main,sliproad,another,another | depart,turn right,turn left,arrive |

Scenario: Sliproad before a roundabout
Given the node map
"""
e
a - b - - c - d
'f|l'
m
g
|
.h-_
k - i |
'.j.'
"""

And the ways
| nodes | junction | oneway | highway | name |
| ab | | yes | primary | road |
| bc | | yes | primary | road |
| cd | | yes | primary | road |
| ec | | yes | secondary | |
| cm | | yes | secondary | |
| mg | | yes | primary | |
| gh | | no | primary | |
| hijh | roundabout | yes | primary | |
| ik | | yes | primary | |
| bfm | | yes | primary | |
| gld | | yes | primary | |

And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | bc | cd | c | only_straight |

When I route I should get
| waypoints | route | turns | locations |
| a,k | road,,, | depart,continue right,roundabout turn right exit-1,arrive | a,b,h,k |
57 changes: 57 additions & 0 deletions features/guidance/turn-angles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1260,3 +1260,60 @@ Feature: Simple Turns
When I route I should get
| waypoints | route | intersections |
| a,g | ab,bcdefgh,bcdefgh | true:90;true:45 false:180 false:270;true:180 |

#https://github.com/Project-OSRM/osrm-backend/pull/3469#issuecomment-270806580
Scenario: Oszillating Lower Priority Road
#Given the node map
# """
# a -db c
# f
# """
Given the node locations
| node | lat | lon | # |
| a | 1.0 | 1.0 | |
| b | 1.0000179813587253 | 1.0 | |
| c | 1.0000204580571323 | 1.0 | |
| d | 1.0000179813587253 | 1.0 | same as b |
| f | 1.0000179813587253 | 1.0000179813587253 | |

And the ways
| nodes | oneway | lanes | highway |
| ab | yes | 1 | primary |
| bf | yes | 1 | primary |
| bcd | yes | 1 | service |

# we don't care for turn instructions, this is a coordinate extraction bug check
When I route I should get
| waypoints | route |
| a,d | ab,ab |

Scenario: Sharp Turn Onto A Bridge
Given the node map
"""
e
|
|
|
|
|
|
|
|
|
|
|
|
|
g a - - -b
f /
d -c
"""

And the ways
| nodes | oneway | lanes |
| gaf | yes | 1 |
| abcde | yes | 1 |

When I route I should get
| waypoints | route |
| g,e | abcde,abcde |
18 changes: 11 additions & 7 deletions include/engine/datafacade/shared_memory_datafacade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,33 @@ class SharedMemoryDataFacade : public ContiguousInternalMemoryDataFacadeBase
// used anymore. We crash hard here if something goes wrong (noexcept).
virtual ~SharedMemoryDataFacade() noexcept
{
// Now check if this is still the newest dataset
boost::interprocess::sharable_lock<boost::interprocess::named_upgradable_mutex>
current_regions_lock(shared_barriers->current_regions_mutex,
boost::interprocess::defer_lock);

boost::interprocess::scoped_lock<boost::interprocess::named_sharable_mutex> exclusive_lock(
data_region == storage::DATA_1 ? shared_barriers->regions_1_mutex
: shared_barriers->regions_2_mutex,
boost::interprocess::defer_lock);

// if this returns false this is still in use
if (exclusive_lock.try_lock())
if (current_regions_lock.try_lock() && exclusive_lock.try_lock())
{
if (storage::SharedMemory::RegionExists(data_region))
{
BOOST_ASSERT(storage::SharedMemory::RegionExists(layout_region));

// Now check if this is still the newest dataset
const boost::interprocess::sharable_lock<boost::interprocess::named_upgradable_mutex>
lock(shared_barriers->current_regions_mutex);

auto shared_regions = storage::makeSharedMemory(storage::CURRENT_REGIONS);
const auto current_timestamp =
static_cast<const storage::SharedDataTimestamp *>(shared_regions->Ptr());

if (current_timestamp->timestamp == shared_timestamp)
// check if the memory region referenced by this facade needs cleanup
if (current_timestamp->data == data_region)
{
util::Log(logDEBUG) << "Retaining data with shared timestamp " << shared_timestamp;
BOOST_ASSERT(current_timestamp->layout == layout_region);
util::Log(logDEBUG) << "Retaining data with shared timestamp "
<< shared_timestamp;
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion include/extractor/guidance/coordinate_extractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class CoordinateExtractor
/* Find a interpolated coordinate a long the compressed geometries. The desired coordinate
* should be in a certain distance. This method is dedicated to find representative coordinates
* at turns.
* Since we are computing the length of the segment anyhow, we also return it.
* Note: The segment between intersection and turn coordinate can be zero, if the OSM modelling
* is unfortunate. See https://github.com/Project-OSRM/osrm-backend/issues/3470
*/
OSRM_ATTR_WARN_UNUSED
util::Coordinate GetCoordinateAlongRoad(const NodeID intersection_node,
Expand Down
8 changes: 8 additions & 0 deletions include/extractor/guidance/intersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ struct IntersectionShapeData
};

inline auto makeCompareShapeDataByBearing(const double base_bearing)
{
return [base_bearing](const auto &lhs, const auto &rhs) {
return util::angularDeviation(base_bearing, lhs.bearing) <
util::angularDeviation(base_bearing, rhs.bearing);
};
}

inline auto makeCompareShapeDataAngleToBearing(const double base_bearing)
{
return [base_bearing](const auto &lhs, const auto &rhs) {
return util::angleBetweenBearings(base_bearing, lhs.bearing) <
Expand Down
1 change: 1 addition & 0 deletions include/util/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ inline void print(const engine::guidance::RouteStep &step)
<< " "
<< " Duration: " << step.duration << " Distance: " << step.distance
<< " Geometry: " << step.geometry_begin << " " << step.geometry_end
<< " Exit: " << step.maneuver.exit << " Mode: " << (int)step.mode
<< "\n\tIntersections: " << step.intersections.size() << " [";

for (const auto &intersection : step.intersections)
Expand Down
37 changes: 18 additions & 19 deletions include/util/web_mercator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const constexpr double EARTH_RADIUS_WGS84 = 6378137.0;
// earth circumference devided by 2
const constexpr double MAXEXTENT = EARTH_RADIUS_WGS84 * boost::math::constants::pi<double>();
// ^ math functions are not constexpr since they have side-effects (setting errno) :(
const constexpr double MAX_LATITUDE = 85.;
const constexpr double EPSG3857_MAX_LATITUDE = 85.051128779806592378; // 90(4*atan(exp(pi))/pi-1)
const constexpr double MAX_LONGITUDE = 180.0;
}

Expand All @@ -29,6 +29,18 @@ const constexpr double DEGREE_TO_PX = detail::MAXEXTENT / 180.0;
// This is the global default tile size for all Mapbox Vector Tiles
const constexpr double TILE_SIZE = 256.0;

inline FloatLatitude clamp(const FloatLatitude lat)
{
return std::max(std::min(lat, FloatLatitude{detail::EPSG3857_MAX_LATITUDE}),
FloatLatitude{-detail::EPSG3857_MAX_LATITUDE});
}

inline FloatLongitude clamp(const FloatLongitude lon)
{
return std::max(std::min(lon, FloatLongitude{detail::MAX_LONGITUDE}),
FloatLongitude{-detail::MAX_LONGITUDE});
}

inline FloatLatitude yToLat(const double y)
{
const auto clamped_y = std::max(-180., std::min(180., y));
Expand All @@ -41,10 +53,9 @@ inline FloatLatitude yToLat(const double y)
inline double latToY(const FloatLatitude latitude)
{
// apparently this is the (faster) version of the canonical log(tan()) version
const double f = std::sin(detail::DEGREE_TO_RAD * static_cast<double>(latitude));
const double y = detail::RAD_TO_DEGREE * 0.5 * std::log((1 + f) / (1 - f));
const auto clamped_y = std::max(-180., std::min(180., y));
return clamped_y;
const auto clamped_latitude = clamp(latitude);
const double f = std::sin(detail::DEGREE_TO_RAD * static_cast<double>(clamped_latitude));
return detail::RAD_TO_DEGREE * 0.5 * std::log((1 + f) / (1 - f));
}

template <typename T> constexpr double horner(double, T an) { return an; }
Expand Down Expand Up @@ -91,18 +102,6 @@ inline double latToYapprox(const FloatLatitude latitude)
-3.23083224835967391884404730e-28);
}

inline FloatLatitude clamp(const FloatLatitude lat)
{
return std::max(std::min(lat, FloatLatitude{detail::MAX_LATITUDE}),
FloatLatitude{-detail::MAX_LATITUDE});
}

inline FloatLongitude clamp(const FloatLongitude lon)
{
return std::max(std::min(lon, FloatLongitude{detail::MAX_LONGITUDE}),
FloatLongitude{-detail::MAX_LONGITUDE});
}

inline void pixelToDegree(const double shift, double &x, double &y)
{
const double b = shift / 2.0;
Expand Down Expand Up @@ -166,9 +165,9 @@ inline void xyzToMercator(
xyzToWGS84(x, y, z, minx, miny, maxx, maxy);

minx = static_cast<double>(clamp(util::FloatLongitude{minx})) * DEGREE_TO_PX;
miny = latToY(clamp(util::FloatLatitude{miny})) * DEGREE_TO_PX;
miny = latToY(util::FloatLatitude{miny}) * DEGREE_TO_PX;
maxx = static_cast<double>(clamp(util::FloatLongitude{maxx})) * DEGREE_TO_PX;
maxy = latToY(clamp(util::FloatLatitude{maxy})) * DEGREE_TO_PX;
maxy = latToY(util::FloatLatitude{maxy}) * DEGREE_TO_PX;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions profiles/bicycle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,13 @@ function way_function (way, result)
-- cycleways
if cycleway and cycleway_tags[cycleway] then
result.forward_speed = bicycle_speeds["cycleway"]
result.backward_speed = bicycle_speeds["cycleway"]
elseif cycleway_left and cycleway_tags[cycleway_left] then
result.forward_speed = bicycle_speeds["cycleway"]
result.backward_speed = bicycle_speeds["cycleway"]
elseif cycleway_right and cycleway_tags[cycleway_right] then
result.forward_speed = bicycle_speeds["cycleway"]
result.backward_speed = bicycle_speeds["cycleway"]
end

-- dismount
Expand Down
Loading

0 comments on commit ada276b

Please sign in to comment.