Custom map loading
This pull request will try to implement loading of text files and loading this into the unreal engine environment without having to need Unreal engine.
This will allow us to create maps from rosbags and try and test our algorithms on them. It will also allow us to share these maps easily among the community.
Things to do:
- [x] Read in a file into unreal engine
- [x] Define format to store map data
- [x] Add cones to scene
- [x] Make custom start finish line for custom maps
- [x] Add field in menu to select specific map
- [x] Add documentation
Decisions:
- Car will always start in (0, 0) with the heading 0 degrees
As to the format for storing the map data, I know of at least 4 FS-AI teams using .csv files with this schema:
tag,x,y,direction,x_variance,y_variance,xy_covariance
blue,-45.0,1.5,0.0,0.01,0.01,0.0
yellow,20.0,-1.5,0.0,0.01,0.01,0.0
big_orange,25.0,-1.5,0.0,0.01,0.01,0.0
orange,30.0,1.5,0.0,0.01,0.01,0.0
car_start,-53.0,0.0,0.0,0.0,0.0,0.0
I think this is the schema that should be used. The variance and covariance fields can be ignored for now, as they are used for randomly moving cones a little to make the map more realistic (in that cones are never placed perfectly in real world)
@mateusz-lichota Thats maybe a good starting point then, thanks for the suggestion! My other idea was putting everything in a json file, as it easier to structure, but I will stick with the csv format for now.
Cones do not get added yet to referee, so I get some error, but I can change the positions of loaded blue and yellow cones
One thing about the track format: the x and y values in the csv are in metres, but Unreal Engine uses centimeters so the values need to be multiplied by 100.0 when loading a custom map
If backspace is used to reset the car, the rotation is reset to 0 degrees
The location and rotation of the car get overwritten by the location in settings.json. This data is loaded into the VehicleSettings class. Accessing this object makes unreal engine crash. Trying to change the pawn pose by accessing the SimModeBase object.
How about ignoring car_start and assuming it is always going to be (0, 0) with no rotation? It's fairly easy to translate the whole track to make car_start 0, and it would massively simplify implementation
Or better yet, remove the car_start from the track definition schema and just make it start at (0,0) always. Users will just have to supply tracks that are already translated. I wouldn't have a problem with that, and in fact, it is wise to take the car starting point to be the point (0, 0)
I was still trying with the SimModeBase, but didn't get it to work. Using (0, 0) seems the best choice for now indeed.
Reverted both commits regarding movement of the car
Currently I only do a rotation calculation if 2 big orange cones are used. Also, is it okay to assume that all maps loop back to the same point and thus have a start finish line and not a separate finish line like acceleration for instance?
I'd say it is reasonable to assume that every custom map will be a loop, because acceleration and skidpad are already predefined
I'll add some documentation explaining the format next week, and then this repo is ready to merge
It would also be cool to be able to select the map to be loaded with a command line argument, and skip the menu entirely. I've got a prototype of that implemented, and I'll make finish the work once this is merged
Added 4 big cones angle handling for the start/finish collision box. Will add documentation tomorrow.
I added some documentation and tried out the first track from some rosbag I found from my team. It still contains duplicate cones, so I probably will change the map some other day