Skip to content

Python API for AlphaBot2 robot control and line follower implementation.

Notifications You must be signed in to change notification settings

makarov-na/alpha-bot2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlphaBot2-Pi API

Friendly API implementation for AlphaBot2-Pi KIT (View on Youtube)

  • Camera position control
  • Motors power control with frequency width modulation
  • Line sensors analog to digital converter TLC1543 control
  • Led strip WS2812B control
  • Beeper control
  • GPIO wrapper for PC environment development and unit testing

Usage

Camera position control

from alphabot.bot.hardware.camera_module import CameraServo

# angle from -45 to 45
vertical_angle = 0
horizontal_angle = 45
camera_servo = CameraServo()
camera_servo.setVerticalPosition(vertical_angle)
camera_servo.setHorizontalPosition(horizontal_angle)

Truck control

from alphabot.bot.truck_module import Truck

# power from -100 to 100
power = 50
truck = Truck(gpio)
truck.setSpeedPower(power)
truck.setTurnPower(0)

Motor control

from alphabot.bot.hardware.motor_module import LeftMotor, RightMotor

# power from 0 to 100
power = 50
left_motor = LeftMotor(gpio)
right_motor = RightMotor(gpio)
left_motor.forward(power)
right_motor.forward(power)
# ..some logic
left_motor.stop()
right_motor.stop()

Sensors

from alphabot.bot.hardware.line_sensor_module import LineSensorsAdc

sensors_adc = LineSensorsAdc(gpio)
all_sensors_values = sensors_adc.readSensors()

Beeper

from alphabot.bot.hardware.beeper_module import Beeper

beeper = Beeper(gpio)
beeper.beepOn()
beeper.beepOff()

or

from alphabot.bot.hardware.beeper_module import Beeper

beeper = Beeper(gpio)
time_in_milliseconds = 1000
beeper.beepOn(time_in_milliseconds)

Led strip

from alphabot.bot.hardware import LedStrip

strip = LedStrip()
strip.setPixelColourRgb(0, 255, 0, 0)

About

Python API for AlphaBot2 robot control and line follower implementation.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published