nerf-turret 1
Infrared targeting nerf turret
Loading...
Searching...
No Matches
main.py File Reference

This file contains code to perform a nerf turret duel. More...

Functions

def main.run_motor (motor, encoder, controller)
 
def main.aim (camera)
 

Variables

tuple main.MEC1_tickratio = (194000/180)
 
float main.MEC1_gain = 0.7
 
tuple main.MEC2_tickratio = (2300/100)
 
float main.MEC2_gain = 0.7
 
int main.horiz_correction = 0
 
int main.vert_correction = 15
 
int main.x_fov = 55
 
int main.y_fov = 35
 
int main.mask_threshold = 75
 
int main.width = 32
 
int main.length = 24
 
float main.angle_prescale = 0.5
 
servo_driver main.servo = servo_driver.ServoDriver('D13', 2, 1)
 
Pin main.trigger_pin = Pin('D12', Pin.OUT_PP)
 
motor_driver main.M1 = motor_driver.MotorDriver('A10', 'B4', 'B5', 3, 1, 2)
 
encoder_reader main.E1 = encoder_reader.EncoderReader('C6', 'C7', 8, 1, 2)
 
closedloopcontrol main.C1 = closedloopcontrol.cl_loop(MEC1_gain, 0)
 
motor_driver main.M2 = motor_driver.MotorDriver('C1', 'A0', 'A1', 5, 1, 2)
 
encoder_reader main.E2 = encoder_reader.EncoderReader('B6', 'B7', 4, 1, 2)
 
closedloopcontrol main.C2 = closedloopcontrol.cl_loop(MEC2_gain, 0)
 
I2C main.i2c_bus = I2C(1)
 
int main.i2c_address = 0x33
 
mlx_cam main.camera = mlx_cam.MLX_Cam(i2c_bus)
 
int main.ctrl_reg_val = 0b0001101110000001
 
int main.S0_INIT = 0
 
int main.S1_TURN180 = 1
 
int main.S2_AIM = 2
 
int main.S3_ADJUST = 3
 
int main.S4_SHOOT = 4
 
int main.S5_SAFE = 5
 
int main.state = S0_INIT
 
 main.try :
 
time main.time_start180 = time.ticks_ms()
 
 main.x_target_stpt
 
 main.y_target_stpt
 
time main.adjust_time = time.ticks_ms()
 
 main.else :
 

Detailed Description

This file contains code to perform a nerf turret duel.

Author
Jackie Chen, Richard Kwan, Chayton Ritter
Date
14-Mar-2023