Comments (16)
Sorry you ran into this!
Yes, you do need a Real Time Database Configured in order to use the sample. We have added instructions on how to do that to this quickstart guide: https://developers.google.com/ar/develop/ios/cloud-anchors-quickstart-ios
from arcore-ios-sdk.
Ok. I am unable to understand what exactly are you storing in the Real Time Database. The sample code is written by an intern. There is one file in Objective-C which contains hundreds of line of code. In the docs you mentioned there is no mention of how and where the Real Time Database is being used. Is there another sample that actually works?
from arcore-ios-sdk.
The quickstart docs are suggesting run the app! The app does not run at all.
from arcore-ios-sdk.
Can I get some support on this? What happens when I host an anchor? How does it know where to store the anchors? If it already knows where to store the anchors then why should I use Real Time Database.
from arcore-ios-sdk.
I apologize, when you asked about Firebase I assumed that you were running the sample app. Firebase is not required at all to use our Cloud Anchors API it is just used by the sample to share anchor IDs.
Since you are jumping in and writing an app this guide might be more helpful: https://developers.google.com/ar/develop/ios/cloud-anchors-developer-guide-ios
Your error message seems to be: GARSessionErrorCodeNotTracking
This means that the ARSession is not tracking properly. Looking at your sample code there are two things I think you need to do:
-
Listen to the session delegate and forward frames to the google session. There is an example of this in the guide I just linked.
-
You will need to wait some time before calling host because the ARKit session will need to start tracking the scene before you can host an anchor. The best practices section of that guide might also provide some tips to help you successfully host an anchor.
from arcore-ios-sdk.
Is there anyway to log to Google Console and delete the cloud identifier? Can I see what kind of information is being collected when hosting Cloud Anchors? What happens if I add the cloud anchors to a place where the cloud anchors have already been added.
from arcore-ios-sdk.
We don't have a way to delete an identifier. They have a lifetime of 24 hours.
We have a lot more information on the data collected in the "Data storage and access limitations" section of this guide: https://developers.google.com/ar/develop/ios/overview.
Cloud anchors have no knowledge of each other, so if you add a new cloud anchor at the same place, you will simply host a new cloud anchor with a new ID.
from arcore-ios-sdk.
Thanks! I am still confused about the workings on Cloud Anchor. Here is what I understand.
Person A maps a room using their phone and then hosts an anchor. The visual features of the room gets uploaded to Google cloud. Person B goes to the same room and resolve the anchor. Now, they are sharing the same anchor.
Does that mean that if Person A attaches anything to anchor A it will be automatically visible to Person B?
What if there is only Person A? If I attach a chair to a cloud anchor then if I resolve an anchor will I also get the chair back or cloud anchors are more about getting the anchors and then I will have to write code to add the chair myself?
from arcore-ios-sdk.
Hosting an anchor takes a very very very long time (10-15) seconds. Resolving an anchor almost fails since cloud anchors is not able to find out if the raw points belongs to any anchor or not.
from arcore-ios-sdk.
I am trying to resolve a cloudIdentifier by putting the identifier as a hardcoded value. This cloud anchor is placed right in front of me. But when I move away or look up or down and try to resolve the identifier then it puts the anchor at the wrong position.
Why does it matter that the person should be looking at the same surface/place in order to correctly resolve the cloud anchors?
from arcore-ios-sdk.
Without seeing your code I'm not completely sure what is happening, but I do have a guess.
If I had to guess you are probably programmatically resolving the anchor very quickly after an the ARSession has started. This would mean that ARKit hasn't had time to build up a model of the space around you, so the localized anchor moves around quickly.
You will notice that many AR apps you download, when the session first starts they have some UI asking you to move your phone around for a bit before they allow you to place anything in the world. The ARKit docs mention this in this document: https://developer.apple.com/documentation/arkit/about_augmented_reality_and_arkit
I would suggest spending a little more time allowing the ARKit to understand the world around you, and then trying to resolve to see if that helps.
Also that is mostly a guess, so feel free to post some code in a followup if you have a different issue.
To answer a few other questions:
- Yes hosting an anchor does take some time we are looking into reducing that.
- When it comes to placing objects relative to cloud anchors, this is something that our API does not currently handle and it would be the developers job to keep track of those transforms.
from arcore-ios-sdk.
Couple of different problems:
- When resolving cloud anchors, they appear to be different then the ones which got hosted. This is resulting in placing the objects to those anchors to be positioned incorrectly. Here is an example.
// Finding the position on the plane
` @objc func tapped(recognizer :UITapGestureRecognizer) {
let sceneView = recognizer.view as! ARSCNView
let touch = recognizer.location(in: sceneView)
let hitTestResults = sceneView.hitTest(touch, types: .existingPlane)
if !hitTestResults.isEmpty {
if let hitTestResult = hitTestResults.first {
print("plane hit test")
print(hitTestResult.worldTransform)
addAnchorWithTransform(transform: hitTestResult.worldTransform)
}
}
}`
// hosting the anchor
` private func addAnchorWithTransform(transform :matrix_float4x4) {
self.arAnchor = ARAnchor(transform: transform)
self.sceneView.session.add(anchor: self.arAnchor)
do {
try
self.garAnchor = self.gSession.hostCloudAnchor(self.arAnchor)
} catch {
print(error.localizedDescription)
}
}`
// adding a block/virtual object to the anchor position
` @objc func addBlock() {
let grAnchor = try? self.gSession.resolveCloudAnchor(withIdentifier: self.cloudIdentifier)
print("addBlock")
print(grAnchor?.transform)
if let cloudAnchor = grAnchor {
let box = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)
let material = SCNMaterial()
material.diffuse.contents = UIColor.red
box.materials = [material]
let node = SCNNode(geometry: box)
node.position = SCNVector3(cloudAnchor.transform.columns.3.x, cloudAnchor.transform.columns.3.y, cloudAnchor.transform.columns.3.z)
self.sceneView.scene.rootNode.addChildNode(node)
}
}`
// closing the app and then resolving the anchor using the anchor id which is saved on the clipboard.
` @objc func resolveAnchor() {
// even by giving the hard-coded value the anchor is resolved at an incorrect position.
// I get the cloud identifier once, I have hosted the anchor.
let grAnchor = try? self.gSession.resolveCloudAnchor(withIdentifier: "ua-3a4376036801c8411de0f9bc375a2b3d")
if let cloudAnchor = grAnchor {
let box = SCNBox(width: 0.3, height: 0.3, length: 0.3, chamferRadius: 0)
let material = SCNMaterial()
material.diffuse.contents = UIColor.red
box.materials = [material]
let node = SCNNode(geometry: box)
node.position = SCNVector3(cloudAnchor.transform.columns.3.x, cloudAnchor.transform.columns.3.y, cloudAnchor.transform.columns.3.z)
self.sceneView.scene.rootNode.addChildNode(node)
}
}`
The anchor comes back but at a wrong location even though I provided the correct cloud identifier. The box appears at a wrong position.
from arcore-ios-sdk.
By wrong location are we talking a few inches off? Or very far away?
When exactly are you resolving the anchor? I don't see the call to resolveAnchor() in your sample. As you are calling this after ARKit has some amount of time to learn about its environment, your code looks reasonable.
from arcore-ios-sdk.
The resolveAnchor code is above in function called resolveAnchor. I start the app map the area, perform plane detection and then I put a cube on the plane. I get the cloudIdentifier which I copy it in clipboard. I kill the app and update the cloudIdentifier with the one I recieved.
The cube is resolving few feet away.
from arcore-ios-sdk.
Sorry I wasn't more specific. Of the two resolveAnchor() calls, I meant to ask about the one you wrote.
In the code snippet you added I am unable to see where you call your resolveAnchor() function, if this is being called immediately after the ARKit session starts, it is possible that ARKit itself doesn't yet have a good understanding of its surroundings. So when you add the box it quickly moves around because ARKit does not have enough information about your surroundings.
A few feet away is far outside of what we would expect. Would you mind trying to call resolve later? Or sharing some more info on when you call your resolveAnchor() method?
from arcore-ios-sdk.
Closing this ticket for now due to inactivity.
Feel free to reach out if you have any more questions!
from arcore-ios-sdk.
Related Issues (20)
- Error when resolving anchors. No callback received. HOT 5
- ArcoreS
- Wrong transforms returned from GARFrame.anchors HOT 11
- ARCore/AugmentedFaces causes SwiftUI previews to crash
- Question about successful VPS tracking in indoor environments
- Unknown type name 'GARSession'; did you mean 'ARSession'? HOT 3
- Localization not possible HOT 2
- Unable to free resolved cloud anchors HOT 5
- Streetscape geometry rendered way above the altitude HOT 3
- Add action on Tapping particular Anchor and detect Vertical Plane like Big Building while standing form street .
- Thread 1: "+[GARDeviceProfile profileForIdentifier:osVersion:configurationManager:]: unrecognized selector sent to class 0x1052a7610" HOT 3
- VisionOS support HOT 1
- Is it allowed to save anchors on StreetscapeGeometry between sessions?
- Can't add ARCore as a pod dependency HOT 1
- Rooftop Anchors seem to failing HOT 1
- Arcore depends on Firebase, then duplicate symbols in iOS app that use Firebase too HOT 7
- The mask is unstable when using the rear camera HOT 3
- Update nanopb dependency version for PrivacyManifest support HOT 2
- App using arcore-ios-sdk fails to deploy with xcode 15.3 HOT 13
- Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arcore-ios-sdk.