learn-to-race / l2r

Open-source reinforcement learning environment for autonomous racing — featured as a conference paper at ICCV 2021 and as the official challenge tracks at both SL4AD@ICML2022 and AI4AD@IJCAI2022. These are the L2R core libraries.
https://learn-to-race.org
GNU General Public License v2.0
142 stars 15 forks source link

Simulator loads car without sensors #4

Closed MatthewHowe closed 2 years ago

MatthewHowe commented 2 years ago

We have just got the simulator running and have begun trying to use this repo to interface with it. We are running run.bash -b 'random' with default YAML configs/params_random.yaml. We have come across some issues:

We have been trying to find where the car is set with no luck, only the file which configs/l2r_vehicle_conf.yaml, but it does not appear to be used in any code.

Maybe relevant information:

NOTE: We are able to get the random script to run if we change the vehicle in the sim to one with a camera (SimCamera90Front) and change the camera name in configs/params_random.yaml, however it then crashes with the following occasionally.

Output when we experience a simulator crash:

(l2r)  james@compact  ~/Documents/l2r/l2r   main ±  ./run.bash -b "random"
Starting simulator
sudo: unknown user: ubuntu
sudo: unable to initialise policy plugin
/home/james/miniconda3/envs/l2r/lib/python3.8/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
[SimulatorController] Setting level to Thruxton
[SimulatorController] Setting to RL mode for vehicle: 0
[SimulatorController] Enabling SimCamera90Front
{'jsonrpc': '2.0', 'error': {'code': -32602, 'message': "Protocol error, 'sensor_name' == 'SimCamera90Front' not found"}, 'id': 3}
Disconnected from simulator
(l2r)  james@compact  ~/Documents/l2r/l2r   main ±  ./run.bash -b "random"
Starting simulator
sudo: unknown user: ubuntu
sudo: unable to initialise policy plugin
/home/james/miniconda3/envs/l2r/lib/python3.8/site-packages/gym/spaces/box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(
[SimulatorController] Setting level to AngleseyNational
[SimulatorController] Setting to RL mode for vehicle: 0
{'jsonrpc': '2.0', 'params': {'veh_id': 0, 'sensor_name': 'ArrivalVehicleDriver', 'parameter_name': 'DriverAPIClass', 'value': 'VApiUdp'}, 'id': 2, 'method': 'set_sensor_param'}
Disconnected from simulator

Then with sim:

[2021.11.18-07.51.31:135][754]WebSocket: Error: JSON RPC: Protocol error, 'sensor_name' == 'SimCamera90Front' not found
[2021.11.18-07.51.31:217][763]WebSocket: Client ID 325 is disconnected
[2021.11.18-07.51.55:561][458]WebSocket: Client ID 325 is connected
[2021.11.18-07.51.55:586][460]LogNet: Browse: /Game/Ribbon/anglesey_national/anglesey_national
[2021.11.18-07.51.55:586][460]LogStreaming: Display: Flushing async loaders.
[2021.11.18-07.51.55:587][460]LogLoad: LoadMap: /Game/Ribbon/anglesey_national/anglesey_national
[2021.11.18-07.51.55:587][460]LogWorld: BeginTearingDown for /Game/Ribbon/thruxton/thruxton
[2021.11.18-07.51.55:588][460]LogArrival: Saved GameModeWrapper settings
[2021.11.18-07.51.55:588][460]WebSocket: Save JsonRpc settings to "../../../ArrivalSim/Saved/SaveGames/JsonRPC.json"
[2021.11.18-07.51.55:588][460]LogArrival: Save vehicle states: DefVehicle_Robocar_C
[2021.11.18-07.51.55:732][460]LogWorld: UWorld::CleanupWorld for thruxton, bSessionEnded=true, bCleanupResources=true
[2021.11.18-07.51.55:733][460]LogSlate: InvalidateAllWidgets triggered.  All widgets were invalidated
[2021.11.18-07.51.55:737][460]LogAudioMixer: Display: No commands were queued while flushing the source manager.
[2021.11.18-07.51.55:901][460]LogUObjectHash: Compacting FUObjectHashTables data took   2.12ms
[2021.11.18-07.51.56:518][460]LogAIModule: Creating AISystem for world anglesey_national
[2021.11.18-07.51.57:261][460]LogLoad: Game class is 'ArrivalGameMode_C'
[2021.11.18-07.51.57:268][460]LogWorld: Bringing World /Game/Ribbon/anglesey_national/anglesey_national.anglesey_national up for play (max tick rate 0) at 2021.11.18-18.21.57
[2021.11.18-07.51.57:280][460]LogArrival: UArrivalStatics::AddV2VComponentToAllVehiclesInLevel - no vehicles found
[2021.11.18-07.51.57:311][460]LogStreaming: Warning: Failed to read file '../../../ArrivalSim/Saved/SaveGames/MissionPlannerCommand.sav' error.
[2021.11.18-07.51.57:314][460]LogWorld: Bringing up level for play took: 0.051578
[2021.11.18-07.51.57:317][460]LogArrival: Vehicle load succeeded: DefVehicle_RobocarDefSensors_C
[2021.11.18-07.51.57:328][460]LogArrival: Start V2X Viwer on port: 3003, shift: X=0.000 Y=0.000 Z=0.000
[2021.11.18-07.51.57:329][460]LogArrival: Create UVApiUdp. SendAddress: 0.0.0.0:7078, RecvPort: 7077
[2021.11.18-07.51.57:329][460]ArrivalBlueprintLibrary: Arrival: Tagging Skeletal Actor: 10
[2021.11.18-07.51.57:330][460]LogLoad: Took 1.739873 seconds to LoadMap(/Game/Ribbon/anglesey_national/anglesey_national)
[2021.11.18-07.51.57:331][460]Five: Assigne new ego-vehicle; Vehicle ID: 10003
Assertion failed: DestStride >= Width * Channels * ChannelBytes [File:/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Plugins/UnrealArrival/Source/UnrealArrival/Private/Sensors/CameraSensor.cpp] [Line: 139] 

Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554 
CommonUnixCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=131119 
Malloc Size=410096 LargeMemoryPoolOffset=541232 
[2021.11.18-07.51.57:480][460]LogCore: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to write memory at address 0x0000000000000003

[2021.11.18-07.51.57:480][460]LogCore: Assertion failed: DestStride >= Width * Channels * ChannelBytes [File:/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Plugins/UnrealArrival/Source/UnrealArrival/Private/Sensors/CameraSensor.cpp] [Line: 139] 

0x00007fdf504e4076 libUE4-Core.so!FGenericPlatformMisc::RaiseException(unsigned int) [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMisc.cpp:477]
0x00007fdf506b6447 libUE4-Core.so!FOutputDevice::LogfImpl(char16_t const*, ...) [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/Misc/OutputDevice.cpp:71]
0x00007fdf50651336 libUE4-Core.so!AssertFailedImplV(char const*, char const*, int, char16_t const*, __va_list_tag*) [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/Misc/AssertionMacros.cpp:105]
0x00007fdf506511cb libUE4-Core.so!FDebug::CheckVerifyFailedImpl(char const*, char const*, int, char16_t const*, ...) [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/Misc/AssertionMacros.cpp:452]
0x00007fde51fbecd8 libUE4-UnrealArrival.so!FCameraAsyncTask::Tick() [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Plugins/UnrealArrival/Source/UnrealArrival/Private/Sensors/CameraSensor.cpp:139]
0x00007fde51f877cf libUE4-UnrealArrival.so!FArrivalAsyncTaskManager::Tick() [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Plugins/UnrealArrival/Source/UnrealArrival/Private/AsyncTaskManager.cpp:75]
0x00007fde51f873b7 libUE4-UnrealArrival.so!FArrivalAsyncTaskManager::Run() [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Plugins/UnrealArrival/Source/UnrealArrival/Private/AsyncTaskManager.cpp:21]
0x00007fdf505425c7 libUE4-Core.so!FRunnableThreadPThread::Run() [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25]
0x00007fdf5050e380 libUE4-Core.so!FRunnableThreadPThread::_ThreadProc(void*) [/home/gitlab-runner/UE4/UnrealEngine-4.24.3-release/Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:177]
0x00007fdf50ec7609 libpthread.so.0!UnknownFunction(0x9608)
0x00007fdf4c145293 libc.so.6!clone(+0x42)

[2021.11.18-07.51.57:491][460]LogExit: Executing StaticShutdownAfterError
Malloc Size=127198 LargeMemoryPoolOffset=668446 
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault (core dumped)
MatthewHowe commented 2 years ago

Vehicle configuration fix

As in this part of the configuration documentation the default car file is in this repo, but must be moved to ArrivalSim-linux-0.7.0.182276/LinuxNoEditor/Engine/Binaries/Linux/l2r_vehicle_conf.yaml. It may be a good idea to add this to instructions.txt.

Simulator crash fix

The instructions state to use the -opengl flag, however the package is deprecated and warns the user upon loading. When we removed this flag so that vulcan was used instead the sim would work for a period of time then crash as above. Keep the -opengl flag.

bluepy build fail

We also found that when using requirements.txt the bluepy package would fail to build wheel. This can be fixed by:

sudo apt-get install python3-pip libglib2.0-dev
sudo pip3 install bluepy