How to send GPS postion to ESP32 from python/GPSD

Hi,
Really like and impressed by how far you have done with a LoRa ESP32 module.

I am looking forward to put a tile server and simple render on RPi Zero and combining it with Meshtastic dongle. Basically, it will need a PostgreSQL and some data dump, a working tile server, a tile renderer, could be OpenGL ES or node/npm but need a modern browser likely to be your cell phone.

I am pretty confident to run the map part on docker, I also want to run the Meshtastic-python part on Docker in RPi, here’s where i need some guidance:

My GPS module is (ublox m8q) connected to RPi serial port, to get PPS sync and local NTP sync, so I need to transfer the current GPS position to the Meshtastic part, I did a brief overview with the StreamInterface in init.py, but could not find a method.

The Meshtastic Android app looks like is capable to transfer GPS location from cell phone to the dongle, how it was done? could this be easily ported to the python bridge?

My guess is i need to implement a pbf message to post my location from other sources if ESP32 doesn’t have a direct connection, could you explain a little bit more? I would like to have a GPSD client to work with this.

Thanks in advance.

1 Like

Hi. Good questions. Yes, the android app sends position packets using the same send datapacket function that sending text messages use (just the payload is different). The local device is smart enough to sniff that packet and if it sees it is a location update it updates its own local state (identically to if it had a built in GPS).

You are correct that in the python API there is no wrapper that hides the boilerplate of making a position packet. But there should be, for two reasons:

  • The code for that sendPosition() method would be good example code on how to use the send packet method
  • It would be useful on its own

So I’ll add this later today and post about it when the library is updated with pip.

2 Likes

Ok - I think the new sendPosition() method I just added should work well for you. You should call it only occasionally, because each time you call it broadcasts a packet to the entire mesh (by default - you could also send positions only to a particular node)

If you do a “pip install --upgrade meshtastic” you’ll get the new code.

1 Like

Thanks for responding much quicker than i expected. I have my T-Beam on the way, and I will try to compile and run the new python code. Something happened to me that my work with this will be delayed. I will update you asap.

1 Like

A post was split to a new topic: Python command to set location with negative values?