Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import timber.log.Timber;

/**
* Feeds Location Data from Android's FusedLocation LocationProvider
*/
Expand Down Expand Up @@ -121,9 +123,11 @@ public void onLocationResult(LocationResult result) {
final float currentSpeed = distanceToLast > 0f && timeSinceLast > 0
? (distanceToLast / timeSinceLast)
: 0f;
final boolean isLocationAccurate = isLocationAccurate(androidLocation.getAccuracy(), currentSpeed);
final boolean isLocationAccurate = isLocationAccurate(androidLocation.getAccuracy(),
currentSpeed);

org.droidplanner.services.android.core.gcs.location.Location location = new org.droidplanner.services.android.core.gcs.location.Location(
org.droidplanner.services.android.core.gcs.location.Location location =
new org.droidplanner.services.android.core.gcs.location.Location(
new LatLongAlt(
androidLocation.getLatitude(),
androidLocation.getLongitude(),
Expand All @@ -134,6 +138,9 @@ public void onLocationResult(LocationResult result) {
androidLocationTime);

mLastLocation = androidLocation;

Timber.d("Location Lat/Long: " + getLatLongFromLocation(androidLocation));

notifyLocationUpdate(location);
}

Expand Down Expand Up @@ -170,6 +177,11 @@ private boolean isLocationAccurate(float accuracy, float currentSpeed) {
return true;
}

public String getLatLongFromLocation(final Location location) {
return Location.convert(location.getLatitude(), Location.FORMAT_DEGREES) + " " +
Location.convert(location.getLongitude(), Location.FORMAT_DEGREES);
}

@Override
public void addLocationListener(String tag, LocationReceiver receiver) {
receivers.put(tag, receiver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ public static void enableFollowMe(DroneManager droneMgr, Handler droneHandler, F

FollowAlgorithm currentAlg = followMe.getFollowAlgorithm();
if (currentAlg.getType() != selectedMode) {
if (selectedMode == FollowAlgorithm.FollowModes.SOLO_SHOT && !SoloApiUtils.isSoloLinkFeatureAvailable(droneMgr, listener))
if (selectedMode == FollowAlgorithm.FollowModes.SOLO_SHOT &&
!SoloApiUtils.isSoloLinkFeatureAvailable(droneMgr.getDrone(), listener))
return;

followMe.setAlgorithm(selectedMode.getAlgorithmType(droneMgr, droneHandler));
Expand Down