Compare commits
No commits in common. "693b363ba2e2825fb2da2c1d6d788a8a5fe5cc3a" and "7fbbe9ef4495ae8b16ba67d5ee178641bb29b77e" have entirely different histories.
693b363ba2
...
7fbbe9ef44
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
After=network.target
|
|
||||||
Description=KuuKar Primary Application
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=idle
|
|
||||||
User=pi
|
|
||||||
ExecStart=/usr/bin/python3 /home/pi/kuukar-rpi/app.py
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -38,10 +38,8 @@ class lcd:
|
||||||
if page == 1 and component_id == 2 and press_type == '01':
|
if page == 1 and component_id == 2 and press_type == '01':
|
||||||
if self.nextion.get_attribute("aiTG.val"):
|
if self.nextion.get_attribute("aiTG.val"):
|
||||||
print("AI Drive Activated")
|
print("AI Drive Activated")
|
||||||
self.motion.roam_start()
|
|
||||||
else:
|
else:
|
||||||
print("AI Drive Deactivated")
|
print("AI Drive Deactivated")
|
||||||
self.motion.roam_stop()
|
|
||||||
elif page == 3:
|
elif page == 3:
|
||||||
if component_id == 2 and press_type == '00':
|
if component_id == 2 and press_type == '00':
|
||||||
x = self.nextion.get_attribute("joystick.x")
|
x = self.nextion.get_attribute("joystick.x")
|
||||||
|
@ -49,8 +47,7 @@ class lcd:
|
||||||
speed = 100 - (y - 60) / (205 - 60) * 200
|
speed = 100 - (y - 60) / (205 - 60) * 200
|
||||||
turn = (x - 5) / (150 - 5) * 200 - 100
|
turn = (x - 5) / (150 - 5) * 200 - 100
|
||||||
print(f"Setting speed to {speed} and turn angle to {turn}")
|
print(f"Setting speed to {speed} and turn angle to {turn}")
|
||||||
if not self.motion.is_roaming():
|
|
||||||
self.motion.drive_skew(speed,turn)
|
|
||||||
def _sensor_screen_updator(self):
|
def _sensor_screen_updator(self):
|
||||||
while True:
|
while True:
|
||||||
self.nextion.send_command(
|
self.nextion.send_command(
|
||||||
|
@ -60,5 +57,5 @@ class lcd:
|
||||||
self.nextion.send_command(
|
self.nextion.send_command(
|
||||||
f"brightnessTXT.txt=\"{self.sensors.get_brightness_pct()}\"")
|
f"brightnessTXT.txt=\"{self.sensors.get_brightness_pct()}\"")
|
||||||
self.nextion.send_command(
|
self.nextion.send_command(
|
||||||
f"sonarTXT.txt=\"{int(self.sensors.sonar_get_distance(2))} / {int(self.sensors.sonar_get_distance(1))} / {int(self.sensors.sonar_get_distance(0))}\"")
|
f"sonarTXT.txt=\"{int(self.sensors.sonar_get_distance(0))} / {int(self.sensors.sonar_get_distance(1))} / {int(self.sensors.sonar_get_distance(2))}\"")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
|
@ -18,11 +18,9 @@ class leds:
|
||||||
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico) -> None:
|
def __init__(self, mcu: telemetrix_rpi_pico.TelemetrixRpiPico) -> None:
|
||||||
self.mcu = mcu
|
self.mcu = mcu
|
||||||
self.mcu.set_pin_mode_neopixel(LEDS_DATA_PIN, LEDS_NUM)
|
self.mcu.set_pin_mode_neopixel(LEDS_DATA_PIN, LEDS_NUM)
|
||||||
self.ambient_light = [5, 5, 25] #Keke Image Color
|
|
||||||
self.__update_leds()
|
|
||||||
|
|
||||||
def set_headlights(self, state: bool):
|
def set_headlights(self, state: bool):
|
||||||
self.headlight = state
|
headlight = True
|
||||||
self.__update_leds()
|
self.__update_leds()
|
||||||
|
|
||||||
def set_left_signal_led(self, state: bool):
|
def set_left_signal_led(self, state: bool):
|
||||||
|
@ -42,12 +40,11 @@ class leds:
|
||||||
self.__update_leds()
|
self.__update_leds()
|
||||||
|
|
||||||
def __update_leds(self):
|
def __update_leds(self):
|
||||||
self.mcu.neopixel_fill(
|
self.mcu.neopixel_fill(r=self.ambient_light[0], g=self.ambient_light[1], b=self.ambient_light[2])
|
||||||
r=self.ambient_light[0], g=self.ambient_light[1], b=self.ambient_light[2])
|
|
||||||
if self.headlight:
|
if self.headlight:
|
||||||
for led in HEADLIGHT_LEDS:
|
for led in HEADLIGHT_LEDS:
|
||||||
self.mcu.neo_pixel_set_value(led, self.headlight * 255, self.headlight * 255,
|
self.mcu.neo_pixel_set_value(led, self.headlight * 255, self.headlight * 255,
|
||||||
self.headlight * 255)
|
self.headlight * 255)
|
||||||
if self.left_signal:
|
if self.left_signal:
|
||||||
for led in LEFT_SIGNAL_LEDS:
|
for led in LEFT_SIGNAL_LEDS:
|
||||||
self.mcu.neo_pixel_set_value(led, 255, 0, 0)
|
self.mcu.neo_pixel_set_value(led, 255, 0, 0)
|
||||||
|
|
|
@ -60,28 +60,6 @@ class motion:
|
||||||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
||||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, -speed)
|
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, -speed)
|
||||||
|
|
||||||
def drive_skew(self, speed: float, dir: float):
|
|
||||||
if dir > 0:
|
|
||||||
self.leds.set_right_signal_led(True)
|
|
||||||
elif dir < 0:
|
|
||||||
self.leds.set_left_signal_led(True)
|
|
||||||
|
|
||||||
lm_speed = (100+dir/2)*speed/100
|
|
||||||
if lm_speed>99:
|
|
||||||
lm_speed = 99
|
|
||||||
elif lm_speed<-99:
|
|
||||||
lm_speed = -99
|
|
||||||
rm_speed = (100-dir/2)*speed/100
|
|
||||||
if rm_speed > 99:
|
|
||||||
rm_speed = 99
|
|
||||||
elif rm_speed < -99:
|
|
||||||
rm_speed = -99;
|
|
||||||
|
|
||||||
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, lm_speed)
|
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, rm_speed)
|
|
||||||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, lm_speed)
|
|
||||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, rm_speed)
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.leds.set_left_signal_led(False)
|
self.leds.set_left_signal_led(False)
|
||||||
self.leds.set_right_signal_led(False)
|
self.leds.set_right_signal_led(False)
|
||||||
|
@ -94,9 +72,6 @@ class motion:
|
||||||
def roam_stop(self):
|
def roam_stop(self):
|
||||||
self.roaming = False
|
self.roaming = False
|
||||||
|
|
||||||
def is_roaming(self) -> bool:
|
|
||||||
return self.roaming
|
|
||||||
|
|
||||||
def __roam_looper(self):
|
def __roam_looper(self):
|
||||||
while True:
|
while True:
|
||||||
if self.roaming:
|
if self.roaming:
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
sudo apt update
|
|
||||||
sudo apt install python3 python3-pip
|
|
||||||
pip3 install -r ./requirements.txt
|
|
||||||
ln -s ./kuukar.service /etc/systemd/system/kuukar.service
|
|
||||||
sudo systemctl kuukar enable
|
|
||||||
sudo systemctl kuukar start
|
|
|
@ -1,4 +0,0 @@
|
||||||
git stash
|
|
||||||
git pull
|
|
||||||
cp -fv ../kuukar_config.py ./kuukar/kuukar_config.py
|
|
||||||
service kuukar restart
|
|
Loading…
Reference in New Issue