georgeliu233 / Scene-Rep-Transformer

[T-IV] Augmenting Reinforcement Learning with Transformer-based Scene Representation Learning for Decision-making of Autonomous Driving
https://georgeliu233.github.io/Scene-Rep-Transformer/
53 stars 11 forks source link

error with smarts==0.4.18 #10

Open hu-hwb opened 1 month ago

hu-hwb commented 1 month ago

Traceback (most recent call last): File "test.py", line 142, in testing(args) File "test.py", line 131, in testing runner.evaluate_policy_continuously() File "../envs/runners/off_policy_trainer.py", line 610, in evaluate_policy_continuously res = self.evaluate_policy(total_steps=0,plot_map_mode=plot_map_mode) File "../envs/runners/off_policy_trainer.py", line 643, in evaluate_policy obs,ego,map_s = self.neighbor_obs(obs,test=True) File "../envs/runners/off_policy_trainer.py", line 190, in neighbor_obs n_obs = self.process_neighbors(neighbors_id,test) File "../envs/runners/off_policy_trainer.py", line 179, in process_neighbors self._test_smarts.attach_sensors_to_vehicles(self.test_neighbor_spec, ids) File "/home/hwb/miniconda3/envs/smart/lib/python3.7/site-packages/smarts/core/smarts.py", line 434, in attach_sensors_to_vehicles self, agent_spec.interface, vehicle_ids AttributeError: 'AgentInterface' object has no attribute 'interface'

hu-hwb commented 1 month ago

Modify File "/home/hwb/miniconda3/envs/smart/lib/python3.7/site-packages/smarts/core/smarts.py", line 434, in attach_sensors_to_vehicles self, agent_spec.interface, vehicle_ids with

def attach_sensors_to_vehicles(self, agent_spec, vehicle_ids): self._agent_manager.attach_sensors_to_vehicles( self, agent_spec, vehicle_ids )

The problem can be solved, but another problem raised: Traceback (most recent call last): File "test.py", line 142, in testing(args) File "test.py", line 131, in testing runner.evaluate_policy_continuously() File "../envs/runners/off_policy_trainer.py", line 610, in evaluate_policy_continuously res = self.evaluate_policy(total_steps=0,plot_map_mode=plot_map_mode) File "../envs/runners/off_policy_trainer.py", line 680, in evaluate_policy next_obs,next_ego,next_map_s = self.neighbor_obs(next_obs,test=True) File "../envs/runners/off_policy_trainer.py", line 190, in neighbor_obs n_obs = self.process_neighbors(neighbors_id,test) File "../envs/runners/off_policy_trainer.py", line 180, in processneighbors obs, , _, dones = self._test_smarts.observe_from(ids) File "/home/hwb/miniconda3/envs/smart/lib/python3.7/site-packages/smarts/core/smarts.py", line 439, in observe_from self, vehicle_ids, self._traffic_history_provider.done_this_step File "/home/hwb/miniconda3/envs/smart/lib/python3.7/site-packages/smarts/core/agent_manager.py", line 128, in observe_from sensor_state = sim.vehicle_index.sensor_state_for_vehicle_id(vehicle.id) File "/home/hwb/miniconda3/envs/smart/lib/python3.7/site-packages/smarts/core/vehicle_index.py", line 676, in sensor_state_for_vehicle_id return self._sensor_states[vehicle_id] KeyError: b'000000000000000$car_type_2-flow-route-edge-east-EW_1_random-edge-west-EW_1_max-8281130465786465659---5506117918186112495--3-1.0'