Code Monkey home page Code Monkey logo

ubx-gps-simulator's Introduction

README

There's a bunch of scripts and tools that allow to communicate with u-blox GPS receivers. However, I was unable to find scripts or tools that simulate the GPS receiver side. This Python script simulates the GPS receiver serial communication using UBX message protocol over Universal Asynchronous Receiver/Transmitter (UART). The idea is to replace the GPS receiver hardware by running this script - e.g. for testing code indoors before using it with real hardware.

The simulator is planned to implement the proprietary (but with an accessible specification document) u-blox 6 GPS receiver UBX message protocol. It may also apply for other u-blox GPS receivers - if you know more, let us know.

Its functionality is currently limited to:

  • receiving all messages and evaluating their checksums,
  • decoding and dumping decoded messages on the console,
  • recognizing CFG class messages (0x06) and replying with an ACK-ACK.

Disclaimer: The code has a lot of hacks, feel free to improve it and make a pull request! Please also understand that this software will never cover all functions of the real GPS receiver hardware - and there are likely some bugs in the code (search for FIXME and TODO)!

Usage

usage: ubx_gps_simulator.py [-h] [-b SERIAL_BAUDRATE] [-t IO_TARGET]
                            serial_port_name

ubx_gps_simulator.py Run simulated UBX GPX receiver.

positional arguments:
  serial_port_name      Serial port name

optional arguments:
  -h, --help            show this help message and exit
  -b SERIAL_BAUDRATE, --serial-baudrate SERIAL_BAUDRATE
                        Serial baudrate with which the simulator is accessed
                        initially (default: 9600, possible: 4800, 9600, 19200,
                        38400, 57600, 115200)
  -t IO_TARGET, --io-target IO_TARGET
                        I/O target ID (default: 1, possible: 1, 2)

Usage examples for OpenBikeSensor (OBS)

See OpenBikeSensor Usage.

Other projects

ubx-gps-simulator's People

Contributors

maehw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mfkiwl

ubx-gps-simulator's Issues

Issue runnig the simulator with Ardupilot

Hi, I'm trying run simulate ubx GPS into Ardupilot (4.4.2)
after im running the script Ardupilot detects the GPS as ublox and disconnects.

thats the log from Pycharm terminal

C:\PycharmProjects\GPS\venv\Scripts\python.exe C:\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py -b 115200 -t 2 COM17
Opened serial port 'COM17' with a baudrate of 115200 and serial blocking read timeout of 0.01 seconds. Simulating I/O target #2.

Received VALID message: class 0x06, ID 0x01 w/ payload b'\x01\x06\x01' (length: 3).
CFG-MSG for class 0x01, ID 0x06 (NAV-SOL).
Rate for current target: b'\x01'
Requested rate change: class=0x01, ID=0x06, rate=b'\x01'
<<< Sending ACK-ACK response: b'\xb5b\x05\x01\x02\x00\x06\x01\x0f8'

Received VALID message: class 0x06, ID 0x00 w/o payload.
Poll the configuration of the used I/O Port.
<<< Sending ACK-ACK response: b'\xb5b\x05\x01\x02\x00\x06\x00\x0e7'

Received VALID message: class 0x06, ID 0x00 w/o payload.
Poll the configuration of the used I/O Port.
<<< Sending ACK-ACK response: b'\xb5b\x05\x01\x02\x00\x06\x00\x0e7'

Received VALID message: class 0x06, ID 0x00 w/o payload.
Poll the configuration of the used I/O Port.
<<< Sending ACK-ACK response: b'\xb5b\x05\x01\x02\x00\x06\x00\x0e7'

Traceback (most recent call last):
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 1051, in
run()
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 1047, in run
simulator.run()
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 324, in run
if self.check_cyclic_tx(base_rate_count, msg_class=b'\x01', msg_id=b'\x06'):
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 764, in check_cyclic_tx
return base_rate_count % self.message_rates[msg_class][msg_id]['rate'] == 0
TypeError: unsupported operand type(s) for %: 'int' and 'bytes'

Process finished with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.