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 ์ •๋ฆฌ

๊ณ ๊ธ‰ ์ œ์–ด

  • smooth_turn_left(speed, angle): ๋ถ€๋“œ๋Ÿฌ์šด ์ขŒํšŒ์ „ (angle: 0-60)
  • smooth_turn_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.9.tar.gz (8.1 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.9-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: findee-0.0.9.tar.gz
  • Upload date:
  • Size: 8.1 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.9.tar.gz
Algorithm Hash digest
SHA256 7ea209c4896763c59f62ca72cf4d1b5e5d45b8e71f0f3c4a73f75b2f8e1df540
MD5 bdfbbb5610784b09773e7fad65521aab
BLAKE2b-256 f4efa34fc8587ff0a813f4e755c9076d91164d7d336ce16a1f409689981e7d04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: findee-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6b9bf8ed000fa84f298f25bfc4fb1bc89d9d6e93798504800c5882b3f717e21c
MD5 aa6a5d609b2d6570b78189b1dab6d712
BLAKE2b-256 05793dec6ab93c00310fa54c682baa346d0d1f928fd3b9e7fd1e659ae6d4a279

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