Reads GPS position from gpds on Linux systems. This program is used in the PE1RXF Reticulum Portable Server from Mees Electronics.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB

5 days ago
#
# Simple program to read gpsd and return the APRS formatted position string including the APRS symbol.
# Can be used to generate position beacons
#
# (C)2025 M.T. Konstapel https://meezenest.nl/mees
#
# get_position.oy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PE1RXF-APRS-server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
import gpsd2
import geo_util
# Define APRS symbol, camp ground = /;
SymbolTableIdentifier = '/'
SymbolCode = ';'
try:
# Connect to the local gpsd
gpsd2.connect()
# Connect somewhere else
gpsd2.connect(host="127.0.0.1", port=2947)
# Get gps position
packet = gpsd2.get_current()
# See the inline docs for GpsResponse for the available data
aprs_position = packet.position()
except:
aprs_position = (0,0)
# Translate the gps location data to the APRS location standard
aprs_lat = geo_util.dec2dm_lat(aprs_position[0])
aprs_lng = geo_util.dec2dm_lng(aprs_position[1])
aprs_location='!'+aprs_lat+SymbolTableIdentifier+aprs_lng+SymbolCode
aprs_beacon = aprs_location + 'Portable HAM station'
print(aprs_location)
#print(aprs_beacon)