guadalplanner 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. guadalplanner-0.0.1/.gitignore +5 -0
  2. guadalplanner-0.0.1/LICENSE +19 -0
  3. guadalplanner-0.0.1/PKG-INFO +529 -0
  4. guadalplanner-0.0.1/README.md +119 -0
  5. guadalplanner-0.0.1/guadalplanner/.gitignore +180 -0
  6. guadalplanner-0.0.1/guadalplanner/.gitmodules +3 -0
  7. guadalplanner-0.0.1/guadalplanner/Agents/ExpectedImprovementAgent.py +173 -0
  8. guadalplanner-0.0.1/guadalplanner/Agents/GeneticAlgorithmSequential.py +464 -0
  9. guadalplanner-0.0.1/guadalplanner/Agents/MonteCarloTreeSearch.py +291 -0
  10. guadalplanner-0.0.1/guadalplanner/Agents/MyopicGreedy.py +112 -0
  11. guadalplanner-0.0.1/guadalplanner/Agents/WanderingAgent.py +219 -0
  12. guadalplanner-0.0.1/guadalplanner/Agents/__init__.py +0 -0
  13. guadalplanner-0.0.1/guadalplanner/Docker/.env +7 -0
  14. guadalplanner-0.0.1/guadalplanner/Docker/compose.yaml +54 -0
  15. guadalplanner-0.0.1/guadalplanner/Docker/entrypoint/arm_entrypoint.sh +50 -0
  16. guadalplanner-0.0.1/guadalplanner/Docker/mosquitto/mosquitto.conf +6 -0
  17. guadalplanner-0.0.1/guadalplanner/Environment/FakeVehicles.py +147 -0
  18. guadalplanner-0.0.1/guadalplanner/Environment/FleetUtils.py +1220 -0
  19. guadalplanner-0.0.1/guadalplanner/Environment/GaussianProcessEnv.py +593 -0
  20. guadalplanner-0.0.1/guadalplanner/Environment/GroundTruths.py +155 -0
  21. guadalplanner-0.0.1/guadalplanner/Environment/OilSpillEnv.py +390 -0
  22. guadalplanner-0.0.1/guadalplanner/Environment/OptimalSensorPlacementEnv.py +540 -0
  23. guadalplanner-0.0.1/guadalplanner/Environment/TrashCleaningEnv.py +826 -0
  24. guadalplanner-0.0.1/guadalplanner/Environment/__init__.py +0 -0
  25. guadalplanner-0.0.1/guadalplanner/Environment/generate_map.py +42 -0
  26. guadalplanner-0.0.1/guadalplanner/Environment/graphEnvs.py +418 -0
  27. guadalplanner-0.0.1/guadalplanner/Environment/maps/Alamillo30x49latlon.npy +0 -0
  28. guadalplanner-0.0.1/guadalplanner/Environment/maps/Alamillo30x49mask.npy +0 -0
  29. guadalplanner-0.0.1/guadalplanner/Environment/maps/AlamilloAccess11x15latlon.npy +0 -0
  30. guadalplanner-0.0.1/guadalplanner/Environment/maps/AlamilloAccess11x15mask.npy +0 -0
  31. guadalplanner-0.0.1/guadalplanner/Environment/maps/Guadaira34x32latlon.npy +0 -0
  32. guadalplanner-0.0.1/guadalplanner/Environment/maps/Guadaira34x32mask.npy +0 -0
  33. guadalplanner-0.0.1/guadalplanner/Environment/maps/alamillo.npy +0 -0
  34. guadalplanner-0.0.1/guadalplanner/Environment/maps/alamillo.png +0 -0
  35. guadalplanner-0.0.1/guadalplanner/Environment/maps/alamillo_big.npy +0 -0
  36. guadalplanner-0.0.1/guadalplanner/Environment/maps/defuniak.npy +0 -0
  37. guadalplanner-0.0.1/guadalplanner/Environment/maps/defuniaklatlon.npy +0 -0
  38. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Conductivity_Alamillo30x49.npy +0 -0
  39. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Conductivity_AlamilloAccess11x15.npy +0 -0
  40. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_PH_Alamillo30x49.npy +0 -0
  41. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_PH_AlamilloAccess11x15.npy +0 -0
  42. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Sonar_Alamillo30x49.npy +0 -0
  43. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Sonar_AlamilloAccess11x15.npy +0 -0
  44. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Temperature_Alamillo30x49.npy +0 -0
  45. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Temperature_AlamilloAccess11x15.npy +0 -0
  46. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Turbidity_Alamillo30x49.npy +0 -0
  47. guadalplanner-0.0.1/guadalplanner/Environment/maps/ground_truths/norm_gt_Turbidity_AlamilloAccess11x15.npy +0 -0
  48. guadalplanner-0.0.1/guadalplanner/Environment/maps/lat_lon_alamillo.npy +0 -0
  49. guadalplanner-0.0.1/guadalplanner/Environment/maps/lat_lon_alamillo_big.npy +0 -0
  50. guadalplanner-0.0.1/guadalplanner/Environment/maps/map.npy +0 -0
  51. guadalplanner-0.0.1/guadalplanner/Environment/maps/map_low.npy +0 -0
  52. guadalplanner-0.0.1/guadalplanner/Environment/maps/map_tiny.npy +0 -0
  53. guadalplanner-0.0.1/guadalplanner/Environment/maps/maps_generator.py +53 -0
  54. guadalplanner-0.0.1/guadalplanner/Environment/maps/maps_pathplanner_checker.py +74 -0
  55. guadalplanner-0.0.1/guadalplanner/Environment/maps/maps_utils.py +152 -0
  56. guadalplanner-0.0.1/guadalplanner/Environment/models/GPTorchRegressor.py +436 -0
  57. guadalplanner-0.0.1/guadalplanner/Environment/models/__init__.py +0 -0
  58. guadalplanner-0.0.1/guadalplanner/Environment/models/installcppmodel.sh +71 -0
  59. guadalplanner-0.0.1/guadalplanner/Environment/models/nearestneighbors.py +120 -0
  60. guadalplanner-0.0.1/guadalplanner/Environment/toy_env.py +367 -0
  61. guadalplanner-0.0.1/guadalplanner/Environment/utils/__init__.py +0 -0
  62. guadalplanner-0.0.1/guadalplanner/Environment/utils/load_experiment.py +14 -0
  63. guadalplanner-0.0.1/guadalplanner/Examples/1_ExampleAbstractSimulation.py +68 -0
  64. guadalplanner-0.0.1/guadalplanner/Examples/2_ExampleSITLSimulation.py +84 -0
  65. guadalplanner-0.0.1/guadalplanner/Examples/3_ExampleRealDeployment.py +86 -0
  66. guadalplanner-0.0.1/guadalplanner/Examples/4_ExampleGaussianProcessEnv.py +154 -0
  67. guadalplanner-0.0.1/guadalplanner/Examples/4_GP_Simple.py +83 -0
  68. guadalplanner-0.0.1/guadalplanner/Examples/5_GP_MultiObjective.py +90 -0
  69. guadalplanner-0.0.1/guadalplanner/Examples/6_GP_SaveResults.py +116 -0
  70. guadalplanner-0.0.1/guadalplanner/Examples/7_GP_SavedGroundTruth.py +109 -0
  71. guadalplanner-0.0.1/guadalplanner/Examples/8_GP_RemoteMode.py +110 -0
  72. guadalplanner-0.0.1/guadalplanner/Examples/trash_env_node_list_example.py +126 -0
  73. guadalplanner-0.0.1/guadalplanner/Experiments/Alamillo/AlamilloExpectedImprovement.py +156 -0
  74. guadalplanner-0.0.1/guadalplanner/Experiments/Alamillo/AlamilloFlooding.py +160 -0
  75. guadalplanner-0.0.1/guadalplanner/Experiments/Alamillo/AlamilloGreedy.py +156 -0
  76. guadalplanner-0.0.1/guadalplanner/Experiments/Guadaira/GuadairaFlooding.py +159 -0
  77. guadalplanner-0.0.1/guadalplanner/Experiments/Guadaira/GuadairaGreedy.py +156 -0
  78. guadalplanner-0.0.1/guadalplanner/Experiments/MyopicGreedy2_exp.meta.yaml +13 -0
  79. guadalplanner-0.0.1/guadalplanner/Experiments/MyopicGreedy2_exp.metrics.xz +0 -0
  80. guadalplanner-0.0.1/guadalplanner/README.md +479 -0
  81. guadalplanner-0.0.1/guadalplanner/__init__.py +55 -0
  82. guadalplanner-0.0.1/guadalplanner/representa.py +61 -0
  83. guadalplanner-0.0.1/pyproject.toml +78 -0
@@ -0,0 +1,5 @@
1
+ # Output files
2
+ dist/
3
+ .pickle
4
+ __pycache__/
5
+ *.egg-info/
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2025 Samuel Yanes Luis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,529 @@
1
+ Metadata-Version: 2.5
2
+ Name: guadalplanner
3
+ Version: 0.0.1
4
+ Summary: GuadalPlanner is a modular and extensible framework for the development, simulation, and real-world deployment of informative path planning algorithms for autonomous vehicles
5
+ Project-URL: Homepage, https://gitlab.ratatosk.cc/syanes/guadalplanner
6
+ Project-URL: Issues, https://gitlab.ratatosk.cc/syanes/guadalplanner/issues
7
+ Author-email: Samuel Yanes Luis <syanes@us.es>, Alejandro Mendoza Barrionuevo <amendoza1@us.es>, Alejandro Casado Perez <acasado4@us.es>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Education
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.9
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: networkx
18
+ Requires-Dist: numpy
19
+ Requires-Dist: paho-mqtt<2
20
+ Requires-Dist: scipy
21
+ Requires-Dist: sylegendarium
22
+ Requires-Dist: tqdm
23
+ Provides-Extra: all
24
+ Requires-Dist: anytree; extra == 'all'
25
+ Requires-Dist: colorcet; extra == 'all'
26
+ Requires-Dist: deap; extra == 'all'
27
+ Requires-Dist: gpytorch; extra == 'all'
28
+ Requires-Dist: oilspillsim; extra == 'all'
29
+ Requires-Dist: opencv-python; extra == 'all'
30
+ Requires-Dist: pillow; extra == 'all'
31
+ Requires-Dist: scikit-learn; extra == 'all'
32
+ Requires-Dist: torch; extra == 'all'
33
+ Provides-Extra: genetic
34
+ Requires-Dist: deap; extra == 'genetic'
35
+ Provides-Extra: gp
36
+ Requires-Dist: gpytorch; extra == 'gp'
37
+ Requires-Dist: scikit-learn; extra == 'gp'
38
+ Requires-Dist: torch; extra == 'gp'
39
+ Provides-Extra: maps
40
+ Requires-Dist: opencv-python; extra == 'maps'
41
+ Requires-Dist: pillow; extra == 'maps'
42
+ Provides-Extra: mcts
43
+ Requires-Dist: anytree; extra == 'mcts'
44
+ Provides-Extra: oilspill
45
+ Requires-Dist: colorcet; extra == 'oilspill'
46
+ Requires-Dist: oilspillsim; extra == 'oilspill'
47
+ Provides-Extra: trash
48
+ Requires-Dist: colorcet; extra == 'trash'
49
+ Description-Content-Type: text/markdown
50
+
51
+ <div align="center">
52
+ <p>
53
+ <a href="https://gitlab.ratatosk.cc/syanes/guadalplanner" target="_blank">
54
+ <img width="100%" src="https://gitlab.ratatosk.cc/syanes/guadalplanner/-/wikis/uploads/1f78c28d0abb49c343e63ef82c5a9d00/GuadalPlannerScheme.jpg" alt="GuadalPlanner Banner"></a>
55
+ </p>
56
+ </div>
57
+
58
+ ## :clipboard: **_GuadalPlanner_**: Environmental Monitoring System with Autonomous Vehicles
59
+
60
+ **_GuadalPlanner_** is a modular and extensible framework for the development, simulation, and real-world deployment of **informative path planning algorithms** for autonomous vehicles, built on the integration of **MAVLink**, **ROS2**, and **MQTT** for communications. The system addresses the gap between virtual algorithm testing and physical execution by maintaining a consistent software architecture across three levels of abstraction: abstract simulation, **ArduPilot SITL** simulation, and real deployment.
61
+
62
+ One of the key strengths of **_GuadalPlanner_** lies in its clear **separation between high-level algorithmic logic and low-level control interfaces**. This allows researchers to develop and evaluate decision algorithms isolated from hardware constraints, while ensuring smooth transfer to SITL or physical vehicles without code modifications. It is intended to be a contribution to the open robotics community, and to serve as a basis on which others can extend functionality and contribute new modules, thus encouraging **collaboration**.
63
+
64
+
65
+ <div align="center">
66
+ <a title="Communications Schema">
67
+ <img src="https://gitlab.ratatosk.cc/syanes/guadalplanner/-/wikis/uploads/ff4ba89956da6c503fd4b9ce74f60b2b/Comms_schema.jpg" width="40%" />
68
+ </a>
69
+ <img src="https://gitlab.ratatosk.cc/syanes/guadalplanner/-/wikis/uploads/3d6bd97d601a98ab491ed8dd255b9671/logo-transparent.png" width="10%" alt="" />
70
+ <a title="ROS2 Schema">
71
+ <img src="https://gitlab.ratatosk.cc/syanes/guadalplanner/-/wikis/uploads/0c3b79213491fc17ef05cb27f5d36bdd/ROS2_schema.jpg" width="40%" />
72
+ </a>
73
+ <p><em>Figure 1: System architecture overview (left: communication schema, right: ROS2 integration).</em></p>
74
+ </div>
75
+
76
+
77
+ #### Framework Objectives
78
+
79
+ 1. Ensure interchangeability between algorithms and environments, allowing different informative path planning algorithms to be tested on different scenarios (environments) without the need to rewrite the code base, thanks to a flexible and modular structure that decouples the decision logic from the model of the environment.
80
+ 2. Unify simulated and real environments for real-time environmental data collection, allowing the same code to be executed in both contexts with minimal modifications.
81
+ 3. Abstract decision-making from the control system.
82
+ 4. Enable customisation and extensibility, offering an object-oriented structure with easily inheritable and adaptable classes.
83
+ 5. Facilitate the modular integration of sensors, navigation algorithms and communication nodes through an architecture based on ROS2.
84
+
85
+
86
+ ## :rocket: Quick Start Guide
87
+
88
+
89
+ <details open>
90
+ <summary>Installation</summary>
91
+
92
+ ```bash
93
+ # Clone repository
94
+ git clone --recurse-submodules -j8 https://gitlab.ratatosk.cc/syanes/guadalplanner.git
95
+
96
+ # Or update as
97
+ git pull --recurse-submodules
98
+
99
+ # Install dependencies
100
+ cd guadalplanner
101
+ pip install numpy networkx matplotlib paho-mqtt scipy scikit-learn sylegendarium
102
+ ```
103
+
104
+ </details>
105
+
106
+
107
+ <details close>
108
+ <summary>Abstract Simulation</summary>
109
+
110
+ ```python
111
+ import numpy as np
112
+ from Environment.FleetUtils import BaseGraphEnvironment, Fleet
113
+ from Environment.GroundTruths import generate_gts
114
+
115
+ # Load map
116
+ base_matrix = np.load('Environment/maps/Alamillo30x49mask.npy')
117
+ coordinates = np.load('Environment/maps/Alamillo30x49latlon.npy')
118
+
119
+ # Create environment
120
+ env = BaseGraphEnvironment(
121
+ base_matrix=base_matrix,
122
+ resolution=1.0,
123
+ diagonal=True,
124
+ lat_lon_map=coordinates
125
+ )
126
+
127
+ # Generate environmental data
128
+ ground_truth = generate_gts(base_matrix, env.xy_positions, n_objectives=5)
129
+ env.fill_graph_attribute('ground_truth', ground_truth.T)
130
+
131
+ # Create fleet
132
+ fleet = Fleet(
133
+ n_vehicles=2,
134
+ initial_positions=[0, 50],
135
+ graphEnv=env,
136
+ max_distance=100.0
137
+ )
138
+
139
+ # Execute mission
140
+ fleet.reset()
141
+ for step in range(100):
142
+ # Plan next objectives
143
+ targets = [np.random.randint(0, len(env.xy_positions)) for _ in range(2)]
144
+
145
+ # Move vehicles
146
+ reached, dones = fleet.move(targets)
147
+
148
+ # Take measurements
149
+ if all(reached.values()):
150
+ measurements = fleet.take_measurement()
151
+ print(f"Measurements: {measurements}")
152
+
153
+ # Visualize
154
+ fleet.render()
155
+
156
+ # Check stopping conditions
157
+ if any(dones.values()):
158
+ print("Mission completed")
159
+ break
160
+ ```
161
+ </details>
162
+
163
+ <details close>
164
+ <summary>Real Deployment/Ardupilot Software-in-the-loop</summary>
165
+ This example shows how to use the RemoteFleet class to simulate a fleet of vehicles with Ardupilot SITL simulation or for a deployment with real vehicles.
166
+ The RemoteFleet class allows to communicate with a fleet of vehicles that can communicate remotely.
167
+
168
+ * In simulation, Ardupilot SITL must be running to simulate the vehicles and the MQTT broker must be configured to communicate with them. MAVROS and ROS2 program properly configured must also be running. To avoid installation issues, it is recommended to build with necessary modifications the Docker image provided in the repository.
169
+ * In real deployment, vehicles need an autopilot compatible with MAVLink, such as Ardupilot or PX4.
170
+ The companion computer must run MAVROS and the ROS2 program properly configured to communicate with the vehicles, receive commands and send measurements. MQTT broker must be configured to communicate with the vehicles. To avoid installation issues, it is recommended to build with necessary modifications the Docker image provided in the repository and run it directly in the companion computer.
171
+
172
+ This example assumes that the Docker image or the necessary environment is already set up and running.
173
+
174
+ ```python
175
+ from Environment.FleetUtils import RemoteFleet
176
+
177
+ # Configure communication
178
+ mqtt_params = {
179
+ 'broker_ip': 'your-mqtt-broker.com',
180
+ 'port': 1883,
181
+ 'username': 'your-username',
182
+ 'password': 'your-password'
183
+ }
184
+
185
+ # Define sensors
186
+ sensors = {
187
+ 0: ['temperature_ct', 'turbidity', 'conductivity', 'ph', 'depth'],
188
+ 1: ['temperature_ct', 'turbidity', 'conductivity', 'ph', 'depth']
189
+ }
190
+
191
+ # Create real fleet
192
+ fleet = RemoteFleet(
193
+ n_vehicles=2,
194
+ initial_positions=[0, 50],
195
+ graphEnv=env,
196
+ mqtt_comm_params=mqtt_params,
197
+ objectives_names=sensors,
198
+ use_sim_measurements=False
199
+ )
200
+
201
+ # Execute real mission
202
+ fleet.reset() # Vehicles move to initial positions
203
+ # ... rest of code similar to simulation
204
+ ```
205
+
206
+ ## :dart: Specific Use Example
207
+
208
+ ### 1. **Water Quality Monitoring**
209
+
210
+ ```python
211
+ from Environment.GaussianProcessEnv import GaussianProcessEnv
212
+ from Agents.ExpectedImprovementAgent import ExpectedImprovementAgent
213
+
214
+ # Configure environment with Gaussian processes
215
+ env = GaussianProcessEnv(base_matrix, n_objectives=5)
216
+
217
+ # Using expected improvement agent
218
+ agent = ExpectedImprovementAgent(env)
219
+
220
+ # Running adaptive mission
221
+ for step in range(200):
222
+ # The agent decides where to sample based on uncertainty
223
+ next_targets = agent.plan_next_actions(fleet.get_positions())
224
+ fleet.move(next_targets)
225
+
226
+ # Updating model with new measurements
227
+ measurements = fleet.take_measurement()
228
+ agent.update_model(measurements)
229
+ ```
230
+ </details>
231
+
232
+
233
+
234
+
235
+ ## :construction_site: Project Architecture
236
+
237
+ The GitLab repository is structured in two parts:
238
+
239
+ - The main repository contains the GuadalPlanner code, structured in the following main folders:
240
+ * Agents: contains examples of algorithms.
241
+ * Environment: contains all the base code of the framework (FleetUtils, graphEnv, maps, and example environments, among others).
242
+ * Examples: contains a series of basic examples organized from simplest to most advanced, helping users familiarize themselves with the framework's structure.
243
+ * Experiments: contains the code for the experiments carried out in Alamillo Park, as well as example metrics saved with Legendarium. To visualize them, there is an example in Environment/utils/load_experiment.py.
244
+
245
+ ```
246
+ guadalplanner/
247
+ ├── README.md # This file
248
+ ├── representa.py # Main representation script
249
+ │
250
+ ├── Agents/ # Path planning algorithms
251
+ │ ├── ExpectedImprovementAgent.py # Expected improvement based agent
252
+ │ ├── GeneticAlgorithmSequential.py # Sequential genetic algorithm
253
+ │ ├── MonteCarloTreeSearch.py # Monte Carlo tree search
254
+ │ ├── MyopicGreedy.py # Myopic greedy algorithm
255
+ │ └── WanderingAgent.py # Random exploration agent
256
+ │
257
+ ├── Docker/ # Folder for docker files
258
+ │ ├── compose.yaml # Docker compose
259
+ │ └── .env # Environment variables
260
+ │
261
+ ├── Environment/ # Simulation environment
262
+ │ ├── FleetUtils.py # Fleet and vehicle system
263
+ │ ├── graphEnvs.py # Graph-based environments for monitorization
264
+ │ ├── GroundTruths.py # Synthetic data generation or loading
265
+ │ ├── FakeVehicles.py # MQTT response simulator
266
+ │ ├── GaussianProcessEnv.py # Gaussian process environment
267
+ │ ├── OilSpillEnv.py # Oil spill simulation
268
+ │ ├── TrashCleaningEnv.py # Trash cleaning
269
+ │ ├── OptimalSensorPlacementEnv.py # Optimal sensor placement
270
+ │ └── generate_map.py # Map generation
271
+ │
272
+ ├── Examples/ # Usage examples
273
+ │ ├── 1_ExampleAbstractSimulation.py # Abstract simulation
274
+ │ ├── 2_ExampleSITLSimulation.py # SITL simulation
275
+ │ ├── 3_ExampleRealDeployment.py # Real deployment
276
+ │ └── 4_ExampleGaussianProcessEnv # Gaussian process example
277
+ │
278
+ ├── Experiments/ # Experimental results
279
+ │ └── *.meta.yaml, *.metrics.xz # Metadata and metrics
280
+ │
281
+ └── Documentation/ # Additional documentation
282
+ └── Figures/ # Figures and images
283
+ ```
284
+
285
+ - In addition to the main repository, the [*asv*](https://gitlab.ratatosk.cc/syanes/asv) repository is included as a submodule, necessary for real-world implementation or simulation with Ardupilot SITL. That is, for using GuadalPlanner's Remote classes. This repository contains the ROS2 program, which acts as middleware between GuadalPlanner and the vehicle's autopilot running MAVLink. Although this submodule is designed for autonomous surface vehicles, it can be adapted to other types of vehicles. Through [nodes](https://gitlab.ratatosk.cc/syanes/asv/-/tree/main/asv_workspace/src/asv_loyola_us/asv_loyola_us?ref_type=heads), ROS2 handles low-level path planning, communication with the central server via the MQTT protocol, and reading/sending sensor measurements, among other tasks. For users to run this code, they must modify it according to their needs, especially the [configuration file](https://gitlab.ratatosk.cc/syanes/asv/-/blob/main/asv_workspace/src/asv_loyola_us/config/config.yaml?ref_type=heads). To facilitate usage, Docker images have been implemented and can be executed using a [bash script](https://gitlab.ratatosk.cc/syanes/asv/-/blob/main/startasv.sh?ref_type=heads), though variables must be adjusted for each user's specific setup. The Dockerfiles are available for editing [here](https://gitlab.ratatosk.cc/syanes/asv/-/tree/main/dockerfiles?ref_type=heads), as well as for running them on systems not compatible with the bash script.
286
+
287
+ ## :tools: Main Modules
288
+
289
+ ### 1. `Environment/` - :globe_with_meridians: Vehicles and simulation environments
290
+
291
+ #### **FleetUtils.py**
292
+
293
+ FleetUtils is a Python module that implements a complete system for **environmental monitoring using fleets of autonomous vehicles**. It is designed to coordinate multiple vehicles (simulated or real) that can navigate an environment, take environmental measurements and report data in real time.
294
+
295
+ **Main components:**
296
+
297
+ - `BaseGraphEnvironment`: Converts an array of pixels (representing a map) into a navigable graph where each valid pixel becomes a node. Each node has stored information, such as ground truth values or latitude and longitude coordinates.
298
+ - `Vehicle`: Simulated vehicle with autonomous navigation. Autonomous graph navigation, battery system/maximum distance, taking simulated measurements, statuses (position, current node, distance travelled), etc.
299
+ - `RemoteVehicle`: Real vehicle controlled via MQTT. In addition to the features inherited from the non-remote class: two-way MQTT communication, sending GPS waypoints, receiving arrival confirmations, taking actual measurements from sensors.
300
+ - `Fleet`: Coordination of multiple simulated vehicles. Collision avoidance, movement synchronisation, real-time visualisation, fleet status management, etc.
301
+ - `RemoteFleet`: Coordination of multiple real vehicles. Inherits the functions of the non-remote class.
302
+ - `MQTTRemoteCommNode`: Bidirectional MQTT communication
303
+
304
+ #### **graphEnvs.py**
305
+
306
+ This module provides graph-based environments specifically designed for environmental monitoring missions with autonomous vehicles. It extends the base graph functionality with specialized monitoring capabilities and fleet coordination.
307
+
308
+ **Main components:**
309
+
310
+ - `MonitorizationEnvironment`: is the core of the environmental monitoring system that coordinates multiple autonomous vehicles in environmental data collection missions. This class integrates previous components, such as the transformation of binary navigation matrices into navigable graphs, the management of vehicle fleets with position and movement control, and the simulated environmental data (ground truth) for variables, and provides real-time visualization of mission status.
311
+ - `RemoteMonitorizationEnvironment`: Extended environment for real vehicle deployments via MQTT. It offers real-time vehicle information exchange and simulated or real sensor measurements.
312
+
313
+ #### **Specialized Environments**
314
+
315
+ **GaussianProcessEnv.py**
316
+
317
+ - Environmental phenomena modeling with Gaussian processes
318
+ - Value prediction in unsampled locations
319
+ - Uncertainty-based route optimization
320
+
321
+ **OilSpillEnv.py**
322
+
323
+ - Oil spill simulation
324
+ - Temporal dispersion modeling
325
+ - Containment and cleanup strategies
326
+
327
+ **TrashCleaningEnv.py**
328
+
329
+ - Environment for aquatic trash cleanup
330
+ - Waste detection and collection
331
+ - Cleanup path optimization
332
+
333
+ **OptimalSensorPlacementEnv.py**
334
+
335
+ - Optimal environmental sensor placement
336
+ - Information coverage maximization
337
+ - Spatial optimization algorithms
338
+
339
+ ### 2. `Agents/` - :robot: Informative path planning algorithms
340
+
341
+ **ExpectedImprovementAgent.py**
342
+
343
+ - Bayesian optimization for exploration
344
+ - Exploration-exploitation balance
345
+ - Expected improvement as acquisition function
346
+
347
+ **GeneticAlgorithmSequential.py**
348
+
349
+ - Genetic algorithm for route planning
350
+ - Solution population evolution
351
+ - Multi-objective optimization
352
+
353
+ **MonteCarloTreeSearch.py**
354
+
355
+ - Monte Carlo tree search in decision trees
356
+ - Stochastic simulations for evaluation
357
+ - Long-term planning
358
+
359
+ **MyopicGreedy.py**
360
+
361
+ - Short-horizon greedy algorithm
362
+ - Locally optimal decisions
363
+ - Fast real-time response
364
+
365
+ **WanderingAgent.py**
366
+
367
+ - Random environment exploration
368
+ - Baseline for algorithm comparison
369
+ - Uniform space coverage
370
+
371
+ ### 3. `Examples/` - :books: Progressive Tutorials With Usage Examples
372
+
373
+ [**1_ExampleAbstractSimulation.py**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Examples/1_ExampleAbstractSimulation.py?ref_type=heads)
374
+
375
+ ```python
376
+ # Basic simulation without hardware
377
+ from Environment.FleetUtils import Fleet, BaseGraphEnvironment
378
+
379
+ # Configure environment
380
+ env = BaseGraphEnvironment(base_matrix, resolution=1.0)
381
+ fleet = Fleet(n_vehicles=2, initial_positions=[0, 10], graphEnv=env)
382
+
383
+ # Execute mission
384
+ fleet.reset()
385
+ fleet.move([target1, target2])
386
+ measurements = fleet.take_measurement()
387
+ ```
388
+
389
+ [**2_ExampleSITLSimulation.py**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Examples/2_ExampleSITLSimulation.py?ref_type=heads)
390
+
391
+ ```python
392
+ # Simulation with MQTT protocol (Software-in-the-Loop)
393
+ from Environment.FleetUtils import RemoteFleet
394
+ from Environment.FakeVehicles import MQTTFakeVehiclesResponses
395
+
396
+ # Configure simulated communication
397
+ mqtt_params = {'broker_ip': 'localhost', 'port': 1883}
398
+ fake_vehicles = MQTTFakeVehiclesResponses(**mqtt_params, n_vehicles=2)
399
+
400
+ # Create remote fleet
401
+ fleet = RemoteFleet(n_vehicles=2, mqtt_comm_params=mqtt_params, ...)
402
+ ```
403
+
404
+ [**3_ExampleRealDeployment.py**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Examples/3_ExampleRealDeployment.py?ref_type=heads)
405
+
406
+ ```python
407
+ # Real deployment with hardware
408
+ mqtt_params = {'broker_ip': 'field-station.local', 'port': 1883}
409
+ fleet = RemoteFleet(
410
+ n_vehicles=3,
411
+ mqtt_comm_params=mqtt_params,
412
+ use_sim_measurements=False # Use real sensors
413
+ )
414
+ ```
415
+
416
+ [**4_ExampleGaussianProcessEnv.py**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Examples/4_ExampleGaussianProcessEnv.py?ref_type=heads)
417
+
418
+ ```python
419
+ # Gaussian Process-based environmental monitoring
420
+ from Environment.GaussianProcessEnv import GPbasedEnvironment
421
+ from Agents.MyopicGreedy import UncertaintyGreedyAgent
422
+
423
+ # Configure GP environment
424
+ env = GPbasedEnvironment(
425
+ base_matrix=mask_grid,
426
+ max_distance=925,
427
+ n_objectives=1,
428
+ initial_positions=initial_positions,
429
+ lengthscale_bounds=(1.0, 8.0),
430
+ ground_truth_fn=generate_gts
431
+ )
432
+
433
+ # Use uncertainty-based agent
434
+ agent = UncertaintyGreedyAgent()
435
+ target = agent.policy(env, current_node, radius=5)
436
+ reward, reached, dones, info = env.move(target, "sequential")
437
+ ```
438
+
439
+ ### 4. `Experiments/` - Experimental Results
440
+
441
+ Contains results from experiments conducted with different configurations:
442
+
443
+ **File structure:**
444
+
445
+ - `*.meta.yaml`: Experiment metadata (configuration, parameters)
446
+ - `*.metrics.xz`: Compressed metrics (performance, trajectories)
447
+
448
+ **Example experiments:**
449
+
450
+ - `Alamillo_20250424_*`: Experiments in Alamillo area
451
+ - `Alamillo30x49_*`: Experiments on 30x49 grid
452
+ - `AlamilloAccess11x15_*`: Experiments in access area
453
+
454
+ ## :whale: Docker compose
455
+ This Docker Compose setup provides a ready-to-run execution environment for GuadalPlanner at the Software-in-the-Loop abstraction level. It launches all the required services to simulate an autonomous vehicle, handle middleware communication, and exchange planning commands using MQTT, without requiring manual configuration of each component.
456
+
457
+ The goal of this setup is to offer a single entry point that encapsulates all runtime dependencies, allowing users to focus on developing and testing IPP algorithms rather than on system integration.
458
+
459
+ ### Services Description
460
+
461
+ All services are connected through a shared Docker network to ensure consistent internal communication.
462
+ The Docker Compose configuration instantiates the following components:
463
+
464
+ ##### `sitl_internal/` - Vehicle SITL
465
+ A simulated ArduPilot-based vehicle running in SITL mode, initialized at a configurable geographic location. The initial vehicle position is defined through environment variables and can be easily modified in [**.env**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Docker/.env?ref_type=heads) file.
466
+ Relevant parameters:
467
+ - `VEH_LAT`, `VEH_LON`: Initial latitude and longitude of the vehicle.
468
+ - `SITLPORT`: MAVLink port exposed to the host.
469
+
470
+ ##### `asv_runner_internal/` - Vehicle middleware container
471
+ Executes the onboard software stack, including navigation and communication nodes, and connects to the SITL instance using MAVLink, and to the MQTT broker.
472
+ Relevant parameters:
473
+
474
+ - `ASV_ID`: Identifier of the vehicle.
475
+ - `GUIDED_WAYPOINTS`: Enables waypoint-based navigation in GUIDED mode. It is recommended not to change.
476
+ - `MQTT_ADDR`: Address of the MQTT broker (local by default).
477
+
478
+ ##### `fake_start/` - Automatic arming and mode initialization
479
+ This auxiliary container is responsible for initializing the vehicle state once all required services are running. It automatically arms the vehicle and switches it to GUIDED mode, making it ready to receive waypoints or planning commands.
480
+
481
+ ##### `mqtt_broker_internal/` - MQTT broker
482
+ A local MQTT broker used for communication between GuadalPlanner components and external planning algorithms. By default, this broker is used for all communications, but it can be replaced by an external broker. To use an external broker, uncomment and set `MQTT_ADDR` in [**.env**](https://gitlab.ratatosk.cc/syanes/guadalplanner/-/blob/main/Docker/.env?ref_type=heads).
483
+
484
+ ### Usage
485
+ To launch the complete SITL execution environment:
486
+
487
+ ```bash
488
+ cd Docker
489
+ docker compose up
490
+ ```
491
+
492
+ Once all containers are running, the system is ready to receive commands from any IPP algorithm implemented using GuadalPlanner. Communication between GuadalPlanner and the execution environment relies on MQTT. The only additional step required is for both sides to be connected to the same common MQTT broker. If no remote MQTT broker has been set, default is _localhost_, as seen in [**example tutorials**](https://gitlab.ratatosk.cc/syanes/guadalplanner#3-examples---books-progressive-tutorials-with-usage-examples).
493
+
494
+ To stop the system:
495
+
496
+ ```bash
497
+ docker compose down
498
+ ```
499
+
500
+ ## :rotating_light: Troubleshooting
501
+
502
+ ### **Common Problems**
503
+
504
+ 1. **MQTT connection failed**
505
+
506
+ ```python
507
+ # Verify connectivity
508
+ import paho.mqtt.client as mqtt
509
+
510
+ def test_mqtt_connection(broker_ip, port):
511
+ client = mqtt.Client()
512
+ try:
513
+ client.connect(broker_ip, port, 60)
514
+ print("✅ Successful MQTT connection")
515
+ return True
516
+ except Exception as e:
517
+ print(f"❌ Error in connection: {e}")
518
+ return False
519
+ ```
520
+
521
+ ## :handshake: Contributions
522
+
523
+ ### **How to Contribute**
524
+
525
+ 1. **Fork** the repository
526
+ 2. **Create** branch for new functionality
527
+ 3. **Implement** changes with tests
528
+ 4. **Document** changes
529
+ 5. **Send** pull request
@@ -0,0 +1,119 @@
1
+ # Guadal Pypi
2
+
3
+ python3
4
+
5
+
6
+
7
+ ## Getting started
8
+
9
+
10
+
11
+ ## Add your files
12
+
13
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
+ - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
+
16
+ ```
17
+ cd existing_repo
18
+ git remote add origin https://gitlab.ratatosk.cc/aceti/guadal_pypi.git
19
+ git branch -M main
20
+ git push -uf origin main
21
+ ```
22
+
23
+ ## Integrate with your tools
24
+
25
+ - [ ] [Set up project integrations](https://gitlab.ratatosk.cc/aceti/guadal_pypi/-/settings/integrations)
26
+
27
+ ## Collaborate with your team
28
+
29
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
+ - [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
+
35
+ ## Test and Deploy
36
+
37
+ Use the built-in continuous integration in GitLab.
38
+
39
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
+
45
+ ***
46
+
47
+ # Editing this README
48
+
49
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
+
51
+ ## Suggestions for a good README
52
+
53
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
54
+
55
+ ## Name
56
+ Choose a self-explaining name for your project.
57
+
58
+ ## Description
59
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
+
61
+ ## Badges
62
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
+
64
+ ## Visuals
65
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
+
67
+ ## Installation
68
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
+
70
+ ## Usage
71
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
+
73
+ ## Support
74
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
+
76
+ ## Roadmap
77
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
78
+
79
+ ## Contributing
80
+ State if you are open to contributions and what your requirements are for accepting them.
81
+
82
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
83
+
84
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
85
+
86
+ ## Authors and acknowledgment
87
+ Show your appreciation to those who have contributed to the project.
88
+
89
+ ## License
90
+ For open source projects, say how it is licensed.
91
+
92
+ ## Project status
93
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
94
+
95
+
96
+
97
+ Scripts are run from the repository root (e.g. `python Examples/1_ExampleAbstractSimulation.py`).
98
+
99
+ </details>
100
+
101
+ <details open>
102
+ <summary>Installation from PyPI</summary>
103
+
104
+ ```bash
105
+ pip install GuadalPlanner # core: graph environments, fleets, MQTT
106
+ pip install "GuadalPlanner[gp]" # + Gaussian process environment (torch, gpytorch, scikit-learn)
107
+ pip install "GuadalPlanner[all]" # every optional dependency
108
+ ```
109
+
110
+ When installed, modules live under the `guadalplanner` package and the bundled maps are available through `guadalplanner.MAPS_DIR`:
111
+
112
+ ```python
113
+ import numpy as np
114
+ import guadalplanner
115
+ from guadalplanner.Environment.FleetUtils import BaseGraphEnvironment, Fleet
116
+
117
+ base_matrix = np.load(guadalplanner.MAPS_DIR / 'Alamillo30x49mask.npy')
118
+ coordinates = np.load(guadalplanner.MAPS_DIR / 'Alamillo30x49latlon.npy')
119
+ ```