@@ -40,13 +40,14 @@ def process_buffer_unsafe(self, buffer):
4040 inbytelen = len (inBytes )
4141 while current_msg_start_idx < inbytelen :
4242 current_msg_length = inBytes [current_msg_start_idx + 4 ] + 256 * inBytes [current_msg_start_idx + 5 ]
43+ if current_msg_start_idx + current_msg_length > inbytelen : # Message nicht mehr komplett
44+ break
4345 self .publish (inBytes [current_msg_start_idx :current_msg_start_idx + current_msg_length ])
4446 current_msg_start_idx += current_msg_length
4547
4648 def process_bytes (self , inBytes ):
4749 inByteIdx = 0
4850 while inByteIdx < len (inBytes ):
49-
5051 if self .searcherState == MessageSearcherState .waiting_for_sync :
5152 poppedByte = inBytes [inByteIdx ]
5253 inByteIdx += 1
@@ -69,8 +70,7 @@ def process_bytes(self, inBytes):
6970 else :
7071 self .searcherState = MessageSearcherState .waiting_for_sync
7172 elif self .searcherState == MessageSearcherState .fetching_bytes :
72- if len (
73- inBytes ) - 1 >= self .remainingByteCount + inByteIdx - 1 : # Der Buffer ist Länger als der Rest der Nachricht.
73+ if len (inBytes ) - 1 >= self .remainingByteCount + inByteIdx - 1 : # Der Buffer ist Länger als der Rest der Nachricht.
7474 self .currentBytes [self .currentByteIdx :self .currentByteIdx + self .remainingByteCount ] = inBytes [
7575 inByteIdx :inByteIdx + self .remainingByteCount ]
7676 self .currentByteIdx = self .currentByteIdx + self .remainingByteCount
@@ -902,6 +902,19 @@ def set_autozupt(self, enable: bool):
902902 parekf_zupt .payload .data ['action' ]= data .ParameterAction .CHANGING
903903 self .send_msg_and_waitfor_okay (parekf_zupt )
904904
905+ def get_startup (self ):
906+ '''Convenience getter for startup parameters of the device.
907+
908+ Raises:
909+ ClientTimeoutError: Timeout while waiting for response or parameter from the XCOM server
910+ ResponseError: The response from the system was not 'OK'.
911+
912+ '''
913+ msgToSend = data .getParameterWithID (data .PAREKF_STARTUPV2_Payload .parameter_id )
914+ msgToSend .payload .data ['action' ] = data .ParameterAction .REQUESTING
915+ self .send_msg_and_waitfor_okay (msgToSend )
916+ return self .wait_for_parameter ()
917+
905918 def set_startup (self , initPos = PositionTuple (Lon = 0.1249596927 , Lat = 0.8599914412 , Alt = 311.9 ),
906919 initPosStdDev : Sequence [float ] = [10 , 10 , 10 ], posMode : data .StartupPositionMode = data .StartupPositionMode .GNSSPOS , initHdg : float = 0 ,
907920 initHdgStdDev : float = 1 , hdgMode : data .StartupHeadingMode = data .StartupHeadingMode .DEFAULT , realign : bool = False , inMotion : bool = False ,
@@ -1100,6 +1113,7 @@ def disable_postproc(self):
11001113
11011114 def aid_pos (self , lonLatAlt : Sequence [float ], llhStdDev : Sequence [float ],
11021115 leverarmXYZ : Sequence [float ], leverarmStdDev : Sequence [float ],
1116+ enableMSLaltitude = 0 ,
11031117 time : float = 0 , timeMode : protocol .ExtAidingTimeMode = protocol .ExtAidingTimeMode .LATENCY ):
11041118 '''External position aiding
11051119
@@ -1108,18 +1122,19 @@ def aid_pos(self, lonLatAlt: Sequence[float], llhStdDev: Sequence[float],
11081122 llhStdDev: Standard deviation in the directions of (Lon, Lat, Alt) in (m, m, m)
11091123 leverarmXYZ: Leverarm in m
11101124 leverarmStdDev: Standard deviation of the leverarm in m
1125+ enableMSLaltitude: Set 1 if Altitude is meansealevel
11111126 time: Timestamp or latency, depending on the timeMode argument
11121127 timeMode (protocol.ExtAidingTimeMode): Selects whether the timestamp is a GPS second of week or a latency.
11131128
11141129 Raises:
11151130 ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11161131 ResponseError: The response from the system was not 'OK'.
11171132 '''
1118- msgToSend = data .getCommandWithID (data .CMD_EXT_Payload .command_id )
1133+ msgToSend = data .getCommandWithID (data .CMD_EXTAID_Payload .command_id )
11191134 msgToSend .payload .data ['time' ] = time
11201135 msgToSend .payload .data ['timeMode' ] = timeMode
11211136 msgToSend .payload .data ['cmdParamID' ] = 3
1122- msgToSend .payload .structString += 'dddddddddddd '
1137+ msgToSend .payload .structString += '12dI '
11231138 msgToSend .payload .data ['lon' ] = lonLatAlt [0 ]
11241139 msgToSend .payload .data ['lat' ] = lonLatAlt [1 ]
11251140 msgToSend .payload .data ['alt' ] = lonLatAlt [2 ]
@@ -1132,6 +1147,7 @@ def aid_pos(self, lonLatAlt: Sequence[float], llhStdDev: Sequence[float],
11321147 msgToSend .payload .data ['laXStdDev' ] = leverarmStdDev [0 ]
11331148 msgToSend .payload .data ['laYStdDev' ] = leverarmStdDev [1 ]
11341149 msgToSend .payload .data ['laZStdDev' ] = leverarmStdDev [2 ]
1150+ msgToSend .payload .data ['enableMSL_Alt' ] = enableMSLaltitude
11351151 self .send_msg_and_waitfor_okay (msgToSend )
11361152
11371153 def aid_vel (self , vNED : Sequence [float ], vNEDStdDev : Sequence [float ], time : float = 0 , timeMode : protocol .ExtAidingTimeMode = protocol .ExtAidingTimeMode .LATENCY ):
@@ -1147,7 +1163,7 @@ def aid_vel(self, vNED: Sequence[float], vNEDStdDev: Sequence[float], time: floa
11471163 ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11481164 ResponseError: The response from the system was not 'OK'.
11491165 '''
1150- msgToSend = data .getCommandWithID (data .CMD_EXT_Payload .command_id )
1166+ msgToSend = data .getCommandWithID (data .CMD_EXTAID_Payload .command_id )
11511167 msgToSend .payload .data ['time' ] = time
11521168 msgToSend .payload .data ['timeMode' ] = timeMode
11531169 msgToSend .payload .data ['cmdParamID' ] = 4
@@ -1173,7 +1189,7 @@ def aid_heading(self, heading: float, standard_dev: float, time: float = 0, time
11731189 ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11741190 ResponseError: The response from the system was not 'OK'.
11751191 '''
1176- msgToSend = data .getCommandWithID (data .CMD_EXT_Payload .command_id )
1192+ msgToSend = data .getCommandWithID (data .CMD_EXTAID_Payload .command_id )
11771193 msgToSend .payload .data ['time' ] = time
11781194 msgToSend .payload .data ['timeMode' ] = timeMode
11791195 msgToSend .payload .data ['cmdParamID' ] = 5
@@ -1195,7 +1211,7 @@ def aid_height(self, height: float, standard_dev: float, time: float =0, timeMod
11951211 ClientTimeoutError: Timeout while waiting for response or log from the XCOM server
11961212 ResponseError: The response from the system was not 'OK'.
11971213 '''
1198- msgToSend = data .getCommandWithID (data .CMD_EXT_Payload .command_id )
1214+ msgToSend = data .getCommandWithID (data .CMD_EXTAID_Payload .command_id )
11991215 msgToSend .payload .data ['time' ] = time
12001216 msgToSend .payload .data ['timeMode' ] = timeMode
12011217 msgToSend .payload .data ['cmdParamID' ] = 6
@@ -1242,7 +1258,7 @@ def get_antoffset(self, antenna):
12421258 '''
12431259 msgToSend = data .getParameterWithID (data .PARGNSS_ANTOFFSET_Payload .parameter_id )
12441260 msgToSend .payload .data ['action' ] = data .ParameterAction .REQUESTING
1245- msgToSend .payload .data ['reserved ' ] = antenna
1261+ msgToSend .payload .data ['reserved_paramheader ' ] = antenna
12461262 self .send_msg_and_waitfor_okay (msgToSend )
12471263 return self .wait_for_parameter ()
12481264
@@ -1263,7 +1279,7 @@ def set_antoffset(self, antenna=0, offset=[0, 0, 0], stdDev=[0.1, 0.1, 0.1]):
12631279 '''
12641280 msgToSend = data .getParameterWithID (data .PARGNSS_ANTOFFSET_Payload .parameter_id )
12651281 msgToSend .payload .data ['action' ] = data .ParameterAction .CHANGING
1266- msgToSend .payload .data ['reserved ' ] = antenna
1282+ msgToSend .payload .data ['reserved_paramheader ' ] = antenna
12671283 msgToSend .payload .data ['antennaOffset' ] = offset
12681284 msgToSend .payload .data ['stdDev' ] = stdDev
12691285 self .send_msg_and_waitfor_okay (msgToSend )
0 commit comments