Skip to content

Commit

Permalink
python node for plotting accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-edward committed Feb 1, 2024
1 parent 445920e commit 801fe25
Show file tree
Hide file tree
Showing 18 changed files with 143,995 additions and 0 deletions.
35,760 changes: 35,760 additions & 0 deletions uwrt_mars_rover_navigation/plot/backup_cleaned.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions uwrt_mars_rover_navigation/plot/calc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from math import radians, sin, cos, sqrt, atan2
import sys

def haversine_distance(lat1, lon1, lat2, lon2):
# Convert latitude and longitude from degrees to radians
lat1, lon1, lat2, lon2 = map(radians, [lat1, lon1, lat2, lon2])

# Haversine formula
dlat = lat2 - lat1
dlon = lon2 - lon1
a = sin(dlat / 2)**2 + cos(lat1) * cos(lat2) * sin(dlon / 2)**2
c = 2 * atan2(sqrt(a), sqrt(1 - a))

# Radius of the Earth in meters (mean value)
earth_radius = 6371000

# Calculate the distance
distance = earth_radius * c

return distance

# Define the fixed point
fixed_point = (43.54245135, -80.51818219)

# Read input from stdin
for line in sys.stdin:
timestamp, latitude, longitude = map(float, line.split())

# Calculate distance using the haversine_distance function
distance = haversine_distance(latitude, longitude, *fixed_point)

print(f"{timestamp} {distance}")
35,760 changes: 35,760 additions & 0 deletions uwrt_mars_rover_navigation/plot/cleaned.txt

Large diffs are not rendered by default.

35,761 changes: 35,761 additions & 0 deletions uwrt_mars_rover_navigation/plot/data.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 801fe25

Please sign in to comment.