mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 04:03:34 +08:00
Split out the firmware setup
This commit is contained in:
+31
-14
@@ -33,7 +33,7 @@ The simulator acts as gateway to share MAVLink data between PX4 and _QGroundCont
|
||||
|
||||
::: info
|
||||
The simulator can also be connected via UDP if the flight controller has networking support and uses a stable, low-latency connection (e.g. a wired Ethernet connection - WiFi is usually not sufficiently reliable).
|
||||
For example, this configuration has been tested with PX4 running on a Raspberry Pi connected via Ethernet to the computer (a startup configuration that includes the command for running jMAVSim can be found [here](https://github.com/PX4/PX4-Autopilot/blob/main/posix-configs/rpi/px4_hil.config)).
|
||||
For example, this configuration has been tested with PX4 running on a Raspberry Pi connected via Ethernet to the computer (a startup configuration that includes the command for running jMAVSim can be found in [px4_hil.config](https://github.com/PX4/PX4-Autopilot/blob/main/posix-configs/rpi/px4_hil.config)).
|
||||
:::
|
||||
|
||||
The diagram below shows the simulation environment:
|
||||
@@ -59,31 +59,48 @@ In summary, HITL runs PX4 on the actual hardware using standard firmware, but SI
|
||||
|
||||
## Setting up HITL
|
||||
|
||||
## Add HITL to Firmware
|
||||
|
||||
The modules required for HITL are not built into all PX4 firmware by default, so you may need to add them to the configuration and then rebuild and install the firmware.
|
||||
|
||||
You can check that the modules are present using QGroundControl:
|
||||
|
||||
1. Open **Analyze Tools > Mavlink Console**.
|
||||
2. Type `pwm_out_sim status` in the console.
|
||||
3. If the returned value is `nsh: pwm_out_sim: command not found`, then you don't have the module installed.
|
||||
|
||||
If it is not present you can add it to the configuration file for your target flight controller (such as [boards/px4/fmu-v6x/default.px4board](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v6x/default.px4board) FMUv6x based boards).
|
||||
|
||||
```text
|
||||
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
|
||||
```
|
||||
|
||||
Add the keys if necessary then re-built the firmware and flash it to the board.
|
||||
|
||||
You can alternatively use the following command to launch a GUI configuration tool, and interactively enable them at the path: **modules > Simulation > pwm_out_sim**.
|
||||
For example, to update fmu-v6x you would use:
|
||||
|
||||
```sh
|
||||
make px4_fmu-v6x boardconfig
|
||||
```
|
||||
|
||||
### PX4 Configuration
|
||||
|
||||
1. Connect the autopilot directly to _QGroundControl_ via USB.
|
||||
1. Ensure your PX4 version was build with [`pwm_out_sim`](../modules/modules_driver.md#pwm-out-sim).
|
||||
|
||||
1. Open **Analyze Tools > Mavlink Console**.
|
||||
1. Type `pwm_out_sim status` in the console.
|
||||
1. If the returned value is `nsh: pwm_out_sim: command not found`, then you don't have the module installed and you need to recompile your target with it.
|
||||
Add `CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y` to your board configuration file, re-built it and re-flash it.
|
||||
You can also use `make YOUR_TARGET boardconfig` and interactively enable it: **modules > Simulation > pwm_out_sim**.
|
||||
|
||||
1. Select Airframe
|
||||
2. Select Airframe
|
||||
|
||||
1. Open **Setup > Airframes**
|
||||
1. Select a [compatible airframe](#compatible_airframe) you want to test.
|
||||
2. Select a [compatible airframe](#compatible_airframe) you want to test.
|
||||
Then click **Apply and Restart** on top-right of the _Airframe Setup_ page.
|
||||
|
||||
1. Calibrate your RC or Joystick, if needed.
|
||||
1. Setup UDP
|
||||
3. Calibrate your RC or Joystick, if needed.
|
||||
4. Setup UDP
|
||||
|
||||
1. Under the _General_ tab of the settings menu, uncheck all _AutoConnect_ boxes except for **UDP**.
|
||||
|
||||

|
||||
|
||||
1. (Optional) Configure Joystick and Failsafe.
|
||||
5. (Optional) Configure Joystick and Failsafe.
|
||||
Set the following [parameters](../advanced_config/parameters.md) in order to use a joystick instead of an RC remote control transmitter:
|
||||
|
||||
- [COM_RC_IN_MODE](../advanced_config/parameter_reference.md#COM_RC_IN_MODE) to "Joystick/No RC Checks". This allows joystick input and disables RC input checks.
|
||||
|
||||
Reference in New Issue
Block a user