Beispiel #1
0
Vector4::Vector4(const float x, const float y, const float z, const float w){

	values[0] = x;
	values[1] = y;
	values[2] = z;
	values[3] = w;

	mag = calculateMag();

}
void MPU9150::calibrate() {
	Vect3D<float> mag;
	if (getIntDataReadyStatus() == 1) {
		getMagnetoScaled(&mag.x, &mag.y, &mag.z);
		if (min_x >= mag.x) min_x = mag.x; if (max_x <  mag.x) max_x = mag.x;
		if (min_y >= mag.y) min_y = mag.y; if (max_y <  mag.y) max_y = mag.y;
		if (min_z >= mag.z) min_z = mag.z; if (max_z <  mag.z) max_z = mag.z;
		calculateMag();
	}
}
Beispiel #3
0
//Vector4 will make a copy of this array for itself
Vector4::Vector4(const float *newValues) {

	assert(newValues);

	values[0] = newValues[0];
	values[1] = newValues[1];
	values[2] = newValues[2];
	values[3] = newValues[3];

	mag = calculateMag();

}
void MPU9150::correctMag(float *mx, float *my, float *mz) {
	calculateMag();
	*mx = (*mx - offset_x) * scale_x;
	*my = (*my - offset_y) * scale_y;
	*mz = (*mz - offset_z) * scale_z;
}