Skip to main content

A python module for the Blue Robotics Ping1D echosounder

Project description

BlueRobotics-Ping

Travis Build Status Gitter

Python library for the Ping sonar. Ping is the simple, affordable, and compact ultrasonic altimeter for any aquatic project.

This library exposes all functionality of the device, such as getting profiles, controlling parameters, switching modes, or just simply reading in the distance measurement.

Available here



Resources

Installing

pip

$ pip install --user bluerobotics-ping

From source

$ git clone https://github.com/bluerobotics/ping-python.git
$ cd ping-python
$ python setup.py install --user

The library is ready to use: import brping. If you would like to use the command line examples or tools provided by this package, follow the notes in python's installing to user site directions (eg export PATH=PATH:~/.local/bin).

Quick Start

The bluerobotics-ping package installs a simplePingExample.py script to get started. Place your device's file descriptor (eg. /dev/ttyUSB0, COM1) after the --device option.

$ simplePingExample.py --device <your-device>

Usage

The Ping1D class provides an easy interface to configure a Ping device and retrieve data.

A Ping1D object must be initialized with the serial device path and the baudrate.

from brping import Ping1D
myPing = Ping1D("/dev/ttyUSB0", 115200)

Call initialize() to establish communications with the device.

if myPing.initialize() is False:
    print("Failed to initialize Ping!")
    exit(1)

Use get_<message_name> to request data from the device. The data is returned as a dictionary with keys matching the names of the message payload fields. The messages you may request are documented in the ping-protocol.

    data = myPing.get_distance()
    if data:
        print("Distance: %s\tConfidence: %s%%" % (data["distance"], data["confidence"]))
    else:
        print("Failed to get distance data")

Use the set_* messages (eg. set_speed_of_sound()) to change settings on the Ping device.

    # set the speed of sound to use for distance calculations to
    # 1450000 mm/s (1450 m/s)
    myPing.set_speed_of_sound(1450000)

See the doxygen documentation for complete API documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bluerobotics-ping-0.0.4.tar.gz (12.5 kB view details)

Uploaded Source

File details

Details for the file bluerobotics-ping-0.0.4.tar.gz.

File metadata

  • Download URL: bluerobotics-ping-0.0.4.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/2.7.15

File hashes

Hashes for bluerobotics-ping-0.0.4.tar.gz
Algorithm Hash digest
SHA256 966444c51149ace1320b8c1313e88382ed0ceea30615c07fe41eab72bfb97dfd
MD5 a70002270b52845e984e649149ee9336
BLAKE2b-256 0931d6a40a90e1add4148a431e3d14db776d00ed61ae2d4245ce69fecbe8c8b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page