Adding gpsd support #67

Open
opened 2026-10-05 01:19:11 +02:00 by adam · 15 comments
Owner

I am intersted in adding gpsd support to meshing around. I run my meshing around node in my car on a raspi

Is there commuity intrest for this feature and would the maintainers be interested in adding it as a feature.

If so , any tips or suggestions would be appreciated.

The python code is quite simple and if a maintainer would like a gps USB testing module ($14 amazon). I would be happy to provide that rather then learning the code for meshing around my self. LOL.

In either case LMK.

Thanks for any consideration.

Gustav

Below is some sample code for how simple it can be.

`#!/usr/bin/env python3

import gps

session = gps.gps(mode=gps.WATCH_ENABLE)

try:
while 0 == session.read():
if not (gps.MODE_SET & session.valid):
# not useful, probably not a TPV (time, position, velocity message
continue

    print('Mode: %s(%d) Time: ' %
          (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode],
           session.fix.mode), end="")
    # print time, if we have it
    if gps.TIME_SET & session.valid:
        print(session.fix.time, end="")
    else:
        print('n/a', end="")

    if ((gps.isfinite(session.fix.latitude) and
         gps.isfinite(session.fix.longitude))):
        print(" Lat %.6f Lon %.6f" %

`

I am intersted in adding gpsd support to meshing around. I run my meshing around node in my car on a raspi Is there commuity intrest for this feature and would the maintainers be interested in adding it as a feature. If so , any tips or suggestions would be appreciated. The python code is quite simple and if a maintainer would like a gps USB testing module ($14 amazon). I would be happy to provide that rather then learning the code for meshing around my self. LOL. In either case LMK. Thanks for any consideration. Gustav Below is some sample code for how simple it can be. `#!/usr/bin/env python3 import gps session = gps.gps(mode=gps.WATCH_ENABLE) try: while 0 == session.read(): if not (gps.MODE_SET & session.valid): # not useful, probably not a TPV (time, position, velocity message continue print('Mode: %s(%d) Time: ' % (("Invalid", "NO_FIX", "2D", "3D")[session.fix.mode], session.fix.mode), end="") # print time, if we have it if gps.TIME_SET & session.valid: print(session.fix.time, end="") else: print('n/a', end="") if ((gps.isfinite(session.fix.latitude) and gps.isfinite(session.fix.longitude))): print(" Lat %.6f Lon %.6f" % ` <!-- github-sync-id:3305298444 -->
Author
Owner

Is the idea for the bot config to be updated? Or the node firmware?

Is the idea for the bot config to be updated? Or the node firmware? <!-- github-comment-id:3169605356 -->
Author
Owner

Sorry, Im not sure exactly what this will take
If it in my car moving what should be updated.
The raspi it is pluged into has gpsd running.
Im really just looking for advice before I start coding.
It seems like you are seeing an issue Im an not anticipating.

Sorry, Im not sure exactly what this will take If it in my car moving what should be updated. The raspi it is pluged into has gpsd running. Im really just looking for advice before I start coding. It seems like you are seeing an issue Im an not anticipating. <!-- github-comment-id:3169862854 -->
Author
Owner

So most of the bot location data depends on the node location - it will default back if none found.

Are you looking to have the node updated? Or the default bot location.

I think it's worth exploring just wondering how the use case is I need to be a bit cautious of including stuff which can't run on the femtofox the memory load for gps isn't huge but .. if all I am going to do is reset the default config ini ... (I have a separate tool I could use to do this)

So most of the bot location data depends on the node location - it will default back if none found. Are you looking to have the node updated? Or the default bot location. I think it's worth exploring just wondering how the use case is I need to be a bit cautious of including stuff which can't run on the femtofox the memory load for gps isn't huge but .. if all I am going to do is reset the default config ini ... (I have a separate tool I could use to do this) <!-- github-comment-id:3170171509 -->
Author
Owner

From discord possible solution for meshtasticD

#!/bin/bash

# Create FIFO if it doesn't exist
if [ ! -p /dev/gpsd-out ]; then
    sudo mkfifo /dev/gpsd-out
    sudo chown "$(id -u):$(id -g)" /dev/gpsd-out
fi

# Start gpspipe in the background
gpspipe --nmea -o /dev/gpsd-out &
GPSPIPE_PID=$!

# Start meshtasticd (in foreground)
meshtasticd 

# Optionally wait for gpspipe (only if foreground meshtasticd exits)
wait $GPSPIPE_PID
From discord possible solution for meshtasticD ``` #!/bin/bash # Create FIFO if it doesn't exist if [ ! -p /dev/gpsd-out ]; then sudo mkfifo /dev/gpsd-out sudo chown "$(id -u):$(id -g)" /dev/gpsd-out fi # Start gpspipe in the background gpspipe --nmea -o /dev/gpsd-out & GPSPIPE_PID=$! # Start meshtasticd (in foreground) meshtasticd # Optionally wait for gpspipe (only if foreground meshtasticd exits) wait $GPSPIPE_PID ``` <!-- github-comment-id:3170195812 -->
Author
Owner

Im am suggesting rather then directly adding lon lat to the config file let it pick it up form GPSD. This should extend to the weather SAME code lookup via IP. I run meshing around in my car so the location changes frequently.

Above you say
"So most of the bot location data depends on the node location - it will default back if none found."
doest that mean it trys to use the node's location first and then the config file's lon lat?

Thanks fro such a great product.

Im am suggesting rather then directly adding lon lat to the config file let it pick it up form GPSD. This should extend to the weather SAME code lookup via IP. I run meshing around in my car so the location changes frequently. Above you say _"So most of the bot location data depends on the node location - it will default back if none found."_ doest that mean it trys to use the node's location first and then the config file's lon lat? Thanks fro such a great product. <!-- github-comment-id:3513668647 -->
Author
Owner

Interesting, pondering.

Interesting, pondering. <!-- github-comment-id:3513683300 -->
Author
Owner

https://api.weather.gov/points/38.9807,-76.9373

https://www.weather.gov/media/documentation/docs/NWS_Geolocation.pdf

it bypasses SAME code and will give links to forcast and alerst from from lon lat

https://api.weather.gov/points/38.9807,-76.9373 https://www.weather.gov/media/documentation/docs/NWS_Geolocation.pdf it bypasses SAME code and will give links to forcast and alerst from from lon lat <!-- github-comment-id:3513745984 -->
Author
Owner

Yea this is how it works today. The config.ini value just isn't updated after load for the bot logic. When no gps

Do you think using bots node lat long is better vs gpsd for a default?

Yea this is how it works today. The config.ini value just isn't updated after load for the bot logic. When no gps Do you think using bots node lat long is better vs gpsd for a default? <!-- github-comment-id:3513810180 -->
Author
Owner

Any node asking will have good results if they have valid gps

Any node asking will have good results if they have valid gps <!-- github-comment-id:3513812060 -->
Author
Owner

Honestly it depends on use case, I have a GPS on the the node and on the Raspi in the car controlling it.

All I can say is the GPS antenna is on top of my car and the Heltec T114 /w GPS is deeper inside. With modern GPS and "significant figures" for weather location either is fine.

Wait so if a remote node 3 hops away has a GPS they get"their" local weather. So the SAME codes in the config file doesn't matter unless the node has no GPS

That's so awesome

Honestly it depends on use case, I have a GPS on the the node and on the Raspi in the car controlling it. All I can say is the GPS antenna is on top of my car and the Heltec T114 /w GPS is deeper inside. With modern GPS and "significant figures" for weather location either is fine. Wait so if a remote node 3 hops away has a GPS they get"their" local weather. So the SAME codes in the config file doesn't matter unless the node has no GPS That's so awesome <!-- github-comment-id:3513830017 -->
Author
Owner

Correct the config.ini value is static for only broadcast alerts, and used when there isn't a location.

Otherwise anything location related is using the X hop shared location, or whatever we saw for it last in the nodedb

Correct the config.ini value is static for only broadcast alerts, and used when there isn't a location. Otherwise anything location related is using the X hop shared location, or whatever we saw for it last in the nodedb <!-- github-comment-id:3513857529 -->
Author
Owner

IMHO GPSD is is not needed in the way you implemented this. ( needing GPSD is kinda a extreme edge case)

I just would like to confirm

  1. The weather SAME code are not needed either as the look up is done using lon lat of the requesters GPS data if exists.
    else:
    The node running meshing-aound location is used based on the node's GPS data

  2. Does it continusiouly update GPS location from the node

Thanks

IMHO GPSD is is not needed in the way you implemented this. ( needing GPSD is kinda a extreme edge case) I just would like to confirm 1. The weather SAME code are not needed either as the look up is done using lon lat of the requesters GPS data if exists. else: The node running meshing-aound location is used based on the node's GPS data 2. Does it continusiouly update GPS location from the node Thanks <!-- github-comment-id:3513893974 -->
Author
Owner
  1. Only used for alert broadcasts
    1.1 possible enhancement but it would need some tool to reverse code from lat long into existence.

  2. For everything but alert broadcasts which use same
    2.2 if not known fallback to config.ino value
    2.2.1 wxa, wxalert, volcano, earthquake, Whereami etc .. they will ALL try and use the requesters location first

1. Only used for alert broadcasts 1.1 possible enhancement but it would need some tool to reverse code from lat long into existence. 2. For everything but alert broadcasts which use same 2.2 if not known fallback to config.ino value 2.2.1 wxa, wxalert, volcano, earthquake, Whereami etc .. they will ALL try and use the requesters location first <!-- github-comment-id:3513967019 -->
Author
Owner

1.1 Take a look at the NWS links I send above. it bypasses the SAME code and gets you the same thing.
It will take 2 calls that return JSON

1.1 Take a look at the NWS links I send above. it bypasses the SAME code and gets you the same thing. It will take 2 calls that return JSON <!-- github-comment-id:3514035018 -->
Author
Owner

This is how requests work today.

But broadcasts need to be filtered I don't see a way to filter just request?

Scheduler command can run wxa or wxalert every set time? This would effectively do the same thing?

This is how requests work today. But broadcasts need to be filtered I don't see a way to filter just request? Scheduler command can run wxa or wxalert every set time? This would effectively do the same thing? <!-- github-comment-id:3514403926 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/meshing-around#67