Keep a log of vehicle routes for animation purpose

Hi, I was doing a project to animate vehicle transportations on a road network. During the process, the vehicle will stay in a position for a certain time interval, travel to a certain location to pick up goods and then carry them to a specific delivery position. In order to do the animation, I need to keep a log of vehicle routes of the whole process. For example, staying in the same location for a certain time interval can be treated as a route with the starting location the same as the ending location. Doing this is really tedious, as I figured that I probably need to keep a log of the finishing route and the starting route each time. I was wondering, is there any other simpler way to do animation with? Any comments are greatly appreciated.

Maybe a bit quick and dirty:

Your animation will be a collection of pictures that you will change in some constant time intervals. You could define a matrix of vectors in which the columns represent a snapshot of the current animation time point of the state of the corresponding vehicle which is represented by each row. The elements of the matrix, i.e., the vectors, track the nodes visited by each vehicle at each time point.

1 Like

If I understand the question correctly, I would just keep track of each vehicle’s position in a Vector as a function of time. Then have a Vector of these Vectors with one for each vehicle.

This makes it easy to draw a snapshot at time t by indexing into each of the Vectors.

2 Likes

how do you choose the snapshot time points?

Ah do you have continuous time? In that case you can keep track of event times. In an animation usually you will show snapshots every delta t (which you can take as a parameter of the animation function).

Or am I not understanding the question?

1 Like

It’s a discrete event based simulation. I was thinking to create a file with four columns, i.e., startTime, startLoc, routePlaned, and vehicleStatus. Here, startLoc is a pair of latitude and longitude; routePlaned is a vector of latitude, longitude pairs. It is called routePlaned because the route of each vehicle might get changed later in case of some events happening. The endTime and endLoc of each row is the startTime and startLoc of the next row. After finishing this log file, can create the visualization based on frames.