本文整理汇总了Python中auvsi_suas.models.uas_telemetry.UasTelemetry类的典型用法代码示例。如果您正苦于以下问题:Python UasTelemetry类的具体用法?Python UasTelemetry怎么用?Python UasTelemetry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UasTelemetry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_closest_interpolated_distance
def test_closest_interpolated_distance(self):
utm = distance.proj_utm(zone=18, north=True)
# Test velocity filter.
waypoint = self.waypoints_from_data([(38, -76, 100)])[0]
entries = [(38, -76, 140), (40, -78, 600)]
logs = self.create_uas_logs(self.user, entries)
d = UasTelemetry.closest_interpolated_distance(logs[0], logs[1],
waypoint, utm)
self.assertAlmostEqual(40.0, d, delta=3)
# Test telemetry rate filter.
waypoint = self.waypoints_from_data([(38.145147, -76.427583, 100)])[0]
entries = [(38.145148, -76.427645, 100), (38.145144, -76.427400, 100)]
logs = self.create_uas_logs(self.user, entries)
logs[1].timestamp = logs[0].timestamp + datetime.timedelta(seconds=2)
d = UasTelemetry.closest_interpolated_distance(logs[0], logs[1],
waypoint, utm)
self.assertAlmostEqual(17.792, d, delta=3)
# Test interpolation (waypoint is halfway between telemetry logs).
waypoint = self.waypoints_from_data([(38.145146, -76.427522, 80)])[0]
entries = [(38.145148, -76.427645, 100), (38.145144, -76.427400, 100)]
logs = self.create_uas_logs(self.user, entries)
logs[1].timestamp = logs[0].timestamp + datetime.timedelta(seconds=1)
d = UasTelemetry.closest_interpolated_distance(logs[0], logs[1],
waypoint, utm)
self.assertAlmostEqual(20.0, d, delta=3)
示例2: test_kml_simple
def test_kml_simple(self):
coordinates = [
(-76.0, 38.0, 0.0),
(-76.0, 38.0, 10.0),
(-76.0, 38.0, 20.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 100.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 60.0),
]
# Create Coordinates
start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
start.save()
for coord in coordinates:
self.create_log_element(*coord)
end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
end.save()
kml = Kml()
UasTelemetry.kml(user=self.user,
logs=UasTelemetry.by_user(self.user),
kml=kml,
kml_doc=kml)
for coord in coordinates:
tag = self.coord_format.format(coord[1], coord[0],
units.feet_to_meters(coord[2]))
self.assertTrue(tag in kml.kml())
示例3: test_basic_access
def test_basic_access(self):
start = timezone.now() - datetime.timedelta(seconds=10)
logs = self.create_logs(self.user1, start=start)
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = UasTelemetry.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例4: get
def get(self, request):
kml = Kml(name='LIVE Data')
MovingObstacle.live_kml(kml, timedelta(seconds=5))
UasTelemetry.live_kml(kml, timedelta(seconds=5))
response = HttpResponse(kml.kml())
response['Content-Type'] = 'application/vnd.google-earth.kml+xml'
response['Content-Disposition'] = 'attachment; filename=update.kml'
response['Content-Length'] = str(len(response.content))
return response
示例5: create_log_element
def create_log_element(self, timestamp, user, lat, lon, alt, heading):
pos = GpsPosition(latitude=lat, longitude=lon)
pos.save()
apos = AerialPosition(gps_position=pos, altitude_msl=alt)
apos.save()
log = UasTelemetry(timestamp=timezone.now(),
user=user,
uas_position=apos,
uas_heading=heading)
log.save()
return log
示例6: test_no_data
def test_no_data(self):
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(None, log)
logs = UasTelemetry.by_user(self.user1)
self.assertEqual(len(logs), 0)
logs = UasTelemetry.by_time_period(self.user1, [])
self.assertSequenceEqual([], logs)
log_rates = UasTelemetry.rates(self.user1, [])
self.assertTupleEqual(log_rates, (None, None))
示例7: test_multi_user
def test_multi_user(self):
# Intersperse logs from two users
logs = []
for _ in xrange(10):
logs += self.create_logs(self.user1, num=1)
self.create_logs(self.user2, num=1)
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(logs[-1], log)
results = UasTelemetry.by_user(self.user1)
self.assertSequenceEqual(logs, results)
示例8: test_last_for_user_time_restrict
def test_last_for_user_time_restrict(self):
start = timezone.now()
delta = datetime.timedelta(seconds=1)
logs = self.create_logs(self.user1, num=10, start=start, delta=delta)
log = UasTelemetry.last_for_user(self.user1,
start_time=start,
end_time=start + delta * 3)
self.assertEqual(logs[2], log)
log = UasTelemetry.last_for_user(self.user1,
start_time=start + delta * 11)
self.assertIsNone(log)
log = UasTelemetry.last_for_user(self.user1, end_time=start - delta)
self.assertIsNone(log)
示例9: test_open_start
def test_open_start(self):
"""Logs (-inf, 2001)"""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(None, self.year2001),
])
self.assertSequenceEqual([self.year2000_logs], self.to_lists(results))
示例10: test_full_range
def test_full_range(self):
"""All logs from (-inf, inf)."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(None, None)
])
self.assertSequenceEqual([self.logs], self.to_lists(results))
示例11: test_single_period
def test_single_period(self):
"""Single set of logs accessible."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2000, self.year2001)
])
self.assertSequenceEqual([self.year2000_logs], self.to_lists(results))
示例12: test_open_end
def test_open_end(self):
"""Logs (2003, inf)"""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2003, None),
])
self.assertSequenceEqual([self.year2003_logs], self.to_lists(results))
示例13: test_non_intersecting_period
def test_non_intersecting_period(self):
"""No logs matched."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2001, self.year2002),
])
self.assertSequenceEqual([[]], self.to_lists(results))
示例14: test_by_user_time_restrict
def test_by_user_time_restrict(self):
start = timezone.now()
delta = datetime.timedelta(seconds=1)
expect_logs = self.create_logs(self.user1,
num=10,
start=start,
delta=delta)
logs = UasTelemetry.by_user(self.user1,
start_time=start,
end_time=start + delta * 10)
self.assertSequenceEqual(expect_logs, logs)
logs = UasTelemetry.by_user(self.user1, start_time=start + delta * 11)
self.assertSequenceEqual([], logs)
logs = UasTelemetry.by_user(self.user1, end_time=start)
self.assertSequenceEqual([], logs)
示例15: test_both_periods
def test_both_periods(self):
"""Both sets of logs, accesses individually."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2000, self.year2001),
TimePeriod(self.year2003, self.year2004),
])
self.assertSequenceEqual(
[self.year2000_logs, self.year2003_logs], self.to_lists(results))