Skip to content
Snippets Groups Projects
Commit 1ee9c0cc authored by Ashwin Rao's avatar Ashwin Rao
Browse files

Updated relay, added requirements for parsing, and gitignore

parent 922775f9
No related branches found
No related tags found
No related merge requests found
./results/
./*venv/
set -x
results_folder="../results/"
# Add the header
echo "loc,tech,ts_relay,ts_client" > timestamps.csv
echo "loc,tech,rtt" > ping.csv
# Add the prefix to the timestamps and concatenate it to a final-csv
for tech in eth wifi 4G 5G
do
for loc in uni
do
fprefix=${loc}-${tech}
echo ${fprefix}
sed 's/^/'"${loc}"'\,'"${tech}"'\,/' ${results_folder}/${fprefix}-timestamps.txt >> timestamps.csv
cat ${results_folder}/${fprefix}-ping.txt | cut -d ' ' -f 7 | grep "time" | cut -d '=' -f 2 > tmp.txt
sed 's/^/'"${loc}"'\,'"${tech}"'\,/' tmp.txt >> ping.csv
done
done
rm tmp.txt
ipykernel
paho-mqtt == 1.5.0
seaborn == 0.11.1
......@@ -72,7 +72,9 @@ class MQTTRelay:
return
# """
# Read the log file and publish each RTCM3 frame in an individual message.
# Read the log file and publish each RTCM3 frame in an individual message.
# This approach when the rtkrcv writes to a log file. This approach has
# because the rtkrcv does not flush the contents.
# """
# def rtcm3_relay_file(fname, publisher):
# print("Reading File Now")
......@@ -97,7 +99,8 @@ class MQTTRelay:
# print(cnt)
# return True
"""
Connect to the tcp server created by rtknavi/rtklib.
Read the rtcm3 frames, and publish each frame as a message.
......@@ -111,21 +114,25 @@ class MQTTRelay:
print ("Connected to RTKRCV tcp port. Relaying the RTCM3 messages now")
while True:
data = self.sock.recv(4096)
data = [bytes(data[i:i+1]) for i in range(len(data))]
for i in range(len(data)):
data_byte = data[i]
# This needs to be optimized. Currently, we create a message each time the preamble is seen.
# The correct way would be to fetch the length, and encode the payload up to the length.
if data_byte == RTCM3_PREAMBLE:
if first_preamble is False:
self.mqtt_client.publish(topic=MQTT_RTCM3_TOPIC,
json.dumps({'rtcm3':base64.b64encode(rtcm3_frame).decode('utf-8'),
'timestamp': datetime.datetime.now().timestamp()}))
#utf8_rtcm3_frame = base64.b64encode(rtcm3_frame).decode('utf-8')
#self.publish_rtcm3(utf8_rtcm3_frame)
first_preamble = False
rtcm3_frame = bytes()
rtcm3_frame += data_byte
self.mqtt_client.publish(topic=MQTT_RTCM3_TOPIC,
json.dumps({'rtcm3':base64.b64encode(data).decode('utf-8'),
'timestamp': datetime.datetime.now().timestamp()}))
# data = [bytes(data[i:i+1]) for i in range(len(data))]
# OLD APPROACH BASED ON PREAMBLE SEARCH WHICH IS BUGGY.
# for i in range(len(data)):
# data_byte = data[i]
# # This needs to be optimized. Currently, we create a message each time the preamble is seen.
# # The correct way would be to fetch the length, and encode the payload up to the length.
# if data_byte == RTCM3_PREAMBLE:
# if first_preamble is False:
# self.mqtt_client.publish(topic=MQTT_RTCM3_TOPIC,
# json.dumps({'rtcm3':base64.b64encode(rtcm3_frame).decode('utf-8'),
# 'timestamp': datetime.datetime.now().timestamp()}))
# #utf8_rtcm3_frame = base64.b64encode(rtcm3_frame).decode('utf-8')
# #self.publish_rtcm3(utf8_rtcm3_frame)
# first_preamble = False
# rtcm3_frame = bytes()
# rtcm3_frame += data_byte
except IOError:
pass
except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment