def loop(self): """Gets new IMU sensor data""" sensor_data = SensorData() calibration_status = SingleRegister() if self.remote_id is not None or self.pozyx.checkForFlag(POZYX_INT_MASK_IMU, 0.01) == POZYX_SUCCESS: status = self.pozyx.getAllSensorData(sensor_data, self.remote_id) status &= self.pozyx.getCalibrationStatus(calibration_status, self.remote_id) if status == POZYX_SUCCESS: self.publishSensorData(sensor_data, calibration_status)
def GetOrientation(self, tag_id): # Get Orientation data from Pozyx sensor orientation = SensorData().euler_angles self.pozyx.getEulerAngles_deg(orientation, tag_id) # Extract ornetation data (pitch, roll, yaw) orientationData = str(orientation).split(',') yaw = float(orientationData[0].lstrip("Heading: ")) roll = float(orientationData[1].lstrip("Roll: ")) pitch = float(orientationData[2].lstrip("Pitch: ")) return (pitch, roll, yaw)
def printOrientation(self): # Get Orientation data from Pozyx sensor orientation = SensorData().euler_angles self.pozyx.getEulerAngles_deg(orientation, self.remote_id) # Extract key data (pitch, roll, yaw) orientationData = str(orientation).split(',') yaw = orientationData[0].lstrip("Heading: ") roll = orientationData[1].lstrip("Roll: ") pitch = orientationData[2].lstrip("Pitch: ") #print("%s, %s, %s" %(pitch, roll, yaw)) return "%s, %s, %s" % (pitch, roll, yaw)
def loop(self): """Performs positioning and displays/exports the results.""" position = Coordinates() sensor_data = SensorData() self.publishData(position, sensor_data) #nur ohne anchors status = self.pozyx.doPositioning(position, self.dimension, self.height, self.algorithm, remote_id=self.remote_id) if status == POZYX_SUCCESS: self.publishData(position, sensor_data) calibration_status = SingleRegister() if self.remote_id is not None or self.pozyx.checkForFlag( POZYX_INT_MASK_IMU, 0.01) == POZYX_SUCCESS: status = self.pozyx.getAllSensorData(sensor_data, self.remote_id) status &= self.pozyx.getCalibrationStatus(calibration_status, self.remote_id)