Geolocator and accuracy in Windows Phone 8 - windows-phone-7

I have a few questions about Geolocator and property DesiredAccuracy.
I have the method GetMyPosition:
public async Task<Geoposition> GetMyPosition()
{
Geoposition myGeoposition = null;
Geolocator myGeolocator = new Geolocator();
myGeolocator.DesiredAccuracy = PositionAccuracy.High;
try
{
myGeoposition = await myGeolocator.GetGeopositionAsync();
return myGeoposition;
}
catch (Exception ex)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Can't get the position");
});
return null;
}
}
1) Why
Geolocator.DesiredAccuracy = PositionAccuracy.High;
Geolocator.GetGeopositionAsync();
always return Geoposition.Coordinate.PositionSource = Cellular with accuracy 400 - 1600 m (on device Nokia Lumia 520)?
2) Under what settings I can get a high accuracy (50 - 100 m) and PositionSource = Satellite?
3) If I have the loaded maps on my device and I activated the airplane mode on the device, then code
Geolocator myGeolocator = new Geolocator();
myGeolocator.DesiredAccuracy = PositionAccuracy.High;
try
{
myGeoposition = await myGeolocator.GetGeopositionAsync();
return myGeoposition;
}
will work? Without a celluar, only a satellite?
4) How strong is the precision of coordinates depends on the device?
Thanks in advance!

Taken from MSDN
Although the Location Service uses multiple sources of location information, and any of the sources may not be available at any given time (for example, no GPS satellites or cell phone towers may be accessible), the native code layer handles the work of evaluating the available data and choosing the best set of sources. All your application needs to do is to choose between high accuracy or the default, power-optimized setting. You can set this value when you initialize the main Location Service class, GeoCoordinateWatcher.
C#
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
So it seems like you can't control which source is used but rather the available source will be used based on the specified position accuracy on GeoCoordinateWatcher. Try initializing a GeoCoordinateWatcher with high accuracy and see what happens
var geoWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);

You can use
Geolocator myGeolocator = new Geolocator();
myGeolocator.DesiredAccuracyInMeters = 20;
...
to explicitly state how accurate you want the location to be which would allow the device to manage its power a little better but whether you get close to that accuracy with your result depends on the quality of the location the device can get. If you're inside a building for example you're not going to get something that accurate without connecting to WIFI

Related

OnboardSDK: mission management and HomePoint initialization

I am having Matrice 210 and use OSDK for uploading mission. But the OSDK will not allow uploading if the HomePoint of the aircraft was not initialized.
I got error "WAYPOINT_MISSION_POINTS_TOO_FAR" if turning on the drone only, and I have to turn on RC and connect DJI GO application for the HomePoint being created.
If I understand correctly, the mission manager only accept mission when the drone has strong GPS signal, but the document do not say anything about the HomePoint initializing.
I try to find in the SDK a function to tell the drone get it current GPS as HomePoint, but there is no such thing available in the code. Do I miss something?
Update:
Here is how I setup the mission manager:
void setWaypointInitDefaults(WayPointInitSettings* fdata)
{
fdata->maxVelocity = 10;
fdata->idleVelocity = 5;
fdata->finishAction = 0;
fdata->executiveTimes = 1;
fdata->yawMode = 0;
fdata->traceMode = 0;
fdata->RCLostAction = 1;
fdata->gimbalPitch = 0;
fdata->latitude = 0;
fdata->longitude = 0;
fdata->altitude = 0;
}
...
bool InitWaypointMission(Vehicle* vehicle, int numberWaypoints, double maxSpeed, double turnSpeed, bool usePointsHeading)
{
WayPointInitSettings fdata;
setWaypointInitDefaults(&fdata);
fdata.indexNumber = numberWaypoints;
fdata.maxVelocity = maxSpeed;
fdata.idleVelocity = turnSpeed;
if ( usePointsHeading )
fdata.yawMode = 3;
ACK::ErrorCode initAck = vehicle->missionManager->init(DJI_MISSION_TYPE::WAYPOINT, responseTimeout, &fdata);
if (ACK::getError(initAck))
{
ACK::getErrorCodeMessage(initAck, __func__);
return false;
}
vehicle->missionManager->printInfo();
return true;
}
On DJI drones, the Homepoint is automatically acquired when the drone has visibility of enough GPS satellites. A method that can tell the drone to get its' current position as homepoint will not be useful - if the drone can indeed get a good fix on its' current location in GPS co-ordinates, it has already set it as a homepoint, or will do so in the next few seconds.
There may be many reasons why you are getting the WAYPOINT_MISSION_POINTS_TOO_FAR error, but you will need to provide more context to help us narrow it down. Some things that are useful to report:
After powering on the drone, how long are you letting it sit in clear
skies before trying to upload the mission?
When you initialize your waypoint mission through the MissionManager, have you made sure to set the RCLostAction to Keep Going?
Is the behavior reproducible in simulation?

Bad relocalization after motion tracking loss

With my team we want to implement area learning for relocalization purposes in our projects.
I added this functionnality and it seems to work well. But when a drift disaster happens (motion tracking lost) and that the main camera is instantaneously projected in "the other side of the universe" the program doesn't succeed in relocalizing it : the camera is 2 meters below, or 3 meters beside than where it should be.
Is it an area description error (because it has got not enough point of interests) ?
Or I still have not understood how to use area learning ?
Thanks a lot.
P.S.:
I use the Unity SDK.
public void Update()
{
TangoPoseData pose = new TangoPoseData ();
TangoCoordinateFramePair pair;
if(poseLocalized)
{
pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION;
pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE;
}
else
{
pair.baseFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE;
pair.targetFrame = TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE;
}
double timestamp = VideoOverlayProvider.RenderLatestFrame(TangoEnums.TangoCameraId.TANGO_CAMERA_COLOR);
PoseProvider.GetPoseAtTime (pose, timestamp, pair);
m_status = pose.status_code;
if (pose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID)
{
// it does not differ with the pair base frame
Matrix4x4 ssTd = UpdateTransform(pose);
m_uwTuc = m_uwTss * ssTd * m_dTuc;
}
}
public void OnTangoPoseAvailable(TangoPoseData pose)
{
if (pose == null)
{
return;
}
// Relocalization signal
if (pose.framePair.baseFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_AREA_DESCRIPTION &&
pose.framePair.targetFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE)
{
poseLocalized = true;
}
// If pose status is not valid, nothing is valid
if (!(pose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID))
{
poseLocalized = false;
// Do I forget something here ?
}
}
I've regularly observed that the localization and re-localization of the Area Learning can produce x,y Pose coordinates off by a few meters.
Coordinates can be more accurate if I take more care in recording an area well before moving to a new area.
Upon re-localization the coordinate accuracy is improved if the tablet is able to observe the area using slow, consistent movements before traveling to a new area.
If I learn a new area I always return to a well known area for better accuracy as described by drift correction:
I have two Tango tablets using a Java app that is autonomously navigating an iRobot in my home. I've setup a grid test site using 1 meter tape marks to make the observations.

Application crashes when asking for a frame that involves COORDINATE_FRAME_CAMERA_DEPTH

I'm using the JPointCloud sample app, and modifying it a little bit:
In JPointCloud.java : SetUpExtrinsics(), I added:
TangoPoseData depth2devicePose = new TangoPoseData();
framePair.baseFrame = TangoPoseData.COORDINATE_FRAME_DEVICE;
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH;
try {
depth2devicePose = mTango.getPoseAtTime(0.0, framePair);
} catch (TangoErrorException e) {
Toast.makeText(getApplicationContext(), R.string.TangoError,
Toast.LENGTH_SHORT).show();
The application crashes when reaching the line:
depth2devicePose = mTango.getPoseAtTime(0.0, framePair);
I tried with other combinations of frame, but each time COORDINATE_FRAME_CAMERA_DEPTH is included, the app crashes.
Did I forget something ? Maybe to ask some kind of special permission for the depth camera ?
It indeed crashes on me as well.
However, according to the Java pointcloud example code (extrinsic query part), the correct way of querying the DEPTH_CAMERA w.r.t(with respect to) DEVICE transformation is using 'the inverse of DEVICE w.r.t IMU' multiply 'CAMAER w.r.t IMU', which is:
deive_T_camera = inverse(imu_T_device) * imu_T_camera
Also, note that the color camera, depth camera and camera are the same camera on the hardware level, so they actually share the same extrinsic.
Hope this helps.
Edit: the crashes actually throw an com.google.atap.tangoservice.TangoInvalidException. This might just be a frame pair not supported from API level, as mentioned before, the suggested way would be using other two matrices to compose the desired matrix in this case..

GPS accuracy Issues

I am developing a windows phone sports tracker app, that uses gps sensors to calculate the distance travelled by the runner, I am using geocoordinatewatcher class for the same, setting the movement threshold to 100. But, I find my app giving distance values even when the device is kept stationary. My app should give distance only when the device changes its position. I found the same bug in othere apps that are on the marketplace, please tell me where am I doing wrong?
My Code.
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
watcher.MovementThreshold = 150;
watcher.PositionChanged += watcher_PositionChanged;
watcher.Start();
{
latitudeCurrent = e.Position.Location.Latitude;
longitudeCurrent = e.Position.Location.Longitude;
if (stepCounter == 0)
{
latitudePrevious = latitudeCurrent;
longitudePrevious = longitudeCurrent;
distanceTravelled += Math.Round(Calculate(latitudePrevious,longitudePrevious,latitudeCurrent,longitudeCurrent),2);
txbDistanceTravelled.Text = distanceTravelled.ToString();
txbCalories.Text=string.Format("{0:f0}", distanceTravelled * 65);
stepCounter++;
var millisPerKilometer = (distanceTravelled) * (System.Environment.TickCount - _previousPositionChangeTick);
txbPace.Text = TimeSpan.FromMilliseconds(millisPerKilometer).ToString(#"mm\:ss");
double hrs = counterTick / 3600;
if (!double.IsNaN((distanceTravelled / hrs)))
{
txbSpeed.Text = (distanceTravelled / hrs).ToString();
}
else
{
txbSpeed.Text = "0";
}
}
}
You are developing your app for Windows Phone 7 or Windows Phone 8? IF you are developing for the later, you need to use the new Geolocator class and not GeoCoordinateWatcher.
Also, as LewisBenge said, if you are testing This indoor you can get WiFi positions or even cellular data. It could be better to test outdoor.
Your GPS signal might be weak in the place where you are testing. Try it in the outdoor location.

Speed not updating when using GeoCoordinateWatcher

When using the GeoCoordinateWatcher class to get updated GPS position and speed inside my Windows Phone application, the latitude and longitude updates, but the speed remains at a constant value: 5.95 (as well as the course).
I initialize the Geo Watcher with the following code:
GeoCoordinateWatcher GeoWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
And start the listening process using the snipped:
GeoWatcher.StatusChanged += GeoWatcherStatusChanged;
GeoWatcher.PositionChanged += OnGeoWatcherPositionChanged;
GeoWatcher.MovementThreshold = 0.5;
GeoWatcher.Start();
And finally, the method OnGeoWatcherPositionChanged contains the following code:
textSpeed.Text = args.Position.Location.Speed.ToString();
Where textSpeed is a simple TextBox.
Does anyone know why Speed remains at a constant value? Thanks in advance.

Resources