Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UDP client connection syntax to use udpin:// #288

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions en/cpp/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ cmake --build build -j4
### Running the Examples {#running_the_examples}

You can then run the example, specifying the connection URL as the first argument.
When running with the Simulator, you will use the connection string: `udp://:14540`
When running with the Simulator, you will use the connection string: `udpin://0.0.0.0:14540`

On Linux/macOS you would run the following (from the **/build** directory):
```sh
build/takeoff_and_land udp://:14540
build/takeoff_and_land udpin://0.0.0.0:14540
```

For Windows you would run the following (from the **\build\Debug\** directory):
```cmd
build\Debug\takeoff_and_land.exe udp://:14540
build\Debug\takeoff_and_land.exe udpin://0.0.0.0:14540
```

> **Tip** Most examples will create a binary with the same name as the example.
Expand Down
2 changes: 1 addition & 1 deletion en/cpp/examples/fly_mission.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The example terminal output should be similar to that shown below:
A release build will omit the "Debug" messages.

```
$ ./fly_mission udp://:14540
$ ./fly_mission udpin://0.0.0.0:14540
```
```
Waiting to discover system...
Expand Down
2 changes: 1 addition & 1 deletion en/cpp/examples/follow_me.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The example terminal output should be similar to that shown below:
A release build will omit the "Debug" messages.

```
$ ./follow_me udp://:14540
$ ./follow_me udpin://0.0.0.0:14540
```
```
[01:55:59|Info ] DronecodeSDK version: 0.2.8 (dronecode_sdk_impl.cpp:25)
Expand Down
2 changes: 1 addition & 1 deletion en/cpp/examples/offboard_velocity.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The example terminal output should be similar to that shown below:
A release build will omit the "Debug" messages.

```
$ ./offboard udp://:14540
$ ./offboard udpin://0.0.0.0:14540
```
```
Wait for system to connect via heartbeat
Expand Down
2 changes: 1 addition & 1 deletion en/cpp/examples/takeoff_and_land.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The example terminal output should be similar to that shown below:
A release build will omit the "Debug" messages.

```sh
$ ./takeoff_and_land udp://:14540
$ ./takeoff_and_land udpin://0.0.0.0:14540
```
```sh
Waiting to discover system...
Expand Down
2 changes: 1 addition & 1 deletion en/cpp/examples/transition_vtol_fixed_wing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Otherwise the example is built and run [in the standard way](../examples/README.
The example terminal output for a debug build of the SDK should be similar to that shown below (a release build will omit the "Debug" messages):

```
$ ./transition_vtol_fixed_wing udp://:14540
$ ./transition_vtol_fixed_wing udpin://0.0.0.0:14540
```
```
Waiting to discover system...
Expand Down
8 changes: 4 additions & 4 deletions en/cpp/guide/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ The code snippet below shows how to set up a connection in server mode and liste

```cpp
Mavsdk mavsdk;
ConnectionResult connection_result = mavsdk.add_any_connection("udp://:14540");
ConnectionResult connection_result = mavsdk.add_any_connection("udpin://0.0.0.0:14540");
if (connection_result != ConnectionResult::Success) {
std::cout << "Adding connection failed: " << connection_result << '\n';
return;
}
```

> **Note** The connection string used above (`udp://:14540`) is to the [standard PX4 UDP port](https://docs.px4.io/master/en/simulation/#default-px4-mavlink-udp-ports) for off-board APIs (14540).
> **Note** The connection string used above (`udpin://0.0.0.0:14540`) is to the [standard PX4 UDP port](https://docs.px4.io/master/en/simulation/#default-px4-mavlink-udp-ports) for off-board APIs (14540).
This is the normal/most common way for offboard APIs to connect to PX4 over WiFi.
The standard way to talk to a ground station (e.g. QGC is on port 14550).

Expand Down Expand Up @@ -169,15 +169,15 @@ To forward bi-directional from UDP to serial and serial to UDP, you would set bo

```cpp
Mavsdk mavsdk;
mavsdk.add_any_connection("udp://:14540", ForwardingOption::ForwardingOn);
mavsdk.add_any_connection("udpin://0.0.0.0:14540", ForwardingOption::ForwardingOn);
mavsdk.add_any_connection("serial:///dev/serial/by-id/usb-FTDI_FT232R_USB_UART_XXXXXXXX-if00-port0:57600", ForwardingOption::ForwardingOn);
```

To forward only in one direction, e.g to send messages arriving on serial over UDP, you would only set up forwarding for the UDP connection:

```cpp
Mavsdk mavsdk;
mavsdk.add_any_connection("udp://:14540", ForwardingOption::ForwardingOn);
mavsdk.add_any_connection("udpin://0.0.0.0:14540", ForwardingOption::ForwardingOn);
mavsdk.add_any_connection("serial:///dev/serial/by-id/usb-FTDI_FT232R_USB_UART_XXXXXXXX-if00-port0:57600", `ForwardingOption::ForwardingOff`);
```

Expand Down
2 changes: 1 addition & 1 deletion en/cpp/guide/general_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Linux (e.g Raspberry Pi) connected to the vehicle via Serial port | `serial:///d
Linux connected to the vehicle via USB | `serial:///dev/ttyUSBn`, where `n` = the port | `serial:///dev/ttyUSB0`
macOS connected to the vehicle via Serial port | `serial:///dev/tty.usbserial-n`, where `n` = the USB device id | `serial:///dev/tty.usbserial-DA00AG57`
macOS connected to the vehicle via USB | `serial:///dev/tty.usbmodem-n`, where `n` = the USB device id | `serial:///dev/tty.usbmodem--DA00AG57`
SITL connected to the vehicle via UDP | `udp://:14540`
SITL connected to the vehicle via UDP | `udpin://0.0.0.0:14540`


### Connection Status
Expand Down
4 changes: 2 additions & 2 deletions en/cpp/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ First start PX4 in SITL (Simulation) and *QGroundControl* as described above.

Then run the example app (from the **example/takeoff_land/build** directory) as shown:
```sh
build/takeoff_and_land udp://:14540
build/takeoff_and_land udpin://0.0.0.0:14540
```

The MAVSDK application should connect to PX4, and you will be able to observe the example running in the SDK terminal, SITL terminal, and/or *QGroundControl*.
The expected behaviour is shown here: [Example: Takeoff and Land](examples/takeoff_and_land.md).

> **Note** The first argument above is the connection string (`udp://:14540`).
> **Note** The first argument above is the connection string (`udpin://0.0.0.0:14540`).
This is the standard PX4 UDP port for connecting to offboard APIs (also see [Connecting to Systems](guide/connections.md)).


Expand Down