File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 3
3
import asyncio
4
4
import serial
5
5
from mavsdk import System , rtk
6
+ import base64
6
7
7
8
PREAMBLE_RTCM = 0xD3
8
9
PREAMBLE_UBX = 0xB5
@@ -135,15 +136,15 @@ async def send_rtcm(drone):
135
136
if rtcm_correction_data is None :
136
137
continue
137
138
138
- # We convert the data to a string here as the API wants it even
139
- # though it should be raw bytes.
140
- # This creates an odd Python string that gets decoded on the
141
- # C++ server side.
142
- # With MAVSDK v2, the API will change to a vector of bytes
143
- # instead of this clunky string.
139
+ # Convert the rtcm data to a base64,
140
+ # In MAVSDK v3 the rtcm data is expected
141
+ # to be base64 encoded string .
142
+ base64_rtcm_data = base64 .b64encode (
143
+ rtcm_correction_data ).decode ('utf-8' )
144
144
145
+ # Send RTCM
145
146
await drone .rtk .send_rtcm_data (
146
- rtk .RtcmData (str ( rtcm_correction_data ) ))
147
+ rtk .RtcmData (base64_rtcm_data ))
147
148
148
149
elif ord (preamble ) == PREAMBLE_UBX :
149
150
ubx = ubx_parser .read_packet (ublox , preamble )
You can’t perform that action at this time.
0 commit comments