from IMUtoBT import IMUtoBT from Motor import Motor from Stablizer import Stablizer print "RollE - A Ballbot" print "Final Year Project" print "Ghulam Ishaq Khan Institute of Engineering Sciences and Technology" print "https://github.com/alyyousuf7/RollE" print "" signal.signal(signal.SIGTSTP, config.cleanup) print "Press CTRL+Z to exit." print "" imu = IMU() imu.start() bt = Bluetooth() bt.start() imu2bt = IMUtoBT(imu, bt) imu2bt.start() motor1 = Motor(config.Motor1_D1, config.Motor1_D2, config.Motor1_EN, 0) motor2 = Motor(config.Motor2_D1, config.Motor2_D2, config.Motor2_EN, 1) motor3 = Motor(config.Motor3_D1, config.Motor3_D2, config.Motor3_EN, 2) stablizer = Stablizer(imu, motor1, motor2, motor3) # Send PID Values over Bluetooth currentPID = "PID:%.2f,%.2f,%.2f\n" % tuple(config.PID)
import time import os from ToFs_UDP import ToFs_UDP from Robot_Slave import Robot_Slave from IMU import IMU if __name__ == "__main__": print("This process has the PID", os.getpid()) imu = IMU() imu.start() tofs_udp = ToFs_UDP() tofs_udp.start() time.sleep(0.1) robot_Slave = Robot_Slave() while True: #try: tof_right_2, tof_right_1, tof_front, tof_left_1, tof_left_2 = tofs_udp.getMeasurements( ) print(" ToF Readings : %d %d %d %d %d " % (tof_right_2, tof_right_1, tof_front, tof_left_1, tof_left_2)) roll, pitch, yaw = imu.getEuler() print(" IMU Readings : %f %f %f " % (roll, pitch, yaw)) #check_IMU_status_flag=robot_Slave.read_check_IMU_status_flag()