Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added 2.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DranSword.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Kurama_vs_Susanoo.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Naruto_Kuramalink.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Naruto_Sage_Mode.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cd.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added curseseal.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added hakagenaruto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added naruto-sage-of-six-paths-4geux1uiu72ek9bt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions silowholived.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
from hub import port
import runloop
import motor_pair
import motor

# ======================
# CONSTANTS
# ======================
DRIVE_SPEED = 180
TURN_SPEED = 180
NORMAL_SPEED = 90
FAST_SPEED = 720

ATTACH_START = 230
SILO_DROP = 80
WHO_LIVED_HERE_PUSH = 120

# ======================
# SETUP
# ======================
motor_pair.pair(motor_pair.PAIR_1, port.A, port.E)

# ======================
# FUNCTIONS
# ======================
async def reset_attachment():
await motor.run_to_absolute_position(
port.D, ATTACH_START, NORMAL_SPEED
)

async def drive(deg):
await motor_pair.move_for_degrees(
motor_pair.PAIR_1, deg, 0, velocity=DRIVE_SPEED
)
motor_pair.stop(motor_pair.PAIR_1)

async def turn(deg):
await motor.run_for_degrees(port.A, deg, TURN_SPEED)

async def silo_mission():
# Turn toward silo
await turn(-90)

# Drive to silo
await drive(410)

# Align
await turn(100)
await drive(80)

# Operate silo (5 times)
for _ in range(5):
await motor.run_to_absolute_position(
port.D, ATTACH_START - SILO_DROP, FAST_SPEED
)
await reset_attachment()

# Back away
await drive(-250)

async def who_lived_here_mission():
# Turn toward Who Lived Here
await turn(90)

# Drive to model
await drive(300)

# Activate model
await motor.run_to_absolute_position(
port.D, WHO_LIVED_HERE_PUSH, FAST_SPEED
)

await runloop.sleep_ms(300)

# Reset attachment
await reset_attachment()

# Back away
await drive(-150)

# ======================
# MAIN RUN
# ======================
async def main():
await reset_attachment()
await silo_mission()
await who_lived_here_mission()

runloop.run(main())
Binary file added sixpaths.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sp.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wandwizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.