Skip to main content

An autonomous vehicle platform by Pathfinder

Project description

Findee ๐Ÿš—

PyPI version Python License: MIT Downloads

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


Download files

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

Source Distribution

findee-0.0.20.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

findee-0.0.20-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file findee-0.0.20.tar.gz.

File metadata

  • Download URL: findee-0.0.20.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for findee-0.0.20.tar.gz
Algorithm Hash digest
SHA256 4cae96ddf5479ab8bae404670b4b84e3c017cf6b2a4957c7070c8c3dc82366ba
MD5 ef715d18164ad74b0380fb66f49986d8
BLAKE2b-256 23e281d3252c89b8d337dcd6c2fded3b285c50c783dc19c9f780fbad93c1dafd

See more details on using hashes here.

File details

Details for the file findee-0.0.20-py3-none-any.whl.

File metadata

  • Download URL: findee-0.0.20-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for findee-0.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 6fb62886bd09b80dc6176b75b468b99041d735a7f1d997fee88bdce0b3621051
MD5 9b11a849ae48fa91cbdc5937b9524a38
BLAKE2b-256 c6061a058839da9075cfc2c09f9ceef9ff6bc01f798fd63cac055ab017b58efa

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