This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"trigger": { | |
"queryPatterns": [ | |
"move ($GoDirection:go_direction)? ($Speed:speed)? for $SchemaOrg_Number:number seconds", | |
"move ($GoDirection:go_direction)? for $SchemaOrg_Number:number seconds ($Speed:speed)?", | |
"go ($GoDirection:go_direction)? ($Speed:speed)? for $SchemaOrg_Number:number seconds", | |
"go ($GoDirection:go_direction)? for $SchemaOrg_Number:number seconds ($Speed:speed)?" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest": { | |
"displayName": "Moving Google Home", | |
"invocationName": "Moving Google Home", | |
"category": "PRODUCTIVITY" | |
}, | |
"actions": [ | |
{ | |
"name": "com.goldrushcomputing.actions.Move", | |
"availability": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Battery Consumption */ | |
private BroadcastReceiver batteryInfoReceiver = new BroadcastReceiver(){ | |
@Override | |
public void onReceive(Context ctxt, Intent intent) { | |
int batteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); | |
int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1); | |
float batteryLevelScaled = batteryLevel / (float)scale; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Kalman Filter */ | |
float Qvalue; | |
long locationTimeInMillis = (long)(location.getElapsedRealtimeNanos() / 1000000); | |
long elapsedTimeInMillis = locationTimeInMillis - runStartTimeInMillis; | |
if(currentSpeed == 0.0f){ | |
Qvalue = 3.0f; //3 meters per second | |
}else{ | |
Qvalue = currentSpeed; // meters per second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private long getLocationAge(Location newLocation){ | |
long locationAge; | |
if(android.os.Build.VERSION.SDK_INT >= 17) { | |
long currentTimeInMilli = (long)(SystemClock.elapsedRealtimeNanos() / 1000000); | |
long locationTimeInMilli = (long)(newLocation.getElapsedRealtimeNanos() / 1000000); | |
locationAge = currentTimeInMilli - locationTimeInMilli; | |
}else{ | |
locationAge = System.currentTimeMillis() - newLocation.getTime(); | |
} | |
return locationAge; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean filterAndAddLocation(Location location){ | |
long age = getLocationAge(location); | |
if(age > 10 * 1000){ //more than 10 seconds | |
Log.d(TAG, "Location is old"); | |
oldLocationList.add(location); | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onLocationChanged(final Location newLocation) { | |
Log.d(TAG, "(" + newLocation.getLatitude() + "," + newLocation.getLongitude() + ")"); | |
gpsCount++; | |
if(isLogging){ | |
//locationList.add(newLocation); | |
filterAndAddLocation(newLocation); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void zoomMapTo(Location location) { | |
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); | |
try { | |
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 17.5f)); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addPolyline() { | |
ArrayList<Location> locationList = locationService.locationList; | |
if (locationList.size() == 2) { | |
Location fromLocation = locationList.get(0); | |
Location toLocation = locationList.get(1); | |
LatLng from = new LatLng(((fromLocation.getLatitude())), | |
((fromLocation.getLongitude()))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onLocationChanged(final Location newLocation) { | |
Log.d(TAG, "(" + newLocation.getLatitude() + "," + newLocation.getLongitude() + ")"); | |
if(isLogging){ | |
locationList.add(newLocation); | |
} | |
Intent intent = new Intent("LocationUpdated"); | |
intent.putExtra("location", newLocation); |