Skip to content

Add TCP Connection to DGPS #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmachuca77
Copy link
Contributor

@jmachuca77 jmachuca77 commented Mar 9, 2020

Emlid Reach GPS can only publish the RTCM corrections using TCP or Serial connections. This adds the ability to select between UDP and TCP and allows configuration of the IP, PORT, CONNTYPE. It adds four commands (following the ntrip modules model):
start
stop
status
set

by default it is configure the same as it was before (UDP, 127.0.0.1, 13320)

I don't have a GPS that publishes corrections via UDP to test, but it should work. I did test the TCP connection

based on:
https://github.com/antonvh/MAVProxy/tree/reach_inject
by @antonvh

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given you are now parsing the data, maybe add status like for ntrip module where it shows counts of each pkt type?

except:
print ("ERROR: Failed to connect to RTCM base over TCP, retrying in 2.5s")
self.waiting = True
threading.Timer(2.5,self.connect_tcp_rtcm_base(ip, port)).start()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want a timer here, instead use the idle task to check for a pending connection. See the start_pending code in the mavproxy_ntrip module

try:
data = self.port.recv(1024) # Attempt to read up to 1024 bytes.
data = self.port.recv(1) # Attempt to read up to 1024 bytes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment doesn't match code, and why read one byte at a time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am copying what is done in the NTRIP library:

data = self.socket.recv(1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the function

def read(self, byte):

takes one byte at a time.

@jmachuca77
Copy link
Contributor Author

I have already added the status count for each packet, So that can be seen with the status command.

@jmachuca77 jmachuca77 changed the title Add TCP Connection to DGPS WIP: Add TCP Connection to DGPS Apr 8, 2020
@jmachuca77
Copy link
Contributor Author

@tridge This seems to be working pretty good now, let me know if you want me to squash the three commits into one, but I think its ready to merge.

@jmachuca77 jmachuca77 changed the title WIP: Add TCP Connection to DGPS Add TCP Connection to DGPS Apr 9, 2020
@jmachuca77
Copy link
Contributor Author

Squashed

@tridge
Copy link
Contributor

tridge commented Apr 12, 2020

please test with both py2 and py3

@amilcarlucas
Copy link
Contributor

amilcarlucas commented Dec 29, 2020

This needs a rebase and some more testing.
Part of the functionality is a duplicate from #408. I will close #408 in favor of this one if this ones gets more testing

@stw2nf
Copy link

stw2nf commented Nov 30, 2024

do you have a build that I could test/run? Really interested in this feature. we have a Emlid Reach M2 we would like to automate RTK corrections with via Rpi, but having troubles rebasing this branch on master and actually testing functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants