You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/dev_setup/building_px4.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -263,7 +263,7 @@ make [VENDOR_][MODEL][_VARIANT] [VIEWER_MODEL_DEBUGGER_WORLD]
263
263
-**VENDOR:** The manufacturer of the board: `px4`, `aerotenna`, `airmind`, `atlflight`, `auav`, `beaglebone`, `intel`, `nxp`, etc.
264
264
The vendor name for Pixhawk series boards is `px4`.
265
265
-**MODEL:** The _board model_ "model": `sitl`, `fmu-v2`, `fmu-v3`, `fmu-v4`, `fmu-v5`, `navio2`, etc.
266
-
-**VARIANT:** Indicates particular configurations: e.g. `bootloader`, `cyphal`, which contain components that are not present in the `default` configuration.
266
+
-**VARIANT:** Indicates particular configurations: e.g. `bootloader`, `cyphal`, `sih`, which add or remove components to/from the `default` configuration.
267
267
Most commonly this is `default`, and may be omitted.
Copy file name to clipboardExpand all lines: docs/en/sim_jmavsim/index.md
+95-28Lines changed: 95 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,36 +22,31 @@ jMAVSim can also be used for HITL Simulation ([as shown here](../simulation/hitl
22
22
23
23
## Installation
24
24
25
-
jMAVSim setup is included in our [standard build instructions](../dev_setup/dev_env.md) for Ubuntu Linux and Windows.
26
-
Follow the instructions below to install jMAVSim on macOS.
25
+
jMAVSim requires JDK 17 or later.
26
+
On Ubuntu and Windows, the [standard development environment setup](../dev_setup/dev_env.md) scripts install all required dependencies including Java.
27
+
On macOS, you need to install Java manually as shown below.
27
28
28
29
### macOS
29
30
30
-
To setup the environment for [jMAVSim](../sim_jmavsim/index.md) simulation:
31
+
jMAVSim requires OpenJDK 17 or later.
32
+
Install it via Homebrew:
31
33
32
-
1. Install a recent version of Java (e.g. Java 15).
33
-
You can download [Java 15 (or later) from Oracle](https://www.oracle.com/java/technologies/downloads/?er=221886) or use [Eclipse Temurin](https://adoptium.net):
34
-
35
-
```sh
36
-
brew install --cask temurin
37
-
```
38
-
39
-
1. Install jMAVSim:
40
-
41
-
```sh
42
-
brew install px4-sim-jmavsim
43
-
```
34
+
```sh
35
+
brew install openjdk@17
36
+
```
44
37
45
-
:::warning
46
-
PX4 v1.11 and beyond require at least JDK 15 for jMAVSim simulation.
38
+
Homebrew installs OpenJDK but does not link it into your `PATH`, so you need to set `JAVA_HOME` for jMAVSim to find it.
39
+
Add this to your shell profile (e.g. `~/.zshrc`):
47
40
48
-
For earlier versions, macOS users might see the error `Exception in thread "main" java.lang.UnsupportedClassVersionError:`.
49
-
You can find the fix in the [jMAVSim with SITL > Troubleshooting](../sim_jmavsim/index.md#troubleshooting)).
50
-
:::
41
+
```sh
42
+
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
43
+
```
51
44
52
45
## Simulation Environment
53
46
54
-
Software in the Loop Simulation runs the complete system on the host machine and simulates the autopilot. It connects via local network to the simulator. The setup looks like this:
47
+
Software in the Loop Simulation runs the complete system on the host machine and simulates the autopilot.
@@ -94,7 +89,8 @@ It will also bring up a window showing a 3D view of the [jMAVSim](https://github
94
89
95
90
## Taking it to the Sky
96
91
97
-
The system will start printing status information. You will be able to start flying once you have a position lock (shortly after the console displays the message: _EKF commencing GPS fusion_).
92
+
The system will start printing status information.
93
+
You will be able to start flying once you have a position lock (shortly after the console displays the message: _EKF commencing GPS fusion_).
98
94
99
95
To takeoff enter the following into the console:
100
96
@@ -196,8 +192,8 @@ Lockstep makes it possible to [change the simulation speed](#change-simulation-s
196
192
The sequence of steps for lockstep are:
197
193
198
194
1. The simulation sends a sensor message [HIL_SENSOR](https://mavlink.io/en/messages/common.html#HIL_SENSOR) including a timestamp `time_usec` to update the sensor state and time of PX4.
199
-
1. PX4 receives this and does one iteration of state estimation, controls, etc. and eventually sends an actuator message [HIL_ACTUATOR_CONTROLS](https://mavlink.io/en/messages/common.html#HIL_ACTUATOR_CONTROLS).
200
-
1. The simulation waits until it receives the actuator/motor message, then simulates the physics and calculates the next sensor message to send to PX4 again.
195
+
2. PX4 receives this and does one iteration of state estimation, controls, etc. and eventually sends an actuator message [HIL_ACTUATOR_CONTROLS](https://mavlink.io/en/messages/common.html#HIL_ACTUATOR_CONTROLS).
196
+
3. The simulation waits until it receives the actuator/motor message, then simulates the physics and calculates the next sensor message to send to PX4 again.
201
197
202
198
The system starts with a "freewheeling" period where the simulation sends sensor messages including time and therefore runs PX4 until it has initialized and responds with an actuator message.
203
199
@@ -217,11 +213,13 @@ To disable lockstep in:
217
213
218
214
## Extending and Customizing
219
215
220
-
To extend or customize the simulation interface, edit the files in the **Tools/jMAVSim** folder. The code can be accessed through the[jMAVSim repository](https://github.com/px4/jMAVSim) on Github.
216
+
To extend or customize the simulation interface, edit the files in the **Tools/jMAVSim** folder.
217
+
The code can be accessed through the[jMAVSim repository](https://github.com/px4/jMAVSim) on Github.
221
218
222
219
::: info
223
220
The build system enforces the correct submodule to be checked out for all dependencies, including the simulator.
224
-
It will not overwrite changes in files in the directory, however, when these changes are committed the submodule needs to be registered in the Firmware repo with the new commit hash. To do so, `git add Tools/jMAVSim` and commit the change.
221
+
It will not overwrite changes in files in the directory, however, when these changes are committed the submodule needs to be registered in the Firmware repo with the new commit hash.
222
+
To do so, `git add Tools/jMAVSim` and commit the change.
225
223
This will update the GIT hash of the simulator.
226
224
:::
227
225
@@ -234,6 +232,75 @@ The simulation can be [interfaced to ROS](../simulation/ros_interface.md) the sa
234
232
- The startup scripts are discussed in [System Startup](../concept/system_startup.md).
235
233
- The simulated root file system ("`/`" directory) is created inside the build directory here: `build/px4_sitl_default/rootfs`.
236
234
235
+
## Display-Only Mode
236
+
237
+
jMAVSim can run as a display-only renderer for other simulators (like [SIH](../sim_sih/index.md)), with its internal physics disabled.
238
+
In this mode, jMAVSim receives vehicle position via MAVLink and only renders the 3D view.
239
+
240
+
To use jMAVSim as a display for SIH running in SITL:
241
+
242
+
```sh
243
+
# Start SIH first
244
+
make px4_sitl_sih sihsim_quadx
245
+
246
+
# In another terminal, start jMAVSim in display-only mode
247
+
./Tools/simulation/jmavsim/jmavsim_run.sh -p 19410 -u -q -o # 19410 is the default SIH display port
|`HEADLESS=1`| Environment variable: run without GUI window |
277
+
278
+
## How jMAVSim Works
279
+
280
+
jMAVSim is a Java-based lightweight simulator that communicates with PX4 via MAVLink HIL (Hardware-In-the-Loop) messages.
281
+
282
+
In normal mode:
283
+
284
+
1. PX4 sends actuator commands via [HIL_ACTUATOR_CONTROLS](https://mavlink.io/en/messages/common.html#HIL_ACTUATOR_CONTROLS).
285
+
2. jMAVSim runs its physics engine to compute the vehicle state.
286
+
3. jMAVSim sends sensor data back via [HIL_SENSOR](https://mavlink.io/en/messages/common.html#HIL_SENSOR) and [HIL_GPS](https://mavlink.io/en/messages/common.html#HIL_GPS).
287
+
288
+
In **display-only mode** (`-o` flag), jMAVSim disables its physics engine and only reads [HIL_STATE_QUATERNION](https://mavlink.io/en/messages/common.html#HIL_STATE_QUATERNION) messages to render the vehicle position.
289
+
This allows it to visualize vehicles from other simulators like SIH.
290
+
291
+
jMAVSim supports [lockstep synchronization](#lockstep) with PX4 (enabled with `-l` flag), ensuring deterministic simulation results.
0 commit comments