Пример #1
0
def reroute(changepin):

	changePin = int(changepin)

	if changePin == 1:
		control.on()
	elif changePin == 2:
		control.front()
	elif changePin == 3:
		control.off()
	elif changePin == 4:
		control.left()
	elif changePin == 5:
		control.stop()
	elif changePin == 6:
		control.right()
	elif changePin == 7:
		control.on()
	elif changePin == 8:
		control.back()
	else:
		control.off()


	response = make_response(redirect(url_for('index')))
	return(response)
def ctrl_wheels():
    if (request.method == 'POST'):
        print "***********"
        print request.form
        print "***********"
        id = request.form['dir']
        if id == 'forward':
            #forward command
            control.forward()
            print 'FORWARD command received'
        elif id == 'backward':
            #backward command
            control.backward()
            print 'BACKWARD command received'
        elif id == 'left':
            #moveleft command
            control.left()
            print 'MOVELEFT command received'
        elif id == 'right':
            #moveright command
            control.right()
            print 'MOVERIGHT command received'
        elif id == 'stop':
            #moveright command
            control.stop()
            print 'STOP command received'
    return redirect(url_for('init_webserver'))
Пример #3
0
     return_msg = "quitting"
     co.quitserver()
     cam.release()
     cv2.destroyAllWindows()
     running = False
 elif message == "forward":
     co.forward()
     # Manual command move forward
     pass
 elif message == "backward":
     co.backward()
     # Manual command move backward
     pass
 elif message == "right":
     #AT_ang=AT_ang+5
     co.right()
     # Manual command pivot right
     pass
 elif message == "left":
     #AT_ang=AT_ang-5
     co.left()
     # Manual command pivot left
     pass
 elif message == "up":
     #AT_dist=AT_dist+0.1
     co.top()
     # Manual command increase altitude
     pass
 elif message == "down":
     #AT_dist=AT_dist-0.1
     co.bot()
                                      1)

            if (label == 'cell phone'):

                ctlx = result['topleft']['x']
                ctly = result['topleft']['y']
                cbrx = result['bottomright'][
                    'x']  # calculating center of cellphone
                cbry = result['bottomright']['y']
                ccx = int((ctlx + cbrx) / 2)
                ccy = int((ctly + cbry) / 2)
                frame = cv2.rectangle(frame, (ctlx, ctly), (cbrx, cbry), color,
                                      2)  # making rectangle aroung object
                frame = cv2.line(
                    frame, (pcx, pcy), (ccx, ccy), (0, 255, 0), 3
                )  # joning line from center to center of person and object
                if (ccy < pcy):
                    left()
                    walk()

                if (ccy > pcy):
                    walk()
                    right()
                else:
                    reCentre()
            cv2.imshow('frame', frame)
        print('FPS {:.1f}'.format(1 / (time.time() - stime)))
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
capture.release()
cv2.destroyAllWindows()
Пример #5
0
                            last_min = current_min
                        else:
                            pass

                    else:
                        hour_difference = current_hour2 - last_hour2
                        min_difference = current_min + hour_difference * 60 - last_min
                        if min_difference >= time_delay_humidity:

                            last_hour2 = current_hour2
                            last_min = current_min
                            stabilizer = True

                    # rotate every few hours
                    if current_hour3 - last_hour3 >= each_hr_for_rotation:
                        right(rotate_time)
                        current_rotate_position = current_rotate_position + 1
                        last_hour3 = current_hour3
                        # set back to zero when 360 degree
                        if current_rotate_position == 4:
                            current_rotate_position = 0

                    # every few hours after move backward, it return back to inital position

                    if current_day == last_day:
                        if current_hour - last_hour >= time_for_return:
                            counter, current_rotate_position = func_return(
                                counter, move_time)
                            last_hour = current_hour
                    else:
                        # across day