Skip to content

Commit 5db8f9a

Browse files
committed
Add support for making a Pypi package
1 parent 2dab0a6 commit 5db8f9a

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Introduction ##
2+
3+
Provide an interface to the SlamTec RPLidar A1.
4+
5+
Eventual goal is for the single module to work with both Linux (via /dev/USB0, etc) and CircuitPython (via a UART instance)
6+
7+
## Usage Example ##
8+
9+
import os
10+
from math import cos, sin, pi, floor
11+
import pygame
12+
from adafruit_circuitpython_rplidar import RPLidar
13+
14+
# Set up pygame and the display
15+
os.putenv('SDL_FBDEV', '/dev/fb1')
16+
pygame.init()
17+
lcd = pygame.display.set_mode((320,240))
18+
pygame.mouse.set_visible(False)
19+
lcd.fill((0,0,0))
20+
pygame.display.update()
21+
22+
# Setup the RPLidar
23+
PORT_NAME = '/dev/ttyUSB0'
24+
lidar = RPLidar(None, PORT_NAME)
25+
26+
# used to scale data to fit on the screen
27+
max_distance = 0
28+
29+
def process_data(data):
30+
# Do something useful with the data
31+
pass
32+
33+
scan_data = [0]*360
34+
35+
try:
36+
print(lidar.get_info())
37+
for scan in lidar.iter_scans():
38+
for (_, angle, distance) in scan:
39+
scan_data[min([359, floor(angle)])] = distance
40+
process_data(scan_data)
41+
42+
except KeyboardInterrupt:
43+
print('Stoping.')
44+
lidar.stop()
45+
lidar.disconnect()
46+
47+
48+
## Contributing ##
49+
50+
Contributions are welcome! Please read our [Code of Conduct](https://github.com/adafruit/Adafruit_circuitpython_CircuitPython_RPLIDAR/blob/master/CODE_OF_CONDUCT.md)
51+
before contributing to help this project stay welcoming.
File renamed without changes.

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import setuptools
2+
3+
with open("README.md", "r") as fh:
4+
long_description = fh.read()
5+
6+
setuptools.setup(
7+
name="adafruit-rplidar",
8+
version="0.0.1",
9+
author="Dave Astels",
10+
author_email="[email protected]",
11+
description="Slamtec RPLIDAR A1 interface",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/adafruit/Adafruit_CircuitPython_RPLIDAR",
15+
py_modules=['adafruit_rplidar'],
16+
classifiers=[
17+
"Programming Language :: Python :: 3",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
],
21+
)

0 commit comments

Comments
 (0)