# GUI

Below is the flow chart of the whole gui system.

![Flow Chart of the System](/files/-LqQENGYi9zeFNLKVL_m)

{% file src="/files/-LqQGQFO0-0AVs0lzP7q" %}
HTML file of the diagram
{% endfile %}

Programs are divided into modules to simplify the process. Each program communicates with each other via text files. This helps debug each process' output.

To further describe the system in summary, here are the steps:

GepettoApp.py steps

1. &#x20;GepettoApp.py is opened, the gui program that user interacts with
2. &#x20;User gives motor locations and combination first to create background schematic.
3. After motors are placed, user gives frame points and frame durations for each frame
4. When all frames but last one finishes, user ends the frames with RTH, return to home which places new frame points to the starting positions, and gives its duration to make it a loop
5. User presses "Done" button and the gui program closes, saves points to a txt file for interpolation

interpolate\_points.py steps

1. interpolate\_points.py takes points from this txt file and  interpolates a curved path.
2. After interpolating, divides each frame into multiple frames on this curved path.
3. Extracts new points and durations between these new points linear with distance between points
4. Shows an output graph which is the curved path
5. User closes this graph window and the new points and durations are written to a txt file for next module

motor\_params.py steps

1. &#x20;motor\_params.py takes these points from interpolation, and converts to motor parameters.
2. Each point are in terms of meters, we know makara radius, motor one turn step number so conversion is simple two equations:
   1. `number of turns = distance / (2*Pi*radius)`
   2. `number of steps = (number of turns) * (one turn step number`
3. After that, we know the frame durations, so we can calculate speeds with the following equation

   `speed = distance / time. In our case distance is step numbers, so this equation looks like this:`

   `speed = (number of steps in frameN - number of steps in frameN-1) / (frame N duration)`
4. After converting all steps distances and step speeds, the outputs are written into a to a txt file
5. Also these outputs are converted to json file and send to the web with web\_comm module.

move\_to\_vs\_t.py

1. &#x20;This module was the smoothing module, but it wasn't robust so not used now
2. &#x20;This module takes the unsmoothed frames from motor\_params.py program.
3. Using Step vs Time graph, it tries to interpolate those points to get smooth velocity changes


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://levitate.gitbook.io/project-gpetto/gui.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
