Skip to content

Commit

Permalink
remove unnecesary sizetotal calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
All4Gis committed Apr 12, 2021
1 parent 8dd42dc commit df4ee66
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions code/manager/QgsMultiplexor.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def CreateMISB(self):
d[stripK] = stripV

# We create the klv file for every moment
sizeTotal = 0
bufferData = b""
cnt = 0

Expand All @@ -183,7 +182,6 @@ def CreateMISB(self):
_bytes = bytes(
PrecisionTimeStamp(datetime_to_bytes(date_end))
)
sizeTotal += len(_bytes)
bufferData += _bytes

# Platform Heading Angle
Expand All @@ -193,55 +191,48 @@ def CreateMISB(self):
OSD_yaw = OSD_yaw + 360

_bytes = bytes(PlatformHeadingAngle(OSD_yaw))
sizeTotal += len(_bytes)
bufferData += _bytes

# Platform Pitch Angle
if k == "OSD.pitch":
OSD_pitch = float(v)

_bytes = bytes(PlatformPitchAngle(OSD_pitch))
sizeTotal += len(_bytes)
bufferData += _bytes

# Platform Roll Angle
if k == "OSD.roll":
OSD_roll = float(v)

_bytes = bytes(PlatformRollAngle(OSD_roll))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Latitude
if k == "OSD.latitude":
OSD_latitude = float(v)

_bytes = bytes(SensorLatitude(OSD_latitude))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Longitude
if k == "OSD.longitude":
OSD_longitude = float(v)

_bytes = bytes(SensorLongitude(OSD_longitude))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor True Altitude
if k == "OSD.altitude [m]":
OSD_altitude = float(v)

_bytes = bytes(SensorTrueAltitude(OSD_altitude))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Ellipsoid Height
if k == "OSD.height [m]":
OSD_height = float(v)

_bytes = bytes(SensorEllipsoidHeightConversion(OSD_height))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Relative Azimuth Angle
Expand All @@ -250,22 +241,19 @@ def CreateMISB(self):
GIMBAL_yaw = 0.0

_bytes = bytes(SensorRelativeAzimuthAngle(GIMBAL_yaw))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Relative Elevation Angle
if k == "GIMBAL.pitch":
GIMBAL_pitch = float(v)

_bytes = bytes(SensorRelativeElevationAngle(GIMBAL_pitch))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Relative Roll Angle
if k == "GIMBAL.roll":
GIMBAL_roll = float(v)
_bytes = bytes(SensorRelativeRollAngle(GIMBAL_roll))
sizeTotal += len(_bytes)
bufferData += _bytes

except Exception as e:
Expand All @@ -282,21 +270,18 @@ def CreateMISB(self):
# CheckSum
v = abs(hash(end_path)) % (10 ** 4)
_bytes = bytes(Checksum(v))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Horizontal Field of View
v = self.sp_hfov.value()

_bytes = bytes(SensorHorizontalFieldOfView(float(v)))
sizeTotal += len(_bytes)
bufferData += _bytes

# Sensor Vertical Field of View
v = self.sp_vfov.value()

_bytes = bytes(SensorVerticalFieldOfView(float(v)))
sizeTotal += len(_bytes)
bufferData += _bytes

# TODO : Check these calculations
Expand All @@ -305,7 +290,6 @@ def CreateMISB(self):
slantRange = abs(OSD_altitude / (cos(radians(anlge))))

_bytes = bytes(SlantRange(slantRange))
sizeTotal += len(_bytes)
bufferData += _bytes

# Target Width
Expand All @@ -317,7 +301,6 @@ def CreateMISB(self):
except Exception:
_bytes = bytes(TargetWidth(0.0))

sizeTotal += len(_bytes)
bufferData += _bytes

# Frame Center Latitude
Expand All @@ -330,7 +313,6 @@ def CreateMISB(self):
)

_bytes = bytes(FrameCenterLatitude(framecenterlatitude))
sizeTotal += len(_bytes)
bufferData += _bytes

# Frame Center Longitude
Expand All @@ -340,13 +322,11 @@ def CreateMISB(self):
) / cos(radians(OSD_latitude))

_bytes = bytes(FrameCenterLongitude(framecenterlongitude))
sizeTotal += len(_bytes)
bufferData += _bytes

# Frame Center Elevation
frameCenterElevation = 0.0
_bytes = bytes(FrameCenterElevation(frameCenterElevation))
sizeTotal += len(_bytes)
bufferData += _bytes

# CALCULATE CORNERS COORDINATES
Expand All @@ -360,56 +340,47 @@ def CreateMISB(self):
#
# # Corner Latitude Point 1 (Full) CornerLatitudePoint1Full
# _bytes = bytes(CornerLatitudePoint1Full(cornerPointUL[0]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Longitude Point 1 (Full)
# _bytes = bytes(CornerLongitudePoint1Full(cornerPointUL[1]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Latitude Point 2 (Full)
# _bytes = bytes(CornerLatitudePoint2Full(cornerPointUR[0]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Longitude Point 2 (Full)
# _bytes = bytes(CornerLongitudePoint2Full(cornerPointUR[1]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Latitude Point 3 (Full)
# _bytes = bytes(CornerLatitudePoint3Full(cornerPointLR[0]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Longitude Point 3 (Full)
# _bytes = bytes(CornerLongitudePoint3Full(cornerPointLR[1]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Latitude Point 4 (Full)
# _bytes = bytes(CornerLatitudePoint4Full(cornerPointLL[0]))
# sizeTotal += len(_bytes)
# bufferData += _bytes
#
# # Corner Longitude Point 4 (Full)
# _bytes = bytes(CornerLongitudePoint4Full(cornerPointLL[1]))
# sizeTotal += len(_bytes)
# bufferData += _bytes

# Platform Pitch Angle (Full)
_bytes = bytes(PlatformPitchAngleFull(OSD_pitch))
sizeTotal += len(_bytes)
bufferData += _bytes

# Platform Roll Angle (Full)
_bytes = bytes(PlatformRollAngleFull(OSD_roll))
sizeTotal += len(_bytes)
bufferData += _bytes

# set packet header
writeData = UASLocalMetadataSet
sizeTotal = len(bufferData)
writeData += int_to_bytes(sizeTotal)
writeData += bufferData

Expand Down

0 comments on commit df4ee66

Please sign in to comment.