I am writing a navigation app and I require rotation of the camera around the user (So rather than just rotating the user icon with the compass the camera rotates around the user giving the impression that the map is rotating in accordance to real life.)
I couldn't seem to find a default mode to do this I have tried the bearing tracking modes (GPS and Compass) as well as the location tracking modes:
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
As I was unable to get it working I implemented a custom compass with a basic low pass filter in order to rotate the camera around the user. However as of upgrading from Mapbox 4.1.1 to 4.2.1 my custom implementation has broken (Rotation has become very laggy and very jagged).
I am sure there is a much easier way to do this but I am having a bit of trouble figuring it out. Could someone please advise me as to whether I was going about it the correct way or if there is a much easier solution that I am looking over?
Thank you in advanced!
To track the user location and rotate the map to the orientation is always pointing in the same direction as the user, use these lines combined:
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
mapboxMap.getTrackingSettings().setMyBearingTrackingMode(MyBearingTracking.COMPASS);
Note for the full code, i'd recommend checking out this example.
Yes as #SCTaylor says, you absolutely need .setDismissAllTrackingOnGesture(false) to make this work
Related
I tried to achieve using google's cloud Anchors, but it has a limitation of 24hrs (after that the cloud anchors become invalid).
And another way is creating the replica of Unity, but that would be too lengthy process.
Any other ways please suggest me or any idea: https://www.insidernavigation.com/#solution - how they achieved it?
And how to save the common coordinate system in cloud or locally?
Current versions of ARCore and ARKit have limited persistence capabilities. So a workaround - which I think is what they use in that site you linked, is to use images/QR codes which they use to localise the device with a real world position and then use the device's SLAM capabilities to determine the device's movement and pose.
So for example, you can have a QR code or image that represents position 1,1 facing north in the real world. Conveniently, you can use ARCore/ARKit's to detect that image. When that specific image is tracked by the device, you can then confidently determine that the device is position 1, 1 (or close to it). You then use that information to plot a dot on a map at 1,1.
As you move, you can track the deltas in the AR camera's pose (position and rotation) to determine if you moved forward, turned etc. You can then use these deltas to update the position of that dot on your map.
There is intrinsic drift in this, as SLAM isn't perfect. But the AR frameworks should have some way to compensate against this using feature detection, or the user can re-localize by looking for another QR/image target.
As far as my knowledge is concern, This Virtual Positioning system has not been introduced yet in Google arcore. The link you provided, these guys are using iBeacon for positioning.
yup I believe it could be possible. Currently most developed ways have its limitation .I am working on to find another way with the fusion of Cloud Anchors with IBeacon.
I was wondering how the Yelp monocle works. It a cool feature , especially in terms of augmented reality. So I know they access GPS and compass data. And they have data about places nearby like hotels and bars etc. But how do they calculate the orientation w.r.t each other in real time, as I rotate my device. So if my device is pointing east and theres a pizza place to the north. I rotate my device to north. Now how does it know that I'm facing a pizza place here. What is the crucial bit of information being used to calculate this ?
I am thinking of developing similar kind of app for android. Please let me know how I can approach this ..
Well, when you know where you are, you know where you are facing and where your target is, you can calculate the rest. It's basic trigonometry.
Can anyone help me with sample code for a compass needle that points in the direction where the phone is tilted?
I am trying to develop an application to rotate a bitmap in OpenGL from accelerometer values.
Ok so thanks to the comments above we do not have to use OpenGL, and while you could, I personally believe you can make life simpler by using a custom View.
Now in traditional standard StackOverFlow past time I am not going to give you code for this but extrmely large leg up. There is a thermometer example available here http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/.
Why have I sent you here?
It contains an example that renders a dial exceedingly close to a compass, with a few minor tweeks it could easily become a compass in terms of design. you will just need to remove the temperature related code and use the accelerometers instead.
It is a good intro to custom views and will show you how to get started.
I made a clock after following the tutorial just as another possibility to inspire you.
I developed a camera application that takes a picture, stores it to cache, then loads it
to a server. Everything works perfect. However, when I went to test it on a real phone, I noticed that zooming the camera crashing the app. I have spent 2 weeks trying to get the zoom to work and researching it. I have tried setOnZoomListener, isSmoothZoomSupported etc.
however, no matter what I do, I can't find a way to implement the zoom feature in the app without it crashing. Any point in the right direction to put this together would save my sanity!! Thank you so much in advance!!!!!
The zoom feature of mobile camera is digital zoom not the optical zooming.
So, the zooming is dependent on the camera hardware.
try to get the max zoom value of the camera by using Camera.Parameters.getMaxZoom()
if this method returns zoom value>1 then you are able to zoom the picture preview.
And this is hardware dependent. So, some devices may support some may not.
thanks
Vikash
I want to create some sort of graphical arrow, or possibly draw an arrow over a compass to show the user what direction the wind is coming from. This would obviously change, given the orientation of the persons handset.
My application can tell me what direction (in degrees) the wind direction is coming from.
My question is, what is the best way to implement something like this?
Thanks
In your Exclipse create a new Android project and select "Create project from existing sample". Choose target android version and then ApiDemos. There you will find a Compass application and many other examples which can help you draw your screen.
I guess the best would be if your wind arrow would be in 3D or simulated 3D, so that it does not matter how the user is holding his device, for he would always look at the wind arrow from an elevated virtual vintage point.
In the same ApiDemos there is also "Sensors" demo which draws the physical orientation of the device.
Draw a compass, draw the wind arrow accordingly.
If the device knows its orientation, rotate the whole thing so that N on the compass points to actual North.
Then ask users whether they are happy with this setup, if not, why, improve, etc. But start with something dead simple, like the above.