PJLab-ADG / LimSim

LimSim & LimSim++: Integrated traffic and autonomous driving simulators with (M)LLM support
https://pjlab-adg.github.io/LimSim/
GNU General Public License v3.0
391 stars 31 forks source link

About ‘EGO_PLANNER’ and ‘USE_DECISION_MAKER’ #6

Closed lwkang closed 1 year ago

lwkang commented 1 year ago

Hello,

I am confused about how LimSim generates trajectories if maintaining ‘USE_DECISION_MAKER’ as 'False'? Since the planning module needs to know decision results from the decision-making module in advance so that it can generate trajectories successfully. Could you explain it in more details? Thanks!

Another thing, the following error will happen when ‘EGO_PLANNER’ and ‘USE_DECISION_MAKER’ are changed from 'False' into 'True':

Traceback (most recent call last): File "/home/caros/limsim/LimSim/ModelExample.py", line 83, in run_model(net_file, rou_file, ego_veh_id="61", carla_cosim=False) File "/home/caros/limsim/LimSim/ModelExample.py", line 70, in run_model trajectories = planner.plan( File "/home/caros/limsim/LimSim/trafficManager/traffic_manager.py", line 161, in plan ego_path = self.ego_planner.plan(vehicles[ego_id], observation, File "/home/caros/limsim/LimSim/trafficManager/planner/ego_vehicle_planner.py", line 49, in plan current_state = State(x=other_track[0].x, IndexError: list index out of range

zijinoier commented 1 year ago

Firstly, we appreciate your keen interest in LimSim!

First question

Regarding your first question about how LimSim generates trajectories when the USE_DECISION_MAKER is set to False:

It's important to note that while the decision-maker can provide decisions to the planning module, the planner itself doesn't necessarily rely on decisions from the decision-maker. This means that the planner within LimSim is fully capable of generating trajectories even without receiving decisions.

For more technical details, you can take a look at the generate_trajectory function in trafficManager/planner/multi_vehicle_planner.py. Inside this function, you'll encounter sections of code like:

path = None
if config["USE_DECISION_MAKER"] and decision_list is not None:
    path = traj_generator.decision_trajectory_generator(
        vehicle, lanes, obs_list, config, T, decision_list,
    )
    if path is None:
        logging.info("Failed to plan DECISION KL path for vehicle %s; falling back to normal planner", vehicle.id)
if path is None:
    path = traj_generator.lanekeeping_trajectory_generator(
        vehicle, lanes, obs_list, config, T
    )

Here, the decision_trajectory_generator function is responsible for generating trajectories based on decisions, while functions like lanekeeping_trajectory_generator generate trajectories without decisions.

Second question

Moving on to your second question regarding an error that occurs when switching both EGO_PLANNER and USE_DECISION_MAKER to True:

Thank you for your testing efforts! We acknowledge the bug you encountered, and we're pleased to inform you that the latest commit 7932dc1e935c63b2e100decb1280ca4a2a47bc12 addresses this issue. If you pull the most recent version of the repository, you can expect the bug to be resolved.

It's also important to note that, the ego decision-maker is not yet implemented. Within the trafficManager/decision_maker/mcts_decision_maker.py module, you'll notice the EgoDecisionMaker class remains unimplemented. That is to say, the ego_planner currently generates trajectories without relying on decision results.

If you're enthusiastic about this topic, we warmly welcome you to take the initiative and implement the ego decision-maker. Feel free to submit a pull request with your contributions!

Should you have any further questions or inquiries, please don't hesitate to reach out.