Skip to content

Commit 26c7db0

Browse files
authored
Merge pull request #767 from mavlink/pr-fix-connection-string
Update connection strings
2 parents 2ead2b6 + ce5f09e commit 26c7db0

40 files changed

+48
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ from mavsdk import System
3939
...
4040

4141
drone = System()
42-
await drone.connect(system_address="udp://:14540")
42+
await drone.connect(system_address="udpin://0.0.0.0:14540")
4343
```
4444

4545
Note: `System()` takes two named parameters: `mavsdk_server_address` and `port`. When left empty, they default to `None` and `50051`, respectively, and `mavsdk_server -p 50051` is run by `await drone.connect()`. If `mavsdk_server_address` is set (e.g. to "localhost"), then `await drone.connect()` will not start the embedded `mavsdk_server` and will try to connect to a server running at this address. This is useful for platforms where `mavsdk_server` does not come embedded, for debugging purposes, and for running `mavsdk_server` in a place different than where the MAVSDK-Python script is run.

examples/all_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
async def run():
88
# Connect to the drone
99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
# Get the list of parameters
1313
all_params = await drone.param.get_all_params()

examples/calibration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
async def run():
88

99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
print("-- Starting gyroscope calibration")
1313
async for progress_data in drone.calibration.calibrate_gyro():

examples/camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/camera_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
async def run():
2424
drone = System()
25-
await drone.connect(system_address="udp://:14540")
25+
await drone.connect(system_address="udpin://0.0.0.0:14540")
2626

2727
asyncio.ensure_future(observe_current_settings(drone))
2828
asyncio.ensure_future(observe_camera_mode(drone))

examples/do_orbit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
async def run():
77
drone = System()
8-
await drone.connect(system_address="udp://:14540")
8+
await drone.connect(system_address="udpin://0.0.0.0:14540")
99

1010
print("Waiting for drone to connect...")
1111
async for state in drone.core.connection_state():

examples/failure_injection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/firmware_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def run():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

examples/follow_me_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
async def run():
2727
drone = System()
28-
await drone.connect(system_address="udp://:14540")
28+
await drone.connect(system_address="udpin://0.0.0.0:14540")
2929

3030
print("Waiting for drone to connect...")
3131
async for state in drone.core.connection_state():

examples/geofence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def run():
2121

2222
# Connect to the Simulation
2323
drone = System()
24-
await drone.connect(system_address="udp://:14540")
24+
await drone.connect(system_address="udpin://0.0.0.0:14540")
2525

2626
# Wait for the drone to connect
2727
print("Waiting for drone to connect...")

examples/gimbal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def fetch_gimbals():
3333
async def run():
3434
# Init the drone
3535
drone = System()
36-
await drone.connect(system_address="udp://:14540")
36+
await drone.connect(system_address="udpin://0.0.0.0:14540")
3737

3838
gimbals = await get_gimbals(drone)
3939

examples/goto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def run():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

examples/gripper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def run():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

examples/highres_imu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
async def get_imu_data():
66
# Connect to the drone
77
drone = System()
8-
await drone.connect(system_address="udp://:14540")
8+
await drone.connect(system_address="udpin://0.0.0.0:14540")
99

1010
# Wait for the drone to connect
1111
print("Waiting for drone to connect...")

examples/logfile_download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
async def run():
99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
print("Waiting for drone to connect...")
1313
async for state in drone.core.connection_state():

examples/manual_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def manual_controls():
3434
"""Main function to connect to the drone and input manual controls"""
3535
# Connect to the Simulation
3636
drone = System()
37-
await drone.connect(system_address="udp://:14540")
37+
await drone.connect(system_address="udpin://0.0.0.0:14540")
3838

3939
# This waits till a mavlink based drone is connected
4040
print("Waiting for drone to connect...")

examples/mission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/mission_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/mission_raw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
async def px4_connect_drone():
99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
print("Waiting for drone to connect...")
1313
async for state in drone.core.connection_state():

examples/offboard_attitude.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async def run():
1515
""" Does Offboard control using attitude commands. """
1616

1717
drone = System()
18-
await drone.connect(system_address="udp://:14540")
18+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1919

2020
print("Waiting for drone to connect...")
2121
async for state in drone.core.connection_state():

examples/offboard_from_csv/offboard_from_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def run():
108108

109109
# Connect to the drone
110110
drone = System()
111-
await drone.connect(system_address="udp://:14540")
111+
await drone.connect(system_address="udpin://0.0.0.0:14540")
112112

113113
# Wait for the drone to connect
114114
print("Waiting for drone to connect...")

examples/offboard_position_ned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async def run():
1818
""" Does Offboard control using position NED coordinates. """
1919

2020
drone = System()
21-
await drone.connect(system_address="udp://:14540")
21+
await drone.connect(system_address="udpin://0.0.0.0:14540")
2222

2323
print("Waiting for drone to connect...")
2424
async for state in drone.core.connection_state():

examples/offboard_position_velocity_ned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/offboard_velocity_body.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async def run():
1111
""" Does Offboard control using velocity body coordinates. """
1212

1313
drone = System()
14-
await drone.connect(system_address="udp://:14540")
14+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1515

1616
print("Waiting for drone to connect...")
1717
async for state in drone.core.connection_state():

examples/offboard_velocity_ned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async def run():
1111
""" Does Offboard control using velocity NED coordinates. """
1212

1313
drone = System()
14-
await drone.connect(system_address="udp://:14540")
14+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1515

1616
print("Waiting for drone to connect...")
1717
async for state in drone.core.connection_state():

examples/px4_ev_automation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def print_mode(drone):
5252

5353
async def main():
5454
drone = System()
55-
await drone.connect(system_address="udp://:14540")
55+
await drone.connect(system_address="udpin://0.0.0.0:14540")
5656

5757
print("Waiting for drone to connect...")
5858
async for state in drone.core.connection_state():

examples/px4_ev_automation_keyboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def set_params(system, params, announcement):
3232

3333
async def main():
3434
drone = System()
35-
await drone.connect(system_address="udp://:14540")
35+
await drone.connect(system_address="udpin://0.0.0.0:14540")
3636

3737
print("Waiting for drone to connect...")
3838
async for state in drone.core.connection_state():

examples/send_status_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
async def run():
2020

2121
drone = System(sysid=1)
22-
await drone.connect(system_address="udp://:14540")
22+
await drone.connect(system_address="udpin://0.0.0.0:14540")
2323

2424
print("Waiting for drone to connect...")
2525
async for state in drone.core.connection_state():

examples/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
async def run():
1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
asyncio.ensure_future(observe_shell(drone))
1414

examples/takeoff_and_land.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
async def run():
88

99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
status_text_task = asyncio.ensure_future(print_status_text(drone))
1313

examples/telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
async def run():
88
# Init the drone
99
drone = System()
10-
await drone.connect(system_address="udp://:14540")
10+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1111

1212
# Start the tasks
1313
asyncio.ensure_future(print_battery(drone))

examples/telemetry_flight_mode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def print_flight_mode():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

examples/telemetry_is_armed_is_in_air.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def run():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
asyncio.ensure_future(print_is_armed(drone))
1212
asyncio.ensure_future(print_is_in_air(drone))

examples/telemetry_status_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def print_status_text():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

examples/telemetry_takeoff_and_land.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def run():
2626

2727
# Init the drone
2828
drone = System()
29-
await drone.connect(system_address="udp://:14540")
29+
await drone.connect(system_address="udpin://0.0.0.0:14540")
3030

3131
print("Waiting for drone to connect...")
3232
async for state in drone.core.connection_state():

examples/tune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
async def run():
99

1010
drone = System()
11-
await drone.connect(system_address="udp://:14540")
11+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1212

1313
print("Waiting for drone to connect...")
1414
async for state in drone.core.connection_state():

examples/upload_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def main():
1010
parser = argparse.ArgumentParser()
1111
parser.add_argument(
1212
"connection",
13-
help="Connection string (e.g. udp://:14540)")
13+
help="Connection string (e.g. udpin://0.0.0.0:14540)")
1414
parser.add_argument(
1515
"param_file", help="Param file to be uploaded with .params format")
1616

examples/winch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
async def run():
88
drone = System()
9-
await drone.connect(system_address="udp://:14540")
9+
await drone.connect(system_address="udpin://0.0.0.0:14540")
1010

1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():

mavsdk/source/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The package contains ``mavsdk_server`` already (previously called "backend"), wh
4646
from mavsdk import System
4747
...
4848
drone = System()
49-
await drone.connect(system_address="udp://:14540")
49+
await drone.connect(system_address="udpin://0.0.0.0:14540")
5050
5151
5252
Note: ``System()`` takes two named parameters: ``mavsdk_server_address`` and ``port``. When left empty, they default to ``None`` and ``50051``, respectively, and ``mavsdk_server -p 50051`` is run by ``await drone.connect()``. If ``mavsdk_server_address`` is set (e.g. to "localhost"), then ``await drone.connect()`` will not start the embedded ``mavsdk_server`` and will try to connect to a server running at this address. This is useful for platforms where ``mavsdk_server`` does not come embedded, for debugging purposes, and for running ``mavsdk_server`` in a place different than where the MAVSDK-Python script is run.
@@ -76,7 +76,7 @@ For this case, let's assume the example was like this:
7676
.. code:: python
7777
7878
drone = System()
79-
await drone.connect(system_address="udp://:14540")
79+
await drone.connect(system_address="udpin://0.0.0.0:14540")
8080
8181
8282
The mavsdk_server binary is installed using ``pip``. If installed with ``python -m pip install --upgrade mavsdk`` it is usually (at least for Linux) to be found in ``~/.local/lib/python3.10/site-packages/mavsdk/bin/`` (of course depending on the Python version used).
@@ -85,21 +85,21 @@ It can then be run in a separate console with the ``system_address`` as an argum
8585

8686
.. code:: bash
8787
88-
~/.local/lib/python3.10/site-packages/mavsdk/bin/mavsdk_server udp://:14540
88+
~/.local/lib/python3.10/site-packages/mavsdk/bin/mavsdk_server udpin://0.0.0.0:14540
8989
9090
Without an autopilot connecting, the output will look something like:
9191

9292
.. code:: bash
9393
9494
[02:36:31|Info ] MAVSDK version: v1.4.16 (mavsdk_impl.cpp:28)
95-
[02:36:31|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20)
95+
[02:36:31|Info ] Waiting to discover system on udpin://0.0.0.0:14540... (connection_initiator.h:20)
9696
9797
Once an autopilot is discovered, something like this should be printed:
9898

9999
.. code:: bash
100100
101101
[02:38:12|Info ] MAVSDK version: v1.4.16 (mavsdk_impl.cpp:28)
102-
[02:38:12|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20)
102+
[02:38:12|Info ] Waiting to discover system on udpin://0.0.0.0:14540... (connection_initiator.h:20)
103103
[02:39:01|Info ] New system on: 127.0.0.1:14580 (with sysid: 1) (udp_connection.cpp:194)
104104
[02:39:01|Debug] New: System ID: 1 Comp ID: 1 (mavsdk_impl.cpp:484)
105105
[02:39:01|Debug] Component Autopilot (1) added. (system_impl.cpp:355)

0 commit comments

Comments
 (0)