telenav / osrm-backend Goto Github PK
View Code? Open in Web Editor NEWThis project forked from project-osrm/osrm-backend
Open Source Routing Machine - C++ backend
Home Page: http://map.project-osrm.org
License: BSD 2-Clause "Simplified" License
This project forked from project-osrm/osrm-backend
Open Source Routing Machine - C++ backend
Home Page: http://map.project-osrm.org
License: BSD 2-Clause "Simplified" License
Need at least two dockers:
osrm-backend-dev
docker image: include all dependency to compile and debug osrm-backend
;osrm-backend
docker image: include built binaries for run, e.g. compile mapdata, run osrm-routed
, etc.OSM data represent oneway using from node -> to node + oneway=yes
Professional data doesn't reverse this and using "to node-> from node" + oneway=-1 to represent oneway.
Per our usage, osrm-traffic-updater
have command line parameters to decide whether use all live traffic or blocking-only(flows with speed near 0 and blocking incidents) live traffic.
If only use blocking-only live traffic, then the calculated routes will not include ways can NOT be passed due to traffic.
List of issues while calling extraction with internal pbf
For next step, please go to: #6
Recently we use golang
implements some tools for our osrm-backend intergration, mostly for live traffic integration.
For the golang
project layout, we already have figured out it by #66.
But for where we put the golang
codes, we should discuss it for long-term.
Currently our golang
code almost only have live traffic integration related stuff, so we put them under folder osrm-backend/traffic_updater
. But we possibly have more and more tools, proxy services or osrm API implements by golang
, so we should to figure out a long-term solution for this.
I have several proposals:
osrm-backend/integration
instead of current osrm-backend/traffic_updater
, put all other osrm integration related golang
codes inside it.osrm-integration
under Telenav
, put all golang
codes inside.I'll prefer option 1 for now. May be we can go with option 2 in the future if the project is too bigger.
@CodeBear801 how's your opinion? any better idea or better name?
I'd like to implement it after #66.
DataFacadeBase, DataFacadeAlgorithm
Recently we met many issue that due to unstable traffic-proxy
.
We should mock traffic-proxy
in our test code, that we possible to run post progress without a real traffic-proxy
.
DataFacadeProvider, ContinuousBlobAllocator, Storage
More information please go to here: #56
Refer to suggestion: Project-OSRM#5503 (comment), we're going to have a try with --mmap
to shorten the initialization time by osrm-routed
.
Currently container logs only write to console, but it's not good for log collection and monitoring system.
For overall architecture, please go to design doc
For background, please go to summary of #22 and here
For subtask of partial customize cells, go to #49
For subtask of optimize intermediate file of <way, nodeids> mapping table, go to #31
Statistics not only process time, but also data count/size.Now we already have got flows count: 16130303, time used: 12.398055 seconds
, but still need more.
E.g.
traffic flows
in the generated flows mapwayid-nodeids
loadedtraffic flows
have been touched
fromnode,tonode,speed
generatedIt will be helpful for trace/debug if we can easy to know which engine and which data of the running service. Hopefully OSRM already provide the -d
flag by osrm-extract
. We use PBF file name instead of timestamp of OSM since we also need it for internal PBF.
Current go
version is 1.12.5
, expect to 1.13
.
We'll go with option 1 from the discussion: #77
make a subfolder osrm-backend/integration instead of current osrm-backend/traffic_updater, put all other osrm integration related golang codes inside it.
[optional]
blocking incidents only.
We want to use ElasticSearch to collect OSRM's logs and Kibana for visualize result.
Tasks(more could coming later)
For current routed_startup
,
osrm-backend/docker-orchestration/osrm-backend/docker-entrypoint.sh
Lines 11 to 24 in 147b6e5
pull traffic, osrm-customize
are MUST steps. But sometimes we may hope to startup the osrm-routed
directly without traffic update, mostly for debug. const auto flipped = [](auto fn) {
return [fn](auto &&lhs, auto &&rhs) {
return fn(std::forward<decltype(lhs)>(rhs), std::forward<decltype(rhs)>(lhs));
};
};
Q: why not
fn(std::forward<decltype(rhs)>(rhs), std::forward<decltype(lhs)>(lhs))
Is it due to the use of reverse_iterator?
MatchParameters param2(true, true, std::move(waypoints),{});
// C++ could accept MatchParameters param2(true, true, std::move(waypoints)), which means nothing for std::forward<Args>(args_)..., but if using empty array_list{}, seems C++ could not deduce correct type, is that due to based on {} we could not deduce T in vector<T>?
Issue description:
Getting data from traffic server and run customization we got such result:
[info] Loaded /Users/xunliu/Desktop/data/us_here_nv/traffic.csv with 6727490values
[info] In total loaded 1 file(s) with a total of 6727236 unique value
[info] Used 4220514 speeds from LUA profile or input map
[info] Used 0 speeds from /Users/xunliu/Desktop/data/us_here_nv/traffic.csv
[info] Updating segment data took 195.301ms.
[info] In total loaded 0 file(s) with a total of 0 unique values
[info] Done reading edges in 2609.77ms.
...
Which means value from traffic.csv isn't match with OSRM.
Summary:
Issue is due to traffic component dropped original pbf's node id, so additional mapping need to be applied.
A quick solution is: traffic component pass mapping of <wayid, speedmapping>, but preprocessing pbf we generate mapping of <wayid, nodeids>, and by another program we will convert traffic result to <from_node_id, to_node_id, speed> which is expected by OSRM customization.
Current performance benchmark is: getting traffic data from traffic service takes about 20 seconds, then will need another 70 seconds to generate csv file for OSRM.
We continue integration with this version but start several other issue to optimize the performance.
If delta traffic only affects several cells, we can speed up the customize process by only process this affected cells.
Time: 0529109
Meeting memo
Why OSRM
#1. OSRM provide API for all backend service, such as direction, tile, map matching
#2. Experience to enhance streaming map
Targets
#1. OSRM + HERE Traffic + OSM. 6/30 POC server. Jay/ Yang Chen (around 6/30, 50%)
#2. OSRM + HERE data + HERE traffic (Perry) 6/30
OSRM comoile NA HERE PBF
(todo: EU/CN, merge code to telenav-master)
#3. OSRM deoployment with docker + K8S. (Jay)
#4. evaluation vs ngx
Reference:
There's a great (but long) paper on this topic to be found here:
http://algo2.iti.kit.edu/documents/Dissertation_Kobitzsch_Moritz.pdf
(Chapter 5 gets into the meat of current approaches for alternative path finding).
I saw it from Project-OSRM#5581.
Let's read it to see whether it can improve our alternatives algorithm or help us to tune OSRM alternatives better.
Also, there're some parameters for OSRM alternatives may be helpful for us.
After get traffic for a whole region once, it's possible to get delta traffic data after that, then we possible to get very small traffic data set. It will be very useful if we can also support partial customize.
Import professional vender's pbf crashes during preprocessing. Need to fix this issue to set up OSRM server internally.
We need to generate <wayid, nodeids> mapping table to enable Telenav traffic for OSRM. More background could go to #22.
This table will be used to generate speed.csv each several minutes and be used for OSRM customization. The initial version takes about 70~80 seconds to iterate all the table and about 10GB's memory.
Our target is optimize time cost for dealing this file.
[Description]
[Delivery]
The docker image build and compile data process should be automation tools which easy to use.
Generating statistics and comparing with existing Telenav engine's output.
As we discussed in #63 (comment), the original idea comes from Refer to Project-OSRM#4449 (comment)
- Make time-independent route requests potentially with the
alternatives=n
MLD parameter- Use the
annotations
feature for osm node ids, speed and weight on route segments for all routes- Make time-dependent query on the intersection of all segments, use weight for optimization
In our design, at the begginning, we can name it as Phase 1:
We have to estimate whether the alternatives can returns good enough routes(the routes should not look similar but have significant differences).
Phase 2
In step 3, we may possible to construct a subgraph based on these alternatives since we can have all nodes,weights
, then do Dijkstra on it to get better route. That's the better way mentioned in paper(https://arxiv.org/pdf/1606.06636.pdf) , and there're a lot of discussion in Project-OSRM#5503
I'll prefer to set goreturns
or goimports
as default code format tool in our vscode to automatically format our codes.
Reference:
#1. Issue description
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
terminate called after throwing an instance of 'osrm::util::exception'
what(): CSV file ../osrm-data/traffic.csv malformed on line 1:
13396984,27077922,25.277778
include/updater/csv_file_parser.hpp:120include/updater/csv_file_parser.hpp:85
Aborted (core dumped)
#2. Issue description
TBB Warning: Exact exception propagation is requested by application but the linked library is built without support for it
terminate called after throwing an instance of 'osrm::util::exception'
what(): CSV file ../osrm-data/traffic.csv malformed on line 6727408:
33699965,33699966,
[Description]
Confirm the direction could work. Verify the result of customization and frequency of live traffic update based on small data provided by traffic team.
[Delivery]
[Description]
OSRM use "duration" for ferry/shuttle_train's travel time, which might be helpful if:
Here is the description for duration:
https://wiki.openstreetmap.org/wiki/Key:duration
Here is the doc for OSRM logic:
https://github.com/Telenav/open-source-spec/blob/master/osrm/doc/weight_and_duration_calculation_in_osrm.md
By the draft design OSRM with Telenav Traffic Design (Draft), we hope to use timed blue/green deploy by Kubernetes to support live traffic update without any service breakup.
In the test there're several issues occurred:
pull latest traffic and dump to traffic.csv file
, osrm-customize
, osrm-routed
) totally need about more than 15 minutes for North America.
blue/green
deploy will terminate old container once new container running. But it needs about 15 minutes from the new container running to the new container service ready as above, the service will be unavailable in this 15 minutes.
OSRM route quality depend on its cost model, we need to identify automatic and useful strategy to evaluate cost model.
OSRM route service do have some data in response. With parameter &annotations=true, you can see nodes, distance, duration, datasources, weight, speed in response.
See details in https://github.com/Telenav/osrm-backend/blob/master-telenav/docs/http.md#route-service
Telenav internal tools
We convert OSRM response to Telenav's response, so which could connect to our internal tools.
Collect ideas from discussion
OSRM use CRP to deal with live traffic, but historical speed is one of important features to support better route result. Live traffic make sense for the area near start point, but when expand road graph outside for 1 hour, historical speed play more and more important role.
More Info
Project-OSRM#5503
Time dependent routing
int GetSpeed(const EdgeId& id, const Time& t)
Refer to Project-OSRM#4449 (comment)
- Make time-independent route requests potentially with the
alternatives=n
MLD parameter- Use the
annotations
feature for osm node ids, speed and weight on route segments for all routes- Make time-dependent query on the intersection of all segments, use weight for optimization
Issue description:Initialization failed with professional data. Following errors appeared in docker logs:
[warn] Missing/Broken File: /osrm-data/NA.osrm.datasource_names
[error] Required files are missing, cannot continue
Root cause
The file datasource_names hasn't been generated, the step of customization must be called if you want to route with MLD
There're some best practices for Go
project layout from industry. The most important part of the Go
project layout is how to organize Go
packages.
I have summried them here: go-project-layout
In this task, I'd like to refactor our Go
packages layout by:
/cmd
top dir conventionThis task will after #51 since there'll be many Go
code changes in that one.
There's even no vi/vim
in the packaged docker image.
It's better to let our docker to easy to use and easy to debug for better efficiency since our team is not quite big for now.
[Delivery] Solutions and estimations
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.