Skip to content

Commit 3cddf8d

Browse files
committed
Encode RTCM data as base64 for compatibility with MAVSDK 3.0.0
1 parent 49c0cda commit 3cddf8d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/rtcm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import asyncio
4+
import base64
45
from mavsdk import System
56
from mavsdk.rtk import RtcmData
67

@@ -13,4 +14,6 @@ async def send_data(data):
1314

1415
if __name__ == '__main__':
1516
rtcm_data = bytearray(b'\xd3\x00mCP\x00\x8c2\x16\x82\x00\x00,@\x88\x00\x00\x00\x00\x00 \x00\x00\x00~\x9c\xa4\x9a\x90\xa2\x8c\x00\x00\x01\xa7\xa2\x1e=gv\x8f\x1fq{\\x13_\xc9\xdf\x17\x02L$\xb6\xdd\x17\x9a.\xe8\xba\x94\x02U6^\xa2^\x08\xac\xf5\xf4\x1d\xcc\n\x9d\xe7\xeb\x04R\x15\x92\x93\xf9o\xf2\xc1\xb5-j\xba\xf12`@\r\x83\xc0\xe8B\x0f\x05\xec\x8c\xfc\xc4\x88l\xac\x7f\xf1\x1aR\xc2\xbc\x87') # noqa: E501
16-
asyncio.run(send_data(RtcmData(str(rtcm_data))))
17+
# In MAVSDK 3.0.0 the data is expected to be base64 encoded string
18+
base64_rtcm_data = base64.b64encode(rtcm_data).decode('utf-8')
19+
asyncio.run(send_data(RtcmData(str(base64_rtcm_data))))

0 commit comments

Comments
 (0)