ME 405 Romi
Loading...
Searching...
No Matches
main Namespace Reference

Variables

float ERR_SAT_LEFT = 50.0
float EFF_SAT_LEFT = 85.0
float ERR_SAT_RIGHT = 50.0
float EFF_SAT_RIGHT = 85.0
int ERR_SAT_LINE = 1
int EFF_SAT_LINE = 40
int ERR_SAT_YAW = .8
int EFF_SAT_YAW = 100
 m_state_l = task_share.Share('b', thread_protect = False, name = "m_state_l")
 m_state_r = task_share.Share('b', thread_protect = False, name = "m_state_r")
 PWM_l = task_share.Share('f', thread_protect = False, name = "PWM_l")
 PWM_r = task_share.Share('f', thread_protect = False, name = "PWM_r")
 position_r = task_share.Share('f', thread_protect = False, name = "position_r")
 velocity_r = task_share.Share('f', thread_protect = False, name = "velocity_r")
 position_l = task_share.Share('f', thread_protect = False, name = "position_l")
 velocity_l = task_share.Share('f', thread_protect = False, name = "velocity_l")
 testing_flg = task_share.Share('b', thread_protect = False, name = "testing_flg")
 delay = task_share.Share('b', thread_protect = False, name = "delay")
 fwd_ref = task_share.Share('l', thread_protect = False, name = "fwd_ref")
 arc_ref = task_share.Share('l', thread_protect = False, name = "arc_ref")
 piv_ref = task_share.Share('f', thread_protect = False, name = "piv_ref")
 c_state = task_share.Share('b', thread_protect = False, name = "c_state")
 l_state = task_share.Share('b', thread_protect = False, name = "l_state")
 ready_Black = task_share.Share('b', thread_protect = False, name = "ready_Black")
 ready_White = task_share.Share('b', thread_protect = False, name = "ready_White")
 need_Calibrate = task_share.Share('b', thread_protect = False, name = "need calibrate")
 centroid = task_share.Share('f', thread_protect = False, name ="centroid")
 automatic_mode = task_share.Share('b', thread_protect = False, name = "automatic_mode" )
 imu_flg = task_share.Share('b', thread_protect= False, name = "imu_flg")
 yaw = task_share.Share('f', thread_protect = False, name = "yaw")
 yaw_velocity = task_share.Share('f', thread_protect = False, name = "yaw_velocity")
 total_dist = task_share.Share("f", thread_protect = False, name = "S")
 centroid_goal = task_share.Share("f", thread_protect = False, name = "Goal Centroid")
 yaw_goal = task_share.Share("f", thread_protect = False, name = "Yaw Goal")
 bump_on_off = task_share.Share("b", thread_protect = False, name = "Bump Flag")
 bump_flg = task_share.Share("b", thread_protect = False, name = "Bump Flag")
 velocity = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "velocity")
 velocity2 = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "velocity2")
 position = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "position")
 times = task_share.Queue('l', 50, thread_protect = False, overwrite = False, name = "times")
 tim1 = Timer(1, prescaler=0, period=65535)
 tim3 = Timer(3, prescaler=0, period=65535)
 tim4 = Timer(4, freq=20000)
 my_motor_Left = Motor(Pin.cpu.B7, Pin.cpu.C13, Pin.cpu.C14, tim4, 1)
 encoder_Right = Encoder(tim3, Pin.cpu.C6, Pin.cpu.C7)
 my_motor_Right = Motor(Pin.cpu.B6, Pin.cpu.B10, Pin.cpu.A10, tim4, 2)
 encoder_Left = Encoder(tim1, Pin.cpu.A8, Pin.cpu.A9)
 bump_sensor_right = Bump_Sensor(Pin.cpu.B13, Pin.cpu.B3, Pin.cpu.B5)
 bump_sensor_left = Bump_Sensor(Pin.cpu.B11, Pin.cpu.B15, Pin.cpu.B14)
 ir1 = IR_Sensor(Pin.cpu.A6)
 ir2 = IR_Sensor(Pin.cpu.A7)
 ir3 = IR_Sensor(Pin.cpu.C4)
 ir4 = IR_Sensor(Pin.cpu.A0)
 ir5 = IR_Sensor(Pin.cpu.A1)
 ir6 = IR_Sensor(Pin.cpu.C4)
 ir7 = IR_Sensor(Pin.cpu.B0)
 ir8 = IR_Sensor(Pin.cpu.C0)
 ir9 = IR_Sensor(Pin.cpu.C1)
 ir10 = IR_Sensor(Pin.cpu.C2)
 ir11 = IR_Sensor(Pin.cpu.C3)
 ir12 = IR_Sensor(Pin.cpu.C5)
 ir13 = IR_Sensor(Pin.cpu.B1)
 line_sensor_obj = Line_Sensor(ir1, ir2, ir3, ir4, ir5, ir6, ir7, ir8, ir9, ir10, ir11, ir12, ir13)
 uart_obj = UART(5, 115200)
 bits
 parity
 None
 stop
 timeout
 i2c_obj = I2C(1,I2C.CONTROLLER,baudrate = 400000)
 imu_obj = IMU(i2c_obj)
 controller_obj_left = Controller(.2,1.95,1, ERR_SAT_LEFT, EFF_SAT_LEFT)
 controller_obj_right = Controller(.2,1.95,1, ERR_SAT_RIGHT, EFF_SAT_RIGHT)
 controller_obj_line = Controller(150, 10, 1, ERR_SAT_LINE, EFF_SAT_LINE)
 controller_obj_yaw = Controller(.8,.3,1, ERR_SAT_YAW, EFF_SAT_YAW)
 motor_Left_class = motor_encoder_left_class(my_motor_Left, encoder_Left, m_state_l, position_l, velocity_l, times, PWM_l, delay)
 motor_Right_class = motor_encoder_right_class(my_motor_Right, encoder_Right, m_state_r, position_r, velocity_r, times, PWM_r, delay)
 ui_obj = ui(testing_flg, m_state_l, m_state_r, position, velocity, times, PWM_l, PWM_r, delay, uart_obj, fwd_ref, arc_ref, piv_ref, c_state, velocity2, need_Calibrate, ready_Black, ready_White, automatic_mode, imu_flg)
 data_collector_obj = data_collector(testing_flg, position, velocity, times, position_l, velocity_l, position_r, velocity_r, velocity2)
 control_task_obj = control_task(fwd_ref, arc_ref, piv_ref, c_state, controller_obj_left, controller_obj_right, position_l, velocity_l, position_r, velocity_r, PWM_l, PWM_r, encoder_Right, encoder_Left, m_state_l, m_state_r, centroid, controller_obj_line, automatic_mode, line_sensor_obj, need_Calibrate, yaw, centroid_goal, yaw_goal, controller_obj_yaw)
 line_task_obj = line_task(line_sensor_obj, l_state, need_Calibrate, ready_Black, ready_White,centroid)
 imu_task_obj = imu_task(imu_obj, imu_flg, yaw, yaw_velocity)
 observer_obj = observer(position_l, position_r, yaw, yaw_velocity, PWM_l, PWM_r, velocity_l, velocity_r, total_dist)
 pathing_obj = pathing_plan(total_dist, automatic_mode, c_state, fwd_ref, piv_ref, yaw, centroid_goal, yaw_goal, bump_on_off, bump_flg)
 bump_obj = Bump_Task(c_state, bump_sensor_right, bump_sensor_left, bump_on_off, bump_flg)
 task1 = cotask.Task(data_collector_obj.run, name="data_collector", priority=2, period=18, profile=True, trace=False, shares=())
 task2 = cotask.Task(motor_Left_class.run, name="motor_encoder_left", priority=7, period=13, profile=True, trace=False, shares=())
 task3 = cotask.Task(motor_Right_class.run, name="motor_encoder_right", priority=7, period=13, profile=True, trace=False, shares=())
 task4 = cotask.Task(ui_obj.run, name="ui", priority=1, period=1, profile=True, trace=False, shares=())
 task5 = cotask.Task(control_task_obj.run, name="control_task", priority=6, period=15, profile = True, trace=False, shares=())
 task6 = cotask.Task(line_task_obj.run, name="line_task", priority = 5, period = 22, profile = True, trace = False, shares=())
 task7 = cotask.Task(imu_task_obj.run, name = "imu_task", priority = 6, period = 20, profile= True, trace= False, shares = ())
 task8 = cotask.Task(observer_obj.run, name = "observer", priority = 4, period = 20, profile = True, trace = False, shares = ())
 task9 = cotask.Task(pathing_obj.run, name= "pathing", priority = 3, period = 30, profile = True, trace = False, shares = ())
 task10 = cotask.Task(bump_obj.run, name = "bump task", priority = 2, period = 50, profile = True, trace = False, shares=())

Variable Documentation

◆ arc_ref

main.arc_ref = task_share.Share('l', thread_protect = False, name = "arc_ref")

Definition at line 78 of file main.py.

◆ automatic_mode

main.automatic_mode = task_share.Share('b', thread_protect = False, name = "automatic_mode" )

Definition at line 89 of file main.py.

◆ bits

main.bits

Definition at line 147 of file main.py.

◆ bump_flg

main.bump_flg = task_share.Share("b", thread_protect = False, name = "Bump Flag")

Definition at line 102 of file main.py.

◆ bump_obj

Definition at line 173 of file main.py.

◆ bump_on_off

main.bump_on_off = task_share.Share("b", thread_protect = False, name = "Bump Flag")

Definition at line 101 of file main.py.

◆ bump_sensor_left

main.bump_sensor_left = Bump_Sensor(Pin.cpu.B11, Pin.cpu.B15, Pin.cpu.B14)

Definition at line 128 of file main.py.

◆ bump_sensor_right

main.bump_sensor_right = Bump_Sensor(Pin.cpu.B13, Pin.cpu.B3, Pin.cpu.B5)

Definition at line 127 of file main.py.

◆ c_state

main.c_state = task_share.Share('b', thread_protect = False, name = "c_state")

Definition at line 80 of file main.py.

◆ centroid

main.centroid = task_share.Share('f', thread_protect = False, name ="centroid")

Definition at line 87 of file main.py.

◆ centroid_goal

main.centroid_goal = task_share.Share("f", thread_protect = False, name = "Goal Centroid")

Definition at line 98 of file main.py.

◆ control_task_obj

◆ controller_obj_left

main.controller_obj_left = Controller(.2,1.95,1, ERR_SAT_LEFT, EFF_SAT_LEFT)

Definition at line 156 of file main.py.

◆ controller_obj_line

main.controller_obj_line = Controller(150, 10, 1, ERR_SAT_LINE, EFF_SAT_LINE)

Definition at line 158 of file main.py.

◆ controller_obj_right

main.controller_obj_right = Controller(.2,1.95,1, ERR_SAT_RIGHT, EFF_SAT_RIGHT)

Definition at line 157 of file main.py.

◆ controller_obj_yaw

main.controller_obj_yaw = Controller(.8,.3,1, ERR_SAT_YAW, EFF_SAT_YAW)

Definition at line 159 of file main.py.

◆ data_collector_obj

Definition at line 167 of file main.py.

◆ delay

main.delay = task_share.Share('b', thread_protect = False, name = "delay")

Definition at line 75 of file main.py.

◆ EFF_SAT_LEFT

float main.EFF_SAT_LEFT = 85.0

Definition at line 48 of file main.py.

◆ EFF_SAT_LINE

int main.EFF_SAT_LINE = 40

Definition at line 54 of file main.py.

◆ EFF_SAT_RIGHT

float main.EFF_SAT_RIGHT = 85.0

Definition at line 51 of file main.py.

◆ EFF_SAT_YAW

int main.EFF_SAT_YAW = 100

Definition at line 57 of file main.py.

◆ encoder_Left

main.encoder_Left = Encoder(tim1, Pin.cpu.A8, Pin.cpu.A9)

Definition at line 125 of file main.py.

◆ encoder_Right

main.encoder_Right = Encoder(tim3, Pin.cpu.C6, Pin.cpu.C7)

Definition at line 122 of file main.py.

◆ ERR_SAT_LEFT

float main.ERR_SAT_LEFT = 50.0

Definition at line 47 of file main.py.

◆ ERR_SAT_LINE

int main.ERR_SAT_LINE = 1

Definition at line 53 of file main.py.

◆ ERR_SAT_RIGHT

float main.ERR_SAT_RIGHT = 50.0

Definition at line 50 of file main.py.

◆ ERR_SAT_YAW

int main.ERR_SAT_YAW = .8

Definition at line 56 of file main.py.

◆ fwd_ref

main.fwd_ref = task_share.Share('l', thread_protect = False, name = "fwd_ref")

Definition at line 77 of file main.py.

◆ i2c_obj

main.i2c_obj = I2C(1,I2C.CONTROLLER,baudrate = 400000)

Definition at line 150 of file main.py.

◆ imu_flg

main.imu_flg = task_share.Share('b', thread_protect= False, name = "imu_flg")

Definition at line 91 of file main.py.

◆ imu_obj

main.imu_obj = IMU(i2c_obj)

Definition at line 151 of file main.py.

◆ imu_task_obj

main.imu_task_obj = imu_task(imu_obj, imu_flg, yaw, yaw_velocity)

Definition at line 170 of file main.py.

◆ ir1

main.ir1 = IR_Sensor(Pin.cpu.A6)

Definition at line 130 of file main.py.

◆ ir10

main.ir10 = IR_Sensor(Pin.cpu.C2)

Definition at line 139 of file main.py.

◆ ir11

main.ir11 = IR_Sensor(Pin.cpu.C3)

Definition at line 140 of file main.py.

◆ ir12

main.ir12 = IR_Sensor(Pin.cpu.C5)

Definition at line 141 of file main.py.

◆ ir13

main.ir13 = IR_Sensor(Pin.cpu.B1)

Definition at line 142 of file main.py.

◆ ir2

main.ir2 = IR_Sensor(Pin.cpu.A7)

Definition at line 131 of file main.py.

◆ ir3

main.ir3 = IR_Sensor(Pin.cpu.C4)

Definition at line 132 of file main.py.

◆ ir4

main.ir4 = IR_Sensor(Pin.cpu.A0)

Definition at line 133 of file main.py.

◆ ir5

main.ir5 = IR_Sensor(Pin.cpu.A1)

Definition at line 134 of file main.py.

◆ ir6

main.ir6 = IR_Sensor(Pin.cpu.C4)

Definition at line 135 of file main.py.

◆ ir7

main.ir7 = IR_Sensor(Pin.cpu.B0)

Definition at line 136 of file main.py.

◆ ir8

main.ir8 = IR_Sensor(Pin.cpu.C0)

Definition at line 137 of file main.py.

◆ ir9

main.ir9 = IR_Sensor(Pin.cpu.C1)

Definition at line 138 of file main.py.

◆ l_state

main.l_state = task_share.Share('b', thread_protect = False, name = "l_state")

Definition at line 82 of file main.py.

◆ line_sensor_obj

main.line_sensor_obj = Line_Sensor(ir1, ir2, ir3, ir4, ir5, ir6, ir7, ir8, ir9, ir10, ir11, ir12, ir13)

Definition at line 144 of file main.py.

◆ line_task_obj

Definition at line 169 of file main.py.

◆ m_state_l

main.m_state_l = task_share.Share('b', thread_protect = False, name = "m_state_l")

Definition at line 62 of file main.py.

◆ m_state_r

main.m_state_r = task_share.Share('b', thread_protect = False, name = "m_state_r")

Definition at line 63 of file main.py.

◆ motor_Left_class

Definition at line 164 of file main.py.

◆ motor_Right_class

Definition at line 165 of file main.py.

◆ my_motor_Left

main.my_motor_Left = Motor(Pin.cpu.B7, Pin.cpu.C13, Pin.cpu.C14, tim4, 1)

Definition at line 121 of file main.py.

◆ my_motor_Right

main.my_motor_Right = Motor(Pin.cpu.B6, Pin.cpu.B10, Pin.cpu.A10, tim4, 2)

Definition at line 124 of file main.py.

◆ need_Calibrate

main.need_Calibrate = task_share.Share('b', thread_protect = False, name = "need calibrate")

Definition at line 86 of file main.py.

◆ None

main.None

Definition at line 147 of file main.py.

◆ observer_obj

Definition at line 171 of file main.py.

◆ parity

main.parity

Definition at line 147 of file main.py.

◆ pathing_obj

◆ piv_ref

main.piv_ref = task_share.Share('f', thread_protect = False, name = "piv_ref")

Definition at line 79 of file main.py.

◆ position

main.position = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "position")

Definition at line 110 of file main.py.

◆ position_l

main.position_l = task_share.Share('f', thread_protect = False, name = "position_l")

Definition at line 71 of file main.py.

◆ position_r

main.position_r = task_share.Share('f', thread_protect = False, name = "position_r")

Definition at line 68 of file main.py.

◆ PWM_l

main.PWM_l = task_share.Share('f', thread_protect = False, name = "PWM_l")

Definition at line 65 of file main.py.

◆ PWM_r

main.PWM_r = task_share.Share('f', thread_protect = False, name = "PWM_r")

Definition at line 66 of file main.py.

◆ ready_Black

main.ready_Black = task_share.Share('b', thread_protect = False, name = "ready_Black")

Definition at line 83 of file main.py.

◆ ready_White

main.ready_White = task_share.Share('b', thread_protect = False, name = "ready_White")

Definition at line 84 of file main.py.

◆ stop

main.stop

Definition at line 147 of file main.py.

◆ task1

main.task1 = cotask.Task(data_collector_obj.run, name="data_collector", priority=2, period=18, profile=True, trace=False, shares=())

Definition at line 178 of file main.py.

◆ task10

main.task10 = cotask.Task(bump_obj.run, name = "bump task", priority = 2, period = 50, profile = True, trace = False, shares=())

Definition at line 187 of file main.py.

◆ task2

main.task2 = cotask.Task(motor_Left_class.run, name="motor_encoder_left", priority=7, period=13, profile=True, trace=False, shares=())

Definition at line 179 of file main.py.

◆ task3

main.task3 = cotask.Task(motor_Right_class.run, name="motor_encoder_right", priority=7, period=13, profile=True, trace=False, shares=())

Definition at line 180 of file main.py.

◆ task4

main.task4 = cotask.Task(ui_obj.run, name="ui", priority=1, period=1, profile=True, trace=False, shares=())

Definition at line 181 of file main.py.

◆ task5

main.task5 = cotask.Task(control_task_obj.run, name="control_task", priority=6, period=15, profile = True, trace=False, shares=())

Definition at line 182 of file main.py.

◆ task6

main.task6 = cotask.Task(line_task_obj.run, name="line_task", priority = 5, period = 22, profile = True, trace = False, shares=())

Definition at line 183 of file main.py.

◆ task7

main.task7 = cotask.Task(imu_task_obj.run, name = "imu_task", priority = 6, period = 20, profile= True, trace= False, shares = ())

Definition at line 184 of file main.py.

◆ task8

main.task8 = cotask.Task(observer_obj.run, name = "observer", priority = 4, period = 20, profile = True, trace = False, shares = ())

Definition at line 185 of file main.py.

◆ task9

main.task9 = cotask.Task(pathing_obj.run, name= "pathing", priority = 3, period = 30, profile = True, trace = False, shares = ())

Definition at line 186 of file main.py.

◆ testing_flg

main.testing_flg = task_share.Share('b', thread_protect = False, name = "testing_flg")

Definition at line 74 of file main.py.

◆ tim1

main.tim1 = Timer(1, prescaler=0, period=65535)

Definition at line 117 of file main.py.

◆ tim3

main.tim3 = Timer(3, prescaler=0, period=65535)

Definition at line 118 of file main.py.

◆ tim4

main.tim4 = Timer(4, freq=20000)

Definition at line 119 of file main.py.

◆ timeout

main.timeout

Definition at line 147 of file main.py.

◆ times

main.times = task_share.Queue('l', 50, thread_protect = False, overwrite = False, name = "times")

Definition at line 112 of file main.py.

◆ total_dist

main.total_dist = task_share.Share("f", thread_protect = False, name = "S")

Definition at line 96 of file main.py.

◆ uart_obj

main.uart_obj = UART(5, 115200)

Definition at line 146 of file main.py.

◆ ui_obj

◆ velocity

main.velocity = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "velocity")

Definition at line 107 of file main.py.

◆ velocity2

main.velocity2 = task_share.Queue('f', 50, thread_protect = False, overwrite = False, name = "velocity2")

Definition at line 108 of file main.py.

◆ velocity_l

main.velocity_l = task_share.Share('f', thread_protect = False, name = "velocity_l")

Definition at line 72 of file main.py.

◆ velocity_r

main.velocity_r = task_share.Share('f', thread_protect = False, name = "velocity_r")

Definition at line 69 of file main.py.

◆ yaw

main.yaw = task_share.Share('f', thread_protect = False, name = "yaw")

Definition at line 93 of file main.py.

◆ yaw_goal

main.yaw_goal = task_share.Share("f", thread_protect = False, name = "Yaw Goal")

Definition at line 99 of file main.py.

◆ yaw_velocity

main.yaw_velocity = task_share.Share('f', thread_protect = False, name = "yaw_velocity")

Definition at line 94 of file main.py.