|
2 | 2 |
|
3 | 3 | [](https://www.python.org/downloads/release/python-3120/) |
4 | 4 | [](https://lbesson.mit-license.org/) |
| 5 | +[](https://github.com/luk-kop/nmea-gps-emulator/actions/workflows/ci.yml) |
| 6 | +[](https://github.com/luk-kop/nmea-gps-emulator/actions/workflows/ci-multiplatform.yml) |
| 7 | +[](https://github.com/luk-kop/nmea-gps-emulator/actions/workflows/codeql.yml) |
| 8 | +[](https://codecov.io/gh/luk-kop/nmea-gps-emulator) |
5 | 9 |
|
6 | 10 | The **NMEA-GPS Emulator** is a simple script that emulates a GPS receiver (simulates unit's movement). Data generated by the script are sent to clients in **NMEA 0183** format. |
7 | 11 | This script can be useful for testing applications or systems that require some unit's GPS position data. |
@@ -48,6 +52,38 @@ $GPVTG,90.0,T,,M,10.5,N,19.4,K*51 |
48 | 52 | $GPZDA,173124.000,05,11,2021,0,0*50 |
49 | 53 | ``` |
50 | 54 |
|
| 55 | +*** |
| 56 | +## How It Works |
| 57 | + |
| 58 | +The emulator simulates realistic GPS receiver behavior through several key components: |
| 59 | + |
| 60 | +### Position Calculation |
| 61 | +- Uses **pyproj** library for geodetic calculations on the WGS84 ellipsoid |
| 62 | +- Calculates new positions based on current speed, heading, and time elapsed |
| 63 | +- Converts between geographic coordinates (lat/lon) and projected coordinates for accurate distance calculations |
| 64 | +- Updates position every second based on the unit's velocity vector |
| 65 | + |
| 66 | +### NMEA Sentence Generation |
| 67 | +- Generates 8 standard NMEA 0183 sentences with proper formatting |
| 68 | +- Calculates XOR checksums for each sentence to ensure data integrity |
| 69 | +- Simulates realistic GPS data including: |
| 70 | + - Satellite information (GPGSV) with pseudo-random satellite positions and signal strengths |
| 71 | + - Dilution of Precision (DOP) values for position accuracy estimation |
| 72 | + - Time synchronization with system clock |
| 73 | + |
| 74 | +### Threading Architecture |
| 75 | +- **Main thread**: Handles user input for interactive speed/course changes |
| 76 | +- **Worker threads**: Manage client connections and data transmission |
| 77 | + - TCP Server mode: Accepts up to 10 concurrent client connections |
| 78 | + - TCP/UDP Stream mode: Maintains persistent connection to specified client |
| 79 | + - Serial mode: Transmits data via RS-232 serial port |
| 80 | +- Thread-safe communication using events and locks for coordinated shutdown |
| 81 | + |
| 82 | +### Data Transmission |
| 83 | +- Sends complete NMEA sentence sets every second |
| 84 | +- Automatically updates position before each transmission |
| 85 | +- Supports interactive runtime modifications of speed and heading without interrupting data flow |
| 86 | + |
51 | 87 | *** |
52 | 88 | ## Getting Started |
53 | 89 |
|
@@ -152,3 +188,23 @@ After starting the script correctly, the following prompt should appear in the O |
152 | 188 | 4 - Quit |
153 | 189 | >>> |
154 | 190 | ``` |
| 191 | + |
| 192 | +*** |
| 193 | +## Contributing |
| 194 | + |
| 195 | +Contributions are welcome! When creating a pull request, please ensure your branch name follows the naming convention: |
| 196 | + |
| 197 | +**Valid branch name prefixes:** |
| 198 | +- `feature/` - New features |
| 199 | +- `fix/` or `bugfix/` - Bug fixes |
| 200 | +- `hotfix/` - Urgent fixes |
| 201 | +- `docs/` - Documentation changes |
| 202 | +- `chore/` - Maintenance tasks |
| 203 | +- `refactor/` - Code refactoring |
| 204 | +- `test/` - Test additions or modifications |
| 205 | +- `ci/` - CI/CD changes |
| 206 | +- `release/` - Release preparation |
| 207 | + |
| 208 | +**Example:** `feature/add-nmea-sentence` or `fix/serial-port-timeout` |
| 209 | + |
| 210 | +Pull requests with branch names not following this convention will be rejected by CI validation. |
0 commit comments