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.8.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.8-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: findee-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 3e96667b18cfdf0e54e2ddb1ef68ffd64e488fd0b84236835942eda48386b983
MD5 1ea04bc135767b2ef50a4f12304a501a
BLAKE2b-256 0797c81574daffb38532b5ba268a07191bce156040c8dae6a2be955f72a9acfa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: findee-0.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b33454d9153c00f2dcf45607c5560843464d3a7c304779f5a663aeefdb0d0125
MD5 b303778622940cc5cd86159747d86a2f
BLAKE2b-256 06460138e5c3a87f5cb014383b31f90507fb2fb6f913751001e7a7916c9f17a8

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