dividing a network into a grid of small cells in a SUMO scenario - sumo

Is there a way to divide an already- existing road network into a 2-D grid of equal sized cells?
I need to extract some information such as vehicle density, average speed,...etc. from each cell.
are there any libraries, tools, APIs or tutorials?
I am new to SUMO so any help would be appreciated.

The easiest way is probably to generate an fcd output (sumo --fcd-output) which gives coordinates for every vehicle and then aggregate the values in a simple script. Depending on the precision needed and the data volume you expect, you can also aggregate the output to edges (and to time intervals) in SUMO using the mean data output but then you will need to handle the case of edges which are in multiple cells yourself. There is some help in parsing a sumo network and sumo outputs in sumolib.

Related

Identify sinus behavior on a data stream

I want to identify when data values ordered as a sine waveform.
For example in the picture
Until now I have worked with features like STD, RMS etc, on the data to identify waveforms. Now I am looking for a feature which will have such functionality although I am opened for any ideas to achieve such identification.
You could, for example, compute the Fourier transform and see if it has a noticeable peak at one of the frequencies.

Calculating heading value in a quad copter

I'm building an autonomous quad copter I'm trying to move the quad to a target GPS co-ordinate, I'm calculating the distance of the target using haversine formula, and now I want to calculate the heading.
For example, I want the quad to turn to the direction of the target and move forward until it reaches the destination (this part is already done).
How do I calculate the yaw so that it turns to the direction of target?
Calculating it using only the GPS co-ordinates is very inaccurate. If I use a magnetometer, the declination angle changes from place to place.
How do I calculate this? How does ardu pilot do this calculation?
One way to develop control algorithms that deal with inaccurate measures is to combine different measures by some sort of filtering. In that sense, your set point reference is built based on both GPS and magnetometer measures.
There are several ways to accomplish this task. Many applications use data fusion based on Kalman Filters. The general idea is that you are going to use a predictor (or state observer) to achieve a better estimate of the heading. I suggest some research on these topics: data fusion, Kalman filtering.
Here is an example:
http://scholarscompass.vcu.edu/cgi/viewcontent.cgi?article=4188&context=etd

Regd. map grid structure in GPS data mining

I have been exploring the GPS data mining literature esp. for problems like anomalous trajectory detection, time travel prediction, etc and one very common method I see is dividing the data or map into grids. Can any one please explain the logic of this? Are the coordinates euclidean in this case? Is grid decomposition really necessary?
I would be grateful if someone can also give/ quote some links or materials I should explore. I am new to this field, so please pardon me if the question is very obvious.
Thanks & Regards,
Lesnar
No they are not euclidean. But they don't have to be. The grids are not rectangles anymore, but can be treated as such for some operations.
If you create a lat/long grid, then each cell by means of meters is not rectangular. However it defines a zone where you add a counter, which has a clear inside/outside definition. And you can use cartesian operations (Rectangle.inside())
So the lat / lon span is constant for each cell, but not the longitudinal meters span, which shrinks by cos(latitude).
If one needs a grid with equal grid cells sizes by means of meters, then one
has to transform the geo coordinates before.

Approximate and Interpolate GPS Trajectory

I have a sequence of gps values each containing: timestamp, latitude, longitude, n_sats, gps_speed, gps_direction, ... (some subset of NMEA data). I'm not sure of what quality the direction and speed values are. Further, I cannot expect the sequence to be evenly spaced w.r.t. the timestamp. I want to get a smooth trajectory at an even time step.
I've read the Kalman Filter is the tool of choice for such tasks. Is this indeed the case?
I've found some implementations of the Kalman Filter for Python:
http://www.scipy.org/Cookbook/KalmanFiltering
http://ascratchpad.blogspot.de/2010/03/kalman-filter-in-python.html
These however appear to assume regularly spaced data, i.e. iterations.
What would it take to integrate support of irregularly spaced observations?
One thing I could imagine is to repeat/adapt the prediction step to a time-based model. Can you recommend such a model for this application? Would it need to take into account the NMEA speed values?
Having looked all over for an understandable resource on Kalman filters, I'd highly recommend this one: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
To your particular question regarding irregularly spaced observations: Look at Chapter 8 in the reference above, and under the heading "Nonstationary Processes". To summarize, you'll need to use a different state transition function and process noise covariance for each iteration. Those are the only things you'll need to change at each iteration, since they're the only components dependent on delta t.
You could also try kinematic interpolation to see if the results fit to what you expect.
Here's a Python implementation of one of these algorithms: https://gist.github.com/talespaiva/128980e3608f9bc5083b

Algorithm for reducing GPS track data to discard redundant data?

We're building a GIS interface to display GPS track data, e.g. imagine the raw data set from a guy wandering around a neighborhood on a bike for an hour. A set of data like this with perhaps a new point recorded every 5 seconds, will be large and displaying it in a browser or a handheld device will be challenging. Also, displaying every single point is usually not necessary since a user can't visually resolve that much data anyway.
So for performance reasons we are looking for algorithms that are good at 'reducing' data like this so that the number of points being displayed is reduced significantly but in such a way that it doesn't risk data mis-interpretation. For example, if our fictional bike rider stops for a drink, we certainly don't want to draw 100 lat/lon points in a cluster around the 7-Eleven.
We are aware of clustering, which is good for when looking at a bunch of disconnected points, however what we need is something that applies to tracks as described above. Thanks.
A more scientific and perhaps more math heavy solution is to use the Ramer-Douglas-Peucker algorithm to generalize your path. I used it when I studied for my Master of Surveying so it's a proven thing. :-)
Giving your path and the minimum angle you can tolerate in your path, it simplifies the path by reducing the number of points.
Typically the best way of doing that is:
Determine the minimum number of screen pixels you want between GPS points displayed.
Determine the distance represented by each pixel in the current zoom level.
Multiply answer 1 by answer 2 to get the minimum distance between coordinates you want to display.
starting from the first coordinate in the journey path, read each next coordinate until you've reached the required minimum distance from the current point. Repeat.