use of org.osgi.util.measurement.Measurement in project kura by eclipse.
the class PositionServiceImpl method updateGps.
private void updateGps() {
s_logger.debug("GPS Emulator index: {}", this.index);
if (this.index + 1 == this.gpsPoints.length) {
s_logger.debug("GPS Emulator - wrapping index");
this.index = 0;
}
Measurement latitude = new Measurement(java.lang.Math.toRadians(this.gpsPoints[this.index].getLatitude()), Unit.rad);
Measurement longitude = new Measurement(java.lang.Math.toRadians(this.gpsPoints[this.index].getLongitude()), Unit.rad);
Measurement altitude = new Measurement(this.gpsPoints[this.index].getAltitude(), Unit.m);
s_logger.debug("Updating lat/long/altitude: " + latitude + "/" + longitude + "/" + altitude);
// Measurement lat, Measurement lon, Measurement alt, Measurement speed, Measurement track
this.currentTime = new Date();
this.currentPosition = new Position(latitude, longitude, altitude, null, null);
this.currentNmeaPosition = new NmeaPosition(this.gpsPoints[this.index].getLatitude(), this.gpsPoints[this.index].getLongitude(), this.gpsPoints[this.index].getAltitude(), 0, 0);
this.index++;
return;
}
use of org.osgi.util.measurement.Measurement in project kura by eclipse.
the class PositionServiceImpl method initializeDefaultPosition.
private void initializeDefaultPosition(double lat, double lon, double alt) {
Measurement l_latitude = new Measurement(java.lang.Math.toRadians(lat), Unit.rad);
Measurement l_longitude = new Measurement(java.lang.Math.toRadians(lon), Unit.rad);
Measurement l_altitude = new Measurement(alt, Unit.m);
// conversion speed in knots to m/s : 1 m/s = 1.94384449
Measurement l_speed = new Measurement(0, Unit.m_s);
// knots
Measurement l_track = new Measurement(java.lang.Math.toRadians(0), Unit.rad);
double l_latitudeNmea = lat;
double l_longitudeNmea = lon;
double l_altitudeNmea = alt;
double l_speedNmea = 0;
double l_trackNmea = 0;
int l_fixQuality = 0;
int l_nrSatellites = 0;
double l_DOP = 0;
double l_PDOP = 0;
double l_HDOP = 0;
double l_VDOP = 0;
int l_3Dfix = 0;
this.m_defaultPosition = new Position(l_latitude, l_longitude, l_altitude, l_speed, l_track);
this.m_defaultNmeaPosition = new NmeaPosition(l_latitudeNmea, l_longitudeNmea, l_altitudeNmea, l_speedNmea, l_trackNmea, l_fixQuality, l_nrSatellites, l_DOP, l_PDOP, l_HDOP, l_VDOP, l_3Dfix);
this.m_GpsdPosition = new Position(l_latitude, l_longitude, l_altitude, l_speed, l_track);
this.m_GpsdNmeaPosition = new NmeaPosition(l_latitudeNmea, l_longitudeNmea, l_altitudeNmea, l_speedNmea, l_trackNmea, l_fixQuality, l_nrSatellites, l_DOP, l_PDOP, l_HDOP, l_VDOP, l_3Dfix);
}
Aggregations