Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
5
5Give
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ashwin Rao
5Give
Commits
1ee9c0cc
Commit
1ee9c0cc
authored
4 years ago
by
Ashwin Rao
Browse files
Options
Downloads
Patches
Plain Diff
Updated relay, added requirements for parsing, and gitignore
parent
922775f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
parse_results/create-csv.sh
+21
-0
21 additions, 0 deletions
parse_results/create-csv.sh
requirements.txt
+4
-0
4 additions, 0 deletions
requirements.txt
rtcm3_relay/rtcm_relay.py
+24
-17
24 additions, 17 deletions
rtcm3_relay/rtcm_relay.py
with
51 additions
and
17 deletions
.gitignore
0 → 100644
+
2
−
0
View file @
1ee9c0cc
./results/
./*venv/
This diff is collapsed.
Click to expand it.
parse_results/create-csv.sh
0 → 100755
+
21
−
0
View file @
1ee9c0cc
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
This diff is collapsed.
Click to expand it.
requirements.txt
0 → 100644
+
4
−
0
View file @
1ee9c0cc
ipykernel
paho-mqtt
== 1.5.0
seaborn
== 0.11.1
This diff is collapsed.
Click to expand it.
rtcm3_relay/rtcm_relay.py
+
24
−
17
View file @
1ee9c0cc
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment