TUMFTM / GraphBasedLocalTrajectoryPlanner

Local trajectory planner based on a multilayer graph framework for autonomous race vehicles.
GNU Lesser General Public License v3.0
234 stars 54 forks source link

Can this be used in other environments beside race tracks? #5

Open enter802 opened 8 months ago

enter802 commented 8 months ago

I am trying to get this algorithm to work in regular traffic scenarios with much lower speed (50-80 km/h) than in the paper itself. So far, the algorithm, understandably, throws out warnings that vehicles are too close. However, the trajectory obtained at the end usually shows that the vehicle does not even move (zero velocities) in most cases, and in many cases it moves after waiting for a while and that too way slower than other methods i am testing against.

Is there anything I am doing wrong here? are there parameters you could suggest that can be played around with to fix this?

thanks for your time in advance.

StahlTim commented 7 months ago

Sorry for the late replay.

In general it is hard to debug without videos/scenario details.

One crucial thing to implement is the object prediction (only a very rudimentary / simple version is included in the repo). Further details (where to implement) can be found in the documentation. For city / traffic scenario this must definitely be designed/implemented I order to generate reasonable behavior.

enter802 commented 7 months ago

Here are the links to one of the scenarios I am trying to simulate with this algorithm: trajectories of the actors and the track

To get the trajectories:

import scipy
mat_data = scipy.io.loadmat('data_008.mat')    
trajectories = mat_data['trajectories']

The vehicle's initial states then can be assigned as follows:

EgoIdx = 0
pos_est = trajectories[0,0:2,EgoIdx] 
heading_est = trajectories[0,2,EgoIdx] - np.pi / 2
vel_est = trajectories[0,4,EgoIdx].item()
ltpl_obj.set_startpos(pos_est=pos_est,
                          heading_est=heading_est,
                          vel_est=vel_est)

For the prediction purpose, the assumption is that we have perfect measurements of future poses of the surrounding actors (obstacles). And I use this simple script to create the object list at each loop:

import numpy as np

def getObstacles(trajectories,k,EgoIdx):

    objList = []

    for n in range(trajectories.shape[2]):

        if n!=EgoIdx:
            x = trajectories[k,0,n].item()
            y = trajectories[k,1,n].item()
            theta = (trajectories[k,2,n] - np.pi / 2).item()
            v = trajectories[k,4,n].item()
            obj = {'X': x, 'Y': y, 'theta': theta, 'type': 'physical',
                   'id': n, 'length': 4.7, 'width': 1.8, 'v': v}

            objList.append(obj)

    return objList

where trajectories contain the future trajectories of the actors. In the standard example, you can simply replace line 106 with

obj_list = getObstacles(trajectories,k+1,EgoIdx) # k is a counter in the while loop

In the offline configuration file, I changed the following parameters

lon_straight_step=5.0
lon_curve_step=1.0
min_vel_race= 17.0
veh_width=1.8
veh_turn=1.0

Hope these help to give you an idea of the scenario itself. Please let me know if you require further information. Again, thank you for your time in advance.

StahlTim commented 7 months ago

Sounds reasonable so far (albeit I was not able to simulate the scenarios on my machine due to limited time).

Did you check the logs with the visualization tool? If there are very low velocities, there must be a reason for it. Is the planned path touching a wall or other vehicle? It should be quite insightful to visualize the logs.

Furthermore, a good prediction of other vehicles might still be a todo on the way to smooth multi vehicle interaction. For this topic, see the wiki , especially the "Note:" box starting with:

"In this published version, only a short constant velocity (CV) prediction (200ms) of other vehicles is implemented. In order to enable safe maneuvers, [...]"

enter802 commented 7 months ago

I did not check the logs with the visualization tool earlier. Now that I have checked, there seem to be no coinciding of the ego with the actors in terms of point mass, however, they are very close and sure would made a collision if they were to be presented using boxes.

I am attaching the csv file for your reference. I may be missing important aspects of the analysis. 14_52_33_data.csv

StahlTim commented 7 months ago

Now that I have checked, there seem to be no coinciding of the ego with the actors in terms of point mass, however, they are very close and sure would made a collision if they were to be presented using boxes.

Yes this might then cause an issue. The tool also allows to see velocity profiles for each point in time, together with the paths. Such that it should be easy to interpret the scene more deeply.

The attached file is sadly not enough to run the log visualization (there is other associated files, like a graph model). If you want, you could include one/multiple screenshots of interesting time steps in the log file that we can analyze further.