def main(): # Instantiate an LSM9DS0 using default parameters (bus 1, gyro addr 6b, # xm addr 1d) sensor = sensorObj.LSM9DS0() ## Exit handlers ## # This function stops python from printing a stacktrace when you hit control-C def SIGINTHandler(signum, frame): raise SystemExit # This function lets you run code on exit def exitHandler(): print "Exiting" sys.exit(0) # Register exit handlers atexit.register(exitHandler) signal.signal(signal.SIGINT, SIGINTHandler) sensor.init() x = sensorObj.new_floatp() y = sensorObj.new_floatp() z = sensorObj.new_floatp() while (1): sensor.update() sensor.getAccelerometer(x, y, z) print "Accelerometer: AX: ", sensorObj.floatp_value(x), print " AY: ", sensorObj.floatp_value(y), print " AZ: ", sensorObj.floatp_value(z) sensor.getGyroscope(x, y, z) print "Gyroscope: GX: ", sensorObj.floatp_value(x), print " GY: ", sensorObj.floatp_value(y), print " GZ: ", sensorObj.floatp_value(z) sensor.getMagnetometer(x, y, z) print "Magnetometer: MX: ", sensorObj.floatp_value(x), print " MY: ", sensorObj.floatp_value(y), print " MZ: ", sensorObj.floatp_value(z) print "Temperature: ", sensor.getTemperature() print time.sleep(.5)
sys.exit(0) # Register exit handlers atexit.register(exitHandler) signal.signal(signal.SIGINT, SIGINTHandler) sensor.init() x = sensorObj.new_floatp() y = sensorObj.new_floatp() z = sensorObj.new_floatp() while (1): sensor.update() sensor.getAccelerometer(x, y, z) print "Accelerometer: AX: ", sensorObj.floatp_value(x), print " AY: ", sensorObj.floatp_value(y), print " AZ: ", sensorObj.floatp_value(z) sensor.getGyroscope(x, y, z) print "Gyroscope: GX: ", sensorObj.floatp_value(x), print " GY: ", sensorObj.floatp_value(y), print " GZ: ", sensorObj.floatp_value(z) sensor.getMagnetometer(x, y, z) print "Magnetometer: MX: ", sensorObj.floatp_value(x), print " MY: ", sensorObj.floatp_value(y), print " MZ: ", sensorObj.floatp_value(z) print "Temperature: ", sensor.getTemperature() print
def getGZ(self): return dofObj.floatp_value(self.g_z)
def getAZ(self): return dofObj.floatp_value(self.a_z)
# Register exit handlers atexit.register(exitHandler) signal.signal(signal.SIGINT, SIGINTHandler) sensor.init() x = sensorObj.new_floatp() y = sensorObj.new_floatp() z = sensorObj.new_floatp() while (1): sensor.update() sensor.getAccelerometer(x, y, z) print "Accelerometer: AX: ", sensorObj.floatp_value(x), print " AY: ", sensorObj.floatp_value(y), print " AZ: ", sensorObj.floatp_value(z) sensor.getGyroscope(x, y, z) print "Gyroscope: GX: ", sensorObj.floatp_value(x), print " GY: ", sensorObj.floatp_value(y), print " GZ: ", sensorObj.floatp_value(z) sensor.getMagnetometer(x, y, z) print "Magnetometer: MX: ", sensorObj.floatp_value(x), print " MY: ", sensorObj.floatp_value(y), print " MZ: ", sensorObj.floatp_value(z) print "Temperature: ", sensor.getTemperature() print
def getGZ(self): return dofObj.floatp_value(self.g_z)
def getAZ(self): return dofObj.floatp_value(self.a_z)