Updated report

This commit is contained in:
Monkin 2022-12-18 13:32:31 +00:00
parent 0bf8f54a82
commit e635aa40a0

View File

@ -47,55 +47,60 @@ The different parts of the system connect via UDP, and can be run on either the
PX4 uses a simulation-specific module to connect to the simulator's local TCP port 4560. Simulators then exchange data with PX4 using the MAVLink API described above. PX4 on SITL and the simulator can run on either the same machine or on different machines on the same network.
## jMavSim Simulator
---
## Simulation Coding Environment
Unfortunately, the PX4 documentation is not very clear regarding the necessary coding environment. However, from the information provided and my own research, I concluded that the simulation software works in the following conditions:
1. Windows + Windows Subsystem for Linux 2 (WSL2 with Ubuntu-20.04 distro)
2. Ubuntu 18.04
The software does not have a great set up experience, as it requires some manual configuration. In other Ubuntu versions, I wasn't capable to run the simulation. Therefore, in order to have my work environment without virtual machines or even installing a new OS just for this task, I proceeded with the first option.
### Windows + WSL2 (Ubuntu-20.04)
Before starting the installation, I want to highlight that the **Ubuntu distro used was 20.04**. I cannot guarantee that the installation will work in other versions as the setup from my experience is dependent on the Ubuntu version.
The installation steps can be followed [here](https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html). Even after following the steps listed in the documentation, the installation was not successful. An error related with the `protobuf` library inside WSL occurred. Luckily, simply uninstalling and installing again the library solved the problem:
```bash
# Uninstall the previous version
sudo apt remove protobuf-compiler
# Installing protobuf again
sudo apt install protobuf-compiler
```
I was able to replicate the setup in a second computer and, at the second time, this *protobuf* error didn't occur.
To sum up the installation steps present at the [guide](https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html):
1. Install WSL2 according to the docs in the specific version (Ubuntu-20.04)
2. Install the PX4 toolchain
```bash
# Clone PX4 Repo
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
# Run Setup script (Installs PX4, JMavSim and Gazebo)
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
```
3. Run the simulation (jMAVSim + PX4 bundled together)
```bash
HEADLESS=1 make px4_sitl_default jmavsim
```
The `HEADLESS` flag avoids running the jMAVSim GUI, as it does not seem to work with the WSL2. However, I did not consider this to be a problem, as *QGroundControl* will be used during testing as a ground station.
4. Install *QGroundControl* to visualize the simulation and control the vehicle. You can follow [these instructions](https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html#qgroundcontrol) to install it. It can be installed on Windows or directly on WSL2. Personally, I installed it on Windows as it allows to flash the firmware to the Pixhawk board later on. However, to work on windows, it's necessary to create a **communication link** in the QGroundControl Settings, as explained in the guide.
---
## jMAVSim Simulator
https://docs.px4.io/main/en/simulation/jmavsim.html#jmavsim-with-sitl
- Talk about jmavSim
- Coding Environment (Works on Linux & Windows) but with specific configurations.
### Ground Control Station
Now focusing on the Ground Control Station:
![Ground Control Station](assets/Pixhawk/groundStationOverview.png)
Fig. 4 - Ground Control Station
In terms of hardware, the ground station just needs a telemetry module, identical to the USB module represented in the figure, that will communicate with the antenna in the rocket, using the *MAVLINK* protocol.
In the software layer, resides the user interfaces. The software represented here are essentially GUIs that utilize the *MAVLINK* protocol. Namely, *QGroundControl*, *APM Planner* and *Mission Planner*. The first 2 are for Linux, while the last one is exclusively for Windows.
Additionally, this layer also contains packages that can control vehicles, with the *MAVLINK* protocol through a coding language. In other words, these packages allow you to treat *Ardupilot* and *PX4* as an API to control the vehicle. Here we have represented the package **DroneKit**.
---
## PX4 Deep Dive
As mentioned above, PX4 is one of the most popular *Flight Controller Software*. For that reason, we will explore it in more detail since its supported features are very similar to *Ardupilot* and the documentation is easier to follow.
### Supported Vehicles
Although PX4 supports a high variety of vehicles, model rockets are not part of that list. Nonetheless, I believe that is not an issue since this list is targeted for the usage of the software as a *Professional Autopilot*, that is, controlling the vehicle's trajectory and moving it as desired. In our use case, that feature isn't required so it should be fine as long as the features mentioned in the [Introduction](##Introduction) are supported.
### System Architecture
The *PX4* documentation provides a high-level overview of a typical PX4 system based around a flight controller.
![PX4 System Architecture](assets/Pixhawk/px4SimpleDiagram.png)
Fig. 5 - PX4 System Architecture
Note that this architecture is similar to what we wish to achieve, as it contains most of the sensors required for the model rocket. The missing pieces in the diagram are the [*parachute triggering*](https://docs.px4.io/main/en/peripherals/parachute.html) and [*persistent storage*](https://docs.px4.io/main/en/dev_log/logging.html), which are also supported and documented.
### Flight Controllers
There are many *Pixhawk* boards to choose from, such as the [Pixhawk 4](https://docs.px4.io/main/en/flight_controller/pixhawk4.html). The comparison and analysis of the most suitable board should be made in collaboration with the *Electrical Engineering Department*.
### Supported Sensors
It is confirmed that the Pixhawk + PX4 combination supports the sensors and radio systems we are looking for. Anyhow, there are a lot of options to choose from and, once again, contact with the *Electrical Engineering Department* is needed to reach a consensus.
---
---
## Conclusion and Next Steps