An autonomous vehicle platform by Pathfinder
Project description
Findee ๐
Findee๋ Pathfinder์ ๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์ ๋ก 2 W ๊ธฐ๋ฐ์ ์์จ์ฃผํ ์ฐจ๋ ํ๋ซํผ์ ๋๋ค. ๋ชจํฐ ์ ์ด, ์นด๋ฉ๋ผ, ์ด์ํ ์ผ์๋ฅผ ํตํฉํ์ฌ ๋ก๋ณดํฑ์ค ํ๋ก์ ํธ๋ฅผ ์ฝ๊ฒ ๊ตฌํํ ์ ์๋๋ก ๋์์ค๋๋ค.
โจ ์ฃผ์ ๊ธฐ๋ฅ
- ๐ ๋ชจํฐ ์ ์ด: DC ๋ชจํฐ๋ฅผ ์ด์ฉํ ์ ์ง, ํ์ง, ํ์ ์ ์ด
- ๐ท ์นด๋ฉ๋ผ: Picamera2๋ฅผ ์ด์ฉํ ์ค์๊ฐ ์์ ์ฒ๋ฆฌ
- ๐ก ์ด์ํ ์ผ์: ๊ฑฐ๋ฆฌ ์ธก์ ๋ฐ ์ฅ์ ๋ฌผ ๊ฐ์ง
- ๐ฏ ํตํฉ ํ๋ซํผ: ํ๋์ ํด๋์ค๋ก ๋ชจ๋ ํ๋์จ์ด ์ ์ด
๐ง ํ๋์จ์ด ์๊ตฌ์ฌํญ
์ฌ์ฉ ํ๋์จ์ด
- ๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์ ๋ก 2 W
- ๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์นด๋ฉ๋ผ ๋ชจ๋ V2 ๋๋ ํธํ ์นด๋ฉ๋ผ
- DC ๋ชจํฐ 2๊ฐ (๋ฐํด์ฉ)
- L298N ๋ชจํฐ ๋๋ผ์ด๋ฒ
- HC-SR04 ์ด์ํ ์ผ์
- ์ ํผ ์์ด์ด ๋ฐ ๋ธ๋ ๋๋ณด๋
๐ฆ ์ค์น ๋ฐฉ๋ฒ
1. ๊ธฐ๋ณธ ์ค์น
pip install findee
1-1. ์ ๋ฐ์ดํธ
pip install --upgrade findee
2. ํ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น
pip install opencv-python RPi.GPIO picamera2
๐ ์ฌ์ฉ๋ฒ
1. ๊ธฐ๋ณธ ์์
from findee import Findee
# Findee ๊ฐ์ฒด ์์ฑ
robot = Findee()
try:
# 2์ด๊ฐ ์ ์ง
robot.motor.move_forward(50)
time.sleep(2)
# 1์ด๊ฐ ์ฐํ์
robot.motor.turn_right(30)
time.sleep(1)
# ์ ์ง
robot.motor.stop()
# ๊ฑฐ๋ฆฌ ์ธก์
distance = robot.ultrasonic.get_distance()
print(f"๊ฑฐ๋ฆฌ: {distance}cm")
# ์นด๋ฉ๋ผ ํ๋ ์ ์บก์ฒ
frame = robot.camera.get_frame()
print(f"ํ๋ ์ ํฌ๊ธฐ: {frame.shape}")
finally:
# ๋ฆฌ์์ค ์ ๋ฆฌ
robot.motor.cleanup()
2. ์์จ์ฃผํ ์์
import time
from findee import Findee
def autonomous_drive():
robot = Findee()
try:
while True:
# ๊ฑฐ๋ฆฌ ์ธก์
distance = robot.ultrasonic.get_distance()
if distance is None:
print("์ผ์ ์ค๋ฅ")
continue
if distance > 20: # 20cm ์ด์์ด๋ฉด ์ ์ง
robot.motor.move_forward(40)
elif distance > 10: # 10-20cm๋ฉด ์ฒ์ฒํ
robot.motor.move_forward(20)
else: # 10cm ์ดํ๋ฉด ํ์
robot.motor.turn_right(30)
time.sleep(0.5)
robot.motor.stop()
time.sleep(0.1)
except KeyboardInterrupt:
print("ํ๋ก๊ทธ๋จ ์ข
๋ฃ")
finally:
robot.motor.cleanup()
if __name__ == "__main__":
autonomous_drive()
๐ API ๋ฌธ์
1. Findee ํด๋์ค
๋ฉ์ธ ํด๋์ค๋ก ๋ชจ๋ ํ๋์จ์ด ๊ตฌ์ฑ์์์ ์ ๊ทผํ ์ ์์ต๋๋ค.
robot = Findee()
robot.motor # Motor ํด๋์ค ์ธ์คํด์ค
robot.camera # Camera ํด๋์ค ์ธ์คํด์ค
robot.ultrasonic # Ultrasonic ํด๋์ค ์ธ์คํด์ค
2. Motor ํด๋์ค
DC ๋ชจํฐ ์ ์ด๋ฅผ ๋ด๋นํฉ๋๋ค.
๊ธฐ๋ณธ ์ ์ด
move_forward(speed): ์ ์ง (speed: 20-100)move_backward(speed): ํ์ง (speed: 20-100)turn_left(speed): ์ ์๋ฆฌ ์ขํ์ (speed: 20-100)turn_right(speed): ์ ์๋ฆฌ ์ฐํ์ (speed: 20-100)stop(): ์ ์งcleanup(): GPIO ์ ๋ฆฌ
๊ณ ๊ธ ์ ์ด
curve_left(speed, angle): ์ขํ์ ์ปค๋ธ (angle: 0-60)curve_right(speed, angle): ์ฐํ์ ์ปค๋ธ(angle: 0-60)control_motors(right, left): ๊ฐ๋ณ ๋ชจํฐ ์ ์ด (-100 ~ 100)
3. Camera ํด๋์ค
๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์นด๋ฉ๋ผ ์ ์ด๋ฅผ ๋ด๋นํฉ๋๋ค.
get_frame(): ํ์ฌ ํ๋ ์ ๋ฐํ (numpy array)camera_test(): ์นด๋ฉ๋ผ ์ฐ๊ฒฐ ํ ์คํธ
4. Ultrasonic ํด๋์ค
HC-SR04 ์ด์ํ ์ผ์ ์ ์ด๋ฅผ ๋ด๋นํฉ๋๋ค.
get_distance(): ๊ฑฐ๋ฆฌ ์ธก์ ๋ฐํ (cm, None if error)- ์ธก์ ๋ฒ์: 2-400cm
- ์ ํ๋: ยฑ1cm
์ด์ ๋ฆฌํฌํธ
๋ฒ๊ทธ๋ ๊ธฐ๋ฅ ์์ฒญ์ GitHub Issues๋ฅผ ์ด์ฉํด์ฃผ์ธ์.
๐ ๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค๋ฅผ ๋ฐ๋ฆ ๋๋ค. ์์ธํ ๋ด์ฉ์ LICENSE ํ์ผ์ ์ฐธ์กฐํ์ธ์.
๐ฅ ์ ์์
- Pathfinder - ์ด๊ธฐ ๊ฐ๋ฐ - Comrid
๐ ๊ฐ์ฌ์ ๋ง
- ๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์ฌ๋จ์ ํ๋ฅญํ ํ๋์จ์ด
- ์คํ์์ค ์ปค๋ฎค๋ํฐ์ ์ง์
์ฆ๊ฑฐ์ด ๋ก๋ณดํฑ์ค ํ๋ก์ ํธ ๋์ธ์! ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file findee-0.0.28.tar.gz.
File metadata
- Download URL: findee-0.0.28.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2280c26919685c09ec28799a09724ee87f560db48e04e60d540f28ecea3accb5
|
|
| MD5 |
d9e0038f87202302335fa7883c036d9f
|
|
| BLAKE2b-256 |
b072b60e77e9a3bf69e42210026747b4601c6401fdfd9afbd58413137843456c
|
File details
Details for the file findee-0.0.28-py3-none-any.whl.
File metadata
- Download URL: findee-0.0.28-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
490d76907ac53ffd6d84673321120cad841b86d0c42dc667ebf87d053cabbe51
|
|
| MD5 |
0eba72bbedc7bff1fddf0d8db4930ac1
|
|
| BLAKE2b-256 |
3025434f36980ca6069d01f934abae55366318862e405fb5864698ab640b281e
|