sbp_messages.py
Go to the documentation of this file.
00001 
00002 import struct
00003 
00004 # Automatically generated from sbp.yaml with generate.py, do not hand edit!
00005 
00006 
00007 
00008 SBP_STARTUP = 0xFF00
00009 class Startup:
00010   """
00011   SBP class for message STARTUP (0xFF00)
00012 
00013   The system start-up message is sent once on system start-up. It is
00014 intended to be used to notify the host or other attached devices that
00015 the system has started and is now ready to respond to commands or
00016 configuration requests.
00017 
00018   """
00019 
00020   def __init__(self, d):
00021     self.from_binary(d)
00022 
00023   def from_binary(self, d):
00024     (
00025       self.reserved,
00026     ) = struct.unpack('<I', d)
00027 
00028   def to_binary(self, d):
00029     return struct.pack('<I', (
00030       self.reserved,
00031     ))
00032 
00033 
00034 SBP_HEARTBEAT = 0xFFFF
00035 class Heartbeat:
00036   """
00037   SBP class for message HEARTBEAT (0xFFFF)
00038 
00039   The heartbeat message is sent periodically to inform the host or
00040 other attached devices that the system is running. It is intended to
00041 be used to monitor for system malfunctions and also contains
00042 status flags that indicate to the host the status of the system and
00043 if it is operating correctly.
00044 
00045 The system error flag is used to indicate that an error has occurred in
00046 the system. To determine the source of the error the remaining error
00047 flags should be inspected.
00048 
00049   """
00050 
00051   def __init__(self, d):
00052     self.from_binary(d)
00053 
00054   def from_binary(self, d):
00055     (
00056       self.flags,
00057     ) = struct.unpack('<I', d)
00058 
00059   def to_binary(self, d):
00060     return struct.pack('<I', (
00061       self.flags,
00062     ))
00063 
00064 
00065 SBP_GPS_TIME = 0x0100
00066 class GPSTime:
00067   """
00068   SBP class for message GPS_TIME (0x0100)
00069 
00070   GPS Time.
00071 
00072   """
00073 
00074   def __init__(self, d):
00075     self.from_binary(d)
00076 
00077   def from_binary(self, d):
00078     (
00079       self.wn,
00080       self.tow,
00081       self.ns,
00082       self.flags,
00083     ) = struct.unpack('<HIiB', d)
00084 
00085   def to_binary(self, d):
00086     return struct.pack('<HIiB', (
00087       self.wn,
00088       self.tow,
00089       self.ns,
00090       self.flags,
00091     ))
00092 
00093 
00094 SBP_DOPS = 0x0206
00095 class Dops:
00096   """
00097   SBP class for message DOPS (0x0206)
00098 
00099   Dilution of Precision.
00100 
00101   """
00102 
00103   def __init__(self, d):
00104     self.from_binary(d)
00105 
00106   def from_binary(self, d):
00107     (
00108       self.tow,
00109       self.gdop,
00110       self.pdop,
00111       self.tdop,
00112       self.hdop,
00113       self.vdop,
00114     ) = struct.unpack('<IHHHHH', d)
00115 
00116   def to_binary(self, d):
00117     return struct.pack('<IHHHHH', (
00118       self.tow,
00119       self.gdop,
00120       self.pdop,
00121       self.tdop,
00122       self.hdop,
00123       self.vdop,
00124     ))
00125 
00126 
00127 SBP_POS_ECEF = 0x0200
00128 class PosECEF:
00129   """
00130   SBP class for message POS_ECEF (0x0200)
00131 
00132   Position solution in absolute Earth Centered Earth Fixed (ECEF) coordinates.
00133 
00134   """
00135 
00136   def __init__(self, d):
00137     self.from_binary(d)
00138 
00139   def from_binary(self, d):
00140     (
00141       self.tow,
00142       self.x,
00143       self.y,
00144       self.z,
00145       self.accuracy,
00146       self.n_sats,
00147       self.flags,
00148     ) = struct.unpack('<IdddHBB', d)
00149 
00150   def to_binary(self, d):
00151     return struct.pack('<IdddHBB', (
00152       self.tow,
00153       self.x,
00154       self.y,
00155       self.z,
00156       self.accuracy,
00157       self.n_sats,
00158       self.flags,
00159     ))
00160 
00161 
00162 SBP_POS_LLH = 0x0201
00163 class PosLLH:
00164   """
00165   SBP class for message POS_LLH (0x0201)
00166 
00167   Geodetic position solution.
00168 
00169   """
00170 
00171   def __init__(self, d):
00172     self.from_binary(d)
00173 
00174   def from_binary(self, d):
00175     (
00176       self.tow,
00177       self.lat,
00178       self.lon,
00179       self.height,
00180       self.h_accuracy,
00181       self.v_accuracy,
00182       self.n_sats,
00183       self.flags,
00184     ) = struct.unpack('<IdddHHBB', d)
00185 
00186   def to_binary(self, d):
00187     return struct.pack('<IdddHHBB', (
00188       self.tow,
00189       self.lat,
00190       self.lon,
00191       self.height,
00192       self.h_accuracy,
00193       self.v_accuracy,
00194       self.n_sats,
00195       self.flags,
00196     ))
00197 
00198 
00199 SBP_BASELINE_ECEF = 0x0202
00200 class BaselineECEF:
00201   """
00202   SBP class for message BASELINE_ECEF (0x0202)
00203 
00204   Baseline in Earth Centered Earth Fixed (ECEF) coordinates.
00205 
00206   """
00207 
00208   def __init__(self, d):
00209     self.from_binary(d)
00210 
00211   def from_binary(self, d):
00212     (
00213       self.tow,
00214       self.x,
00215       self.y,
00216       self.z,
00217       self.accuracy,
00218       self.n_sats,
00219       self.flags,
00220     ) = struct.unpack('<IiiiHBB', d)
00221 
00222   def to_binary(self, d):
00223     return struct.pack('<IiiiHBB', (
00224       self.tow,
00225       self.x,
00226       self.y,
00227       self.z,
00228       self.accuracy,
00229       self.n_sats,
00230       self.flags,
00231     ))
00232 
00233 
00234 SBP_BASELINE_NED = 0x0203
00235 class BaselineNED:
00236   """
00237   SBP class for message BASELINE_NED (0x0203)
00238 
00239   Baseline in local North East Down (NED) coordinates.
00240 
00241   """
00242 
00243   def __init__(self, d):
00244     self.from_binary(d)
00245 
00246   def from_binary(self, d):
00247     (
00248       self.tow,
00249       self.n,
00250       self.e,
00251       self.d,
00252       self.h_accuracy,
00253       self.v_accuracy,
00254       self.n_sats,
00255       self.flags,
00256     ) = struct.unpack('<IiiiHHBB', d)
00257 
00258   def to_binary(self, d):
00259     return struct.pack('<IiiiHHBB', (
00260       self.tow,
00261       self.n,
00262       self.e,
00263       self.d,
00264       self.h_accuracy,
00265       self.v_accuracy,
00266       self.n_sats,
00267       self.flags,
00268     ))
00269 
00270 
00271 SBP_VEL_ECEF = 0x0204
00272 class VelECEF:
00273   """
00274   SBP class for message VEL_ECEF (0x0204)
00275 
00276   Velocity in Earth Centered Earth Fixed (ECEF) coordinates.
00277 
00278   """
00279 
00280   def __init__(self, d):
00281     self.from_binary(d)
00282 
00283   def from_binary(self, d):
00284     (
00285       self.tow,
00286       self.x,
00287       self.y,
00288       self.z,
00289       self.accuracy,
00290       self.n_sats,
00291       self.flags,
00292     ) = struct.unpack('<IiiiHBB', d)
00293 
00294   def to_binary(self, d):
00295     return struct.pack('<IiiiHBB', (
00296       self.tow,
00297       self.x,
00298       self.y,
00299       self.z,
00300       self.accuracy,
00301       self.n_sats,
00302       self.flags,
00303     ))
00304 
00305 
00306 SBP_VEL_NED = 0x0205
00307 class VelNED:
00308   """
00309   SBP class for message VEL_NED (0x0205)
00310 
00311   Velocity in local North East Down (NED) coordinates.
00312 
00313   """
00314 
00315   def __init__(self, d):
00316     self.from_binary(d)
00317 
00318   def from_binary(self, d):
00319     (
00320       self.tow,
00321       self.n,
00322       self.e,
00323       self.d,
00324       self.h_accuracy,
00325       self.v_accuracy,
00326       self.n_sats,
00327       self.flags,
00328     ) = struct.unpack('<IiiiHHBB', d)
00329 
00330   def to_binary(self, d):
00331     return struct.pack('<IiiiHHBB', (
00332       self.tow,
00333       self.n,
00334       self.e,
00335       self.d,
00336       self.h_accuracy,
00337       self.v_accuracy,
00338       self.n_sats,
00339       self.flags,
00340     ))
00341 
00342 
00343 
00344 msg_classses = {
00345   0xFF00: Startup,
00346   0xFFFF: Heartbeat,
00347   0x0100: GPSTime,
00348   0x0206: Dops,
00349   0x0200: PosECEF,
00350   0x0201: PosLLH,
00351   0x0202: BaselineECEF,
00352   0x0203: BaselineNED,
00353   0x0204: VelECEF,
00354   0x0205: VelNED,
00355 }
00356 
00357 def sbp_decode(t, d):
00358   return msg_classses[t](d)


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:58