Getting Started
Apart from the Raspbot_Lib library, there also exists a few more pre-written functions to interact with various peripherals of the robot.
The .py files can be found on the official website or directly here.
To use the functions in the file, either put it in the same directory as your python script or use sys.path
to link it.
sys.path("/path/to/the/library/")
McLumk_Wheel_Sports.py
This library has pre-built functions to control the movement of the Mechanum wheel.
For convenient's sake, import all functions into the program
from McLumk_Wheel_Sports import *
Function | Arguments | Details |
---|---|---|
move_forward(speed) |
speed ranges from 0 to 255 | |
move_backward(speed) |
speed ranges from 0 to 255 | |
move_left(speed) |
speed ranges from 0 to 255 | |
move_right(speed) |
speed ranges from 0 to 255 | |
move_diagonal_left_front(speed) |
speed ranges from 0 to 255 | |
move_diagonal_right_front(speed) |
speed ranges from 0 to 255 | |
move_diagonal_left_back(speed) |
speed ranges from 0 to 255 | |
move_diagonal_right_back(speed) |
speed ranges from 0 to 255 | |
rotate_left(speed) |
speed ranges from 0 to 255 | |
rotate_right(speed) |
speed ranges from 0 to 255 | |
stop_robot() |
||
stop() |
does the same thing as stop_robot() but does it 4 times? |
|
drifting(speed, deflection, deflection_rate) |
Speed: 0 to 255, deflection: 0 to 360, deflection_rate: 117+ 132... not sure | when deflection_rate = 0, robot moves in the direction set by the angle. (can definitely be better implmented) |
90
180--δΈ¨--0
270
yahboom_oled
Libraries Requirement
- Adafruit_SSD1306: library for the OLED module
- pillow: for image manipulation
pip install Adafruit_SSD1306 pillow
Importing the library:
import sys
sys.path.append("/path/to/the/library/")
from yahboom_oled import *
#Initializing oled object
oled = Yahboom_OLED()
# Begin oled object
oled.begin()
There are two steps to display images onto the OLED display:
- Writing images to the buffer
- Refreshing the screen and loading that image
Note: writing the images to the buffer won't make it display on the screen. Make sure to refresh the screen afterwards using oled.refresh()
.
Methods for writing things to the display
Methods | Arguments | Details |
---|---|---|
oled.clear(refresh=False) |
refresh (default to False ) |
Simply clear the display. refresh=True refreshs the screen without the need of oled.refresh() |
add_text(self, start_x, start_y, text, refresh=False) |
start_x , start_y is of type int ; text is of type str |
display a text starting from coordinates (start_x , start_y ).Note: x=0, y=0; is positioned at top left corner |
add_cntext(self, start_x, start_y, text, refresh=False) |
\(\vdots\) | same as add_text but for chinese characters |
add_line(self, text, line=1, refresh=False) |
text is of type str , line ranges from 1 to 4 |
formats the text into lines automaticallly |
add_cnline(self, text, line=1, refresh=False) |
\(\vdots\) | same as add_line but for chinese characters |
main_program() |
prints information about the raspberry pi including, CPU tempertature, RAM usage, IP address, Disk Usage, System time |
This library doesn't implement the display of custom images, or the ability to control each individual pixel. For more control, directly use the Adafruit_SSD1306
library combined with pillow
Useful Links: