An Integrated Route and Path Planning Strategy for Skid--Steer Mobile Robots in Assisted Harvesting Tasks with Terrain Traversability Constraints
This project introduces a combined route and path planning strategy for guiding autonomous ground vehicles during scheduled harvesting tasks. The strategy is designed to handle expansive crop rows and complex terrain conditions of agricultural fields. The proposed planning strategy integrates:
-
A global planning method based on the Traveling Salesman Problem (TSP) under the Capacitated Vehicle Routing approach. This method prioritizes harvesting positions based on criteria such as minimum path length and vehicle's load capacity.
-
A local planning strategy based on Informed Rapidly-exploring Random Trees (IRRT*). This strategy coordinates the previously scheduled harvesting points while simultaneously avoiding obstacles of low-traction terrain.
The global approach aims to generate an ordered queue of harvesting locations, maximizing the harvested product of the expected crop yield. In the second stage, the informed RRT* planner avoids obstacles around the configuration space of the robotic vehicle. It incorporates a dynamical model of the vehicle motion dynamics to meet constraints compatible with those of the planned path. Experimental results demonstrate the effectiveness of the proposed planning strategy, achieving smooth and collision-free paths, making it suitable for practical applications in precision agriculture.
Clone the repository using the following command:
git clone https://github.com/rickyurvina/path_planning_python_coppelia.git
Ensure the following are installed before starting:
- CoppeliaSim (Version 4.5.1)
- Python (Version 3.9)
- MySql (Version 8.0.26)
-
CoppeliaSim:
- Download CoppeliaSim from the official website.
- Follow the installation instructions provided in the documentation.
-
Python and Dependencies:
- Install Python > 3.9 from python.org.
- Install the required dependencies by running the following command:
pip3 install -r requirements.txt
-
MySql:
- Install MySql from the official website.
- Follow the installation instructions provided in the documentation.
- Open CoppeliaSim.
- Open the file
environment_harvesting_test.ttt
from thecoppelia_map
folder.
- The map must have a working plane of 1x15 meters.
- If you want to run the application online, obtaining the map from Coppelia, you must change the value of the
ON_LINE
variable to 1 in theconfig.py
file. - If you want to run the application offline, obtaining the map from a file, you must change the value of the
ON_LINE
variable to 0 in theconfig.py
file.
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Install the required dependencies:
pip3 install -r requirements.txt
- Deactivate the virtual environment:
deactivate
- Update the MySql variables in the
src/steps/config.py
file according to your MySql configuration. - Use the
create_database.py
script from thesteps
folder to create the database:python3 src/steps/create_database.py
- Create a folder named
solutions
in the root of the project. This folder will store the solutions of the TSP and RRT algorithms. - Move the
solution_2049_07052024
folder to thesolutions
folder. If you generate new solutions, you can update theSOLUTION
constant in theconfig.py
file to point to the new folder.
Use the app.py
script from the steps
folder to execute the program:
python3 src/steps/app.py
-
Use the
step_1_get_data.py
script from thesteps
folder to obtain the processed map from Coppelia. Ensure that theON_LINE
variable insteps/config.py
is set to 1, and that theconnectionPort
incomponents/step1_get_data.py
matches your Coppelia port. Load the map located incoppelia_map/environment_harvestng_test.ttt
in CoppeliaSim. The simulation in Coppelia starts automatically:python3 src/steps/step_1_get_data.py
-
Use the
step_2_tsp.py
script from thesteps
folder to execute the TSP algorithm. You can run this file online or offline. If running online, ensure Coppelia is open with the map loaded. If running offline, set theON_LINE
variable inconfig.py
to 0. If you want to run the TSP step offline, ensure that thesolutions
folder contains theapp_variables1.pickle
file. Inconfig.py
, you can adjust theVEHICLE_CAPACITIES
andSTART_POINT_TSP
values:python src/steps/step_2_tsp.py
-
Use the
step_3_rrt.py
script from thesteps
folder to execute the RRT algorithm. You can run this file online or offline. If running online, ensure theON_LINE
variable inconfig.py
is set to 1 and that Coppelia is running with the map open. If running offline, set theON_LINE
variable inconfig.py
to 0. This will load the solution from thesolutions
folder, using theSOLUTION
constant value fromconfig.py
. If running offline, the path will be generated with the TSP Solution saved in thesolutions
folder. In the main function ofstep_3_rrt.py
, you can uncomment the line of the different RRT methods for comparison. Inconfig.py
, you can adjust various parameters:python src/steps/step_3_rrt.py
This project was carried out at the Universidad Católica del Norte of Antofagasta in the Department of Systems and Computer Engineering (DISC).
If you wish to use this code in your work, please cite our paper available at this link DOI: 10.3390/agriculture14081206.