It is a serial communicator(controller, receiver...), communicate with sensor LP20 which is a laser ranger.

Overview

Intro

It is a serial communicator(controller, receiver...), communicate with sensor LP20 which is a laser ranger.

Its datasheet is contained in this repo.

dir Tree

sensors
 ├── drivers
 │   ├── Crc.py
 │   ├── Laser.py
 │   ├── Serial.py
 │   └── __init__.py
 ├── LPxx-DataSheet_V0.5.pdf
 ├── main.py
 ├── readme.md
 └── stable_test.py

Usage

code

shown in both below and main.py

from drivers.Laser import *

if __name__ == '__main__':
    mylaser = MyLaserLowSpeed('COM13')
    mylaser.first_start()   # 初次启动(包含了初始化)

    '''
    读取`key`和`value`的原始数据
    '''
    print('='*20, 'focus on the raw datas')
    try:
        '''
        ·异常捕获·,也可不要. It is save to do so. Or just drop it.
        '''
        i = 0  # 计数
        for k, v in mylaser.reader():
            i += 1
            print(k, v)

            if i == 10:
                # 只测10次
                mylaser.stop()
                break
    except Exception as e:
        print(traceback.format_exc())
        raise
    except:
        mylaser.stop()  # 停止激光设备



    '''
    读取`测量状态`和`距离`数据
    '''
    print('='*20, 'focus on the distance datas')
    mylaser.start()
    try:
        '''
        ·异常捕获·,也可不要.It is save to do so. Or just drop it.
        '''
        i = 0   # 计数
        for sta, dis in mylaser.get_distance():
            i += 1
            print(f'status:{sta}', f'distance:{dis}mm')

            if i == 50:
                # 只测50次
                mylaser.stop()
                break
    except Exception as e:
        print(traceback.format_exc())
        raise
    except:
        mylaser.stop()  # 停止激光设备


    mylaser.close_port()    # 关闭串口

output

==================== focus on the raw datas
b'\x01' b'\x0e\x02\x01\t'
b'\x01' b'\x01\x02\x00\x1e'
b'\x07' b'\x00\x00\x00\xe8'
b'\x07' b'\x00\x00\x00\xf1'
b'\x07' b'\x00\x00\x00\xf1'
b'\x07' b'\x00\x00\x00\xf1'
b'\x07' b'\x00\x00\x00\xe8'
b'\x07' b'\x00\x00\x00\xe8'
b'\x07' b'\x00\x00\x00\xf8'
b'\x07' b'\x00\x00\x00\xf8'
==================== focus on the distance datas
status:0 distance:190mm
status:0 distance:174mm
status:0 distance:162mm
status:0 distance:159mm
status:0 distance:160mm
status:0 distance:160mm
status:0 distance:175mm
status:0 distance:156mm
status:0 distance:153mm
status:0 distance:153mm
status:0 distance:155mm
An open source operating system designed primarily for the Raspberry Pi Pico, written entirely in MicroPython

PycOS An open source operating system designed primarily for the Raspberry Pi Pico, written entirely in MicroPython. "PycOS" is an combination of the

8 Oct 06, 2022
Smart Tech Automation Remote via Kinematics Gesture control for IoT devices

STARK Smart Tech Automation Remote via Kinematics Gesture control for IoT devices View Demo · Report Bug · Request Feature Table of Contents About The

Juseong (Joe) Kim 1 Jan 29, 2022
My 500 LED xmas tree

xmastree2020 This repository contains the code used for Matt's Christmas tree, as featured in "I wired my tree with 500 LED lights and calculated thei

Stand-up Maths 581 Jan 07, 2023
A 3rd party Moonraker component to create timelapse of 3D prints.

A 3rd party Moonraker component to create timelapse of 3D prints.

Mainsail-Crew 166 Dec 26, 2022
gdsfactory is an EDA (electronics design automation) tool to Layout Integrated Circuits.

gdsfactory 3.5.5 gdsfactory is an EDA (electronics design automation) tool to Layout Integrated Circuits. It is build on top of phidl gdspy and klayou

147 Jan 04, 2023
Home Assistant custom components MPK-Lodz

MPK Łódź sensor This sensor uses unofficial API provided by MPK Łódź. Configuration options Key Type Required Default Description name string False MP

Piotr Machowski 3 Nov 01, 2022
The ABR Control library is a python package for the control and path planning of robotic arms in real or simulated environments.

The ABR Control library is a python package for the control and path planning of robotic arms in real or simulated environments. ABR Control provides API's for the Mujoco, CoppeliaSim (formerly known

Applied Brain Research 277 Jan 05, 2023
Examples to accompany the

Examples to accompany the "Raspberry Pi Pico Python SDK" book published by Raspberry Pi Trading, which forms part of the technical documentation in support of Raspberry Pi Pico and the MicroPython po

Raspberry Pi 589 Jan 08, 2023
For use with an 8-bit parallel TFT touchscreen using micropython

ILI9341-parallel-TFT-driver-for-micropython For use with an 8-bit parallel TFT touchscreen using micropython. Many thanks to prenticedavid and his MCU

3 Aug 02, 2022
Get the AltAz coordinates for a given object using astropy and output on a OLED screen.

Star Coordinates Get the AltAz coordinates for a given object using astropy and output on a OLED screen. As a very very newcomer to the astronomy scen

Craig Cmehil 1 Jan 31, 2022
Python code written to utilize the Korlan usb2can hardware to send and receive data over the can-bus on a 2008 Nissan 350z

nissan_ecu_hacking Python code written to utilize the Korlan usb2can hardware to send and receive data over the can-bus on a 2008 Nissan 350z My goal

Liam Goss 11 Sep 24, 2022
Raspberry Pi Pico support for VS Code

Pico-Go VS Code Extension Pico-Go provides code auto-completion and allows you to communicate with your Raspberry Pi Pico board using the built-in REP

Chris Wood 114 Dec 28, 2022
Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs

Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs

Matthew Garrett 1.2k Jan 04, 2023
Philippe 1 Jan 09, 2022
An open source two key macro-pad modeled to look like a cartoony melting popsicle

macropopsicle An open source two key macro-pad modeled to look like a cartoony melting popsicle. Build instructions Parts List -1x Top case half (3D p

17 Aug 18, 2022
A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost.

distance sensor cube timer A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost. How to

3 Feb 21, 2022
LT-OCF: Learnable-Time ODE-based Collaborative Filtering, CIKM'21

LT-OCF: Learnable-Time ODE-based Collaborative Filtering Our proposed LT-OCF Our proposed dual co-evolving ODE Setup Python environment for LT-OCF Ins

Jeongwhan Choi 15 Dec 28, 2022
A python module for interacting with rolimon's, a roblox value site.

rpi - rolimon's python interaction rpi is an open source python-based rolimon's api wrapper. It provides an end-to-end pipeline in which each componen

Acier 11 Nov 08, 2022
Home-Assistant MQTT bridge for Panasonic Comfort Cloud

Panasonic Comfort Cloud MQTT Bridge Home-Assistant MQTT bridge for Panasonic Comfort Cloud. Note: Currently this brige is a one evening prototype proj

Santtu Järvi 2 Jan 04, 2023
Hardware-accelerated ROS2 packages for camera image processing.

Isaac ROS Image Pipeline Overview This metapackage offers similar functionality as the standard, CPU-based image_pipeline metapackage, but does so by

NVIDIA Isaac ROS 52 Dec 15, 2022