Questions about the procedure for executing the aducopter

Hello
I have a question, so I looked through the document about the ardupilot, but it was not resolved, so I write down the question.
First of all, what I’m curious about is how the ardupilot flies.
First of all, my assumption is to set it to automatic mode in GCS, specify the waypoint, and then proceed with the mission.
The contents that I read and understood in various articles and communities are as follows.

  1. Ensure that GCS and drones are communicated.
  2. GCS will proceed with Waypoint and other settings before writing to the drone.
  3. Set to Automatic mode and press the Start button.
  4. The drone performs the same mission as Waypoint on GCS.

First, I am using rpi and found the /var/lib/ardupilot folder in rpi.
Inside, we checked the arducopter.stg file, logs folder, waypoint, and press the write button to create a terrain folder.
But the question here is, I don’t know what the ardupilot software on the drone reads and performs.
Where does the ardupilot software read the files and proceed with the mission?
I’ve received data from various sensors, so I don’t know where and what files exist, such as data about the start or end of a mission.
I don’t want the details and I wonder where the related files are.
I’ll clean it up.

  1. When gcs set the automatic mode and ordered the mission to start, the associated information would have been stored on the Companion computer, and I wonder which file this information is stored in.
  2. I wonder what these files do, such as the arducopter.stg file, in /var/lib/ardupilot.

Please check it.
Thank you.