diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-25 17:24:14 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-25 17:24:14 -0700 | 
| commit | f26cfe417c6977cf1e7e75a4f050e25f64d41859 (patch) | |
| tree | 2f19ca9c93c3246b3eeadafee250f9dd3ee222d6 /altoslib/AltosTelemetryMegaSensor.java | |
| parent | 7600116a191b3ac252a0f716d200d0e0b3500987 (diff) | |
altoslib: Do data analysis on raw values rather than AltosState
Use AltosFlightSeries instead of a sequence of AltosState records when
processing saved data. This provides a better way of doing filtering
and plotting.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosTelemetryMegaSensor.java')
| -rw-r--r-- | altoslib/AltosTelemetryMegaSensor.java | 45 | 
1 files changed, 32 insertions, 13 deletions
| diff --git a/altoslib/AltosTelemetryMegaSensor.java b/altoslib/AltosTelemetryMegaSensor.java index bf560e92..396bdb16 100644 --- a/altoslib/AltosTelemetryMegaSensor.java +++ b/altoslib/AltosTelemetryMegaSensor.java @@ -41,22 +41,41 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {  		super(bytes);  	} -	public void update_state(AltosState state) { -		super.update_state(state); +	public void provide_data(AltosDataListener listener, AltosCalData cal_data) { +		super.provide_data(listener, cal_data); -		state.set_accel(accel()); -		state.set_pressure(pres()); -		state.set_temperature(temp() / 100.0); +		listener.set_acceleration(cal_data.acceleration(accel())); +		listener.set_pressure(pres()); +		listener.set_temperature(temp() / 100.0); -		state.set_orient(orient()); +		listener.set_orient(orient()); -		state.set_imu(new AltosIMU(accel_y(),	/* along */ -					   accel_x(),	/* across */ -					   accel_z(),	/* through */ -					   gyro_y(),	/* along */ -					   gyro_x(),	/* across */ -					   gyro_z()));	/* through */ +		/* XXX we have no calibration data for these values */ -		state.set_mag(new AltosMag(mag_x(), mag_y(), mag_z())); +		if (cal_data.accel_zero_along == AltosLib.MISSING) +			cal_data.set_accel_zero(0, 0, 0); +		if (cal_data.gyro_zero_roll == AltosLib.MISSING) +			cal_data.set_gyro_zero(0, 0, 0); + +		int	accel_along = accel_y(); +		int	accel_across = accel_x(); +		int	accel_through = accel_z(); +		int	gyro_roll = gyro_y(); +		int	gyro_pitch = gyro_x(); +		int	gyro_yaw = gyro_z(); + +		int	mag_along = mag_x(); +		int	mag_across = mag_y(); +		int	mag_through = mag_z(); + +		listener.set_accel(cal_data.accel_along(accel_along), +				   cal_data.accel_across(accel_across), +				   cal_data.accel_through(accel_through)); +		listener.set_gyro(cal_data.gyro_roll(gyro_roll), +				  cal_data.gyro_pitch(gyro_pitch), +				  cal_data.gyro_yaw(gyro_yaw)); +		listener.set_mag(cal_data.mag_along(mag_along), +				 cal_data.mag_across(mag_across), +				 cal_data.mag_through(mag_through));  	}  } | 
