I have been making progress on the path-planning related to environmental constraints. I have divided planning considerations into ‘environmental’ and ‘scientific’. Environmental includes avoiding terrain collision and navigating in the midst of water currents. Strong currents against the boat are to be avoided, but the boat should take advantage of currents that travel in its desired direction.
The PSO fitness calculation is rather involved. The region is interpolated as a raster grid (1000 x 2000 cells). There are grids for absence/presence of terrain as well as for water current magnitude and direction.
My initial plan was to use an ocean modeling software such as ROMS to generate currents for arbitrary grids. The validity of the path planning should not be affected by whether the currents are realistic or not. However, the modeling software tends to be much more sophisticated that I need. Setting up a ROMS environment with usable parameters would going to be very time consuming and require data sources that I don’t have. I found that an alternative is to use online sources that publish ROMS models for current predictions for various coastal regions. By using these sources, I was able to focus on the path planning and get more realistic currents than I had expected. The main source I am using is The Northeast Coastal Ocean Forecast System (NECOFS) to get 48-hour predictions.
I had to learn a lot of GIS over the winter break to make any progress in my spatially-oriented approach. I can take the NECOFS data that is published as a NETCDF data source and work with it as an object in Python. I extrapolate the current’s vector components onto (1000 x 2000) grids and use those to get magnitude and direction. The actual region map I am using was created manually. I needed the map to be a connected shape to convert to a raster grid of presence/absence of terrain. While I am sure this is a better way, I manually traced the coastline in great detail (even the piers) of the Massachusetts Bay area, since it is covered by NECOFS.
Because interpolating currents is slow, I do so at an hourly interval. I have ideas that should substantially reduce the time (only interpolate over a relevant window), but I will worry about such optimizations when the full path planning system is up.
Between each pair of PSO-generated waypoints is a line segment. For measuring the distance, it is trivial to calculate the Euclidean distance between these points. But, for checking the obstacles and currents, the fitness function iterates over the line and visits each cell. For each segment, a distance traveled is calculated. This is based on a (parameter) boat speed. It is assumed that the boat maintains a constant travel speed, but has to increase decrease its own velocity to maintain this speed given the affect of currents. The boat’s velocity (not the resultant velocity) is used to measure the energy usage, since the actual energy used should be proportional to the effort exerted by the boat.
When checking a new waypoint’s path, the distance traveled so far is used to select the closest currents grid.
A simple HTML report is generated for the final PSO solution. It shows the map with the waypoints. It also shows the currents, but these are not uniform across the mission. Thus, an animated gif where each frame corresponds to a waypoint sequence is shown. I set the boat’s speed too high so it does the whole mission within an hour. You can’t see any animation since its within on sampled interval. You can see a sample solution report, but note that there were only 10 PSO iterations since I was just testing the report. I should share a better example soon. The upper half shows an unneeded backwards segment, but the lower half is excellent. The boat avoids a strong current segment by making a strategic detour. I was excited when I saw that.