$ sudo apt-get install ros-melodic-map-server ros-melodic-dwa-local-planner libompl-dev
$ sudo apt-get install ros-melodic-grid-map
$ pip install pathlib
$ pip install tqdm
$ sudo apt-get update
$ cd ~/catkin_ws/src
$ git clone https://github.com/TheGrycek/mapr_project.git
$ cd ~/catkin_ws/
$ catkin_make_isolated
$ source devel_isolated/setup.bash
Run map:
$ roslaunch mapr_project mapr_project.launch
Run map with path drawing:
$ roslaunch mapr_project mapr_project_ompl.launch
Based on the information from the ANYbotics (https://github.com/ANYbotics/grid_map) repository, script for generating 64x64 pixels elevation map was created. Subsequently, map was saved to the rosbag file.
The script subscribes the elevation map from launched rosbag and draws two points on its surface - start and end point. Implemented restrictions enforces, distance between tossed points, to be greater than 10 pixsels. Next those points are published into the ros topic.
For path finding RRT* algorythm form the OMPL library was used. Additionally, path was optimized in terms of cost, calculated using elevation value on the map at a given point. For cost optimization, Optimization Objectives (https://ompl.kavrakilab.org/optimizationObjectivesTutorial.html) module was used. The planner node subscribes the elevation map from the rosbag file and randomly selects two points form the topic, then finds and subscribes optimal path into the new topic.
Node with the planner is launched every second and with this frequency new points and found path are subscribed.
Start and end point placed on the elevation map are saved as an image. Once the path is found, it is drawn on the map and also saved as an image file. The brightness value of pixels, belonging to the map, ranges from 30 to 255, while pixels belonging to the path have a value of 0. A set of the images pairs (images with points and with paths) was used to learn artificial neural network (which mimics RRT* algorythm).
To solve a given problem, convolution U-net (seen below) was chosen. Network model was implemented with help of PyTorch library. Network input is an elevation map image in grayscale with two points (start and end) drawn on its surface. Network outputs elevation map with drawn path.
Neural network training was conducted repeatedly, but due to a poor computational capacity, only 2 promising models were obtained - first, training with a set of 1000 samples for 4 epochs, second, with 6000 samples set and 8 epochs. As a training stop condition, the pixel-wise similarity between reference and output images at 97% level was set.
For the validation set, the similarity between reference images and output images reached 96% (for 6000 samples and 8 epochs). Beneath, network error and images projection accuracy plots are presented.
For the network testing, a separate images set was generated. Additional filters were applied to the output images to increase the contrast between the background (map) and the path. The similarity between reference images and network output images reached 94%.