ARKit3 - Official Apple example won't compile, has flawed USDZ 3D mesh/skeleten model - arkit

I am investigating new ARKit3 features, in particular motion capture. I have an iPhone with A12 chip (so all new features should work), and iPhone is loaded with iOS 13 (beta). I also installed the Xcode 11 beta on my development laptop as recommended.
When I download the tutorial / sample Xcode project here I find that I have errors on compile. I was able to get rid of those by commenting out the references to the AnyCancellable instance, and the program compiles.
When I run it on on my device, I get error messages about the 3D mesh (in USDZ format) saying it is missing certain joint information.
I've tried substituting the USDZ model included with the sample project for other USDZ models provided on the apple site here, to no avail.
The expected behaviour is that the sample app should open in a camera view, track a person that appears in front of the camera and render a skeleton with 3D mesh model overtop, which mimics the person's actions.
I am getting the error in the Xcode console:
2019-07-18 16:21:13.645289-0400 BodyDetection[11503:176170] [API] Created entity character does not contain supplied joint name: right_shoulder_2_joint.
2019-07-18 16:21:13.645348-0400 BodyDetection[11503:176170] [API] Cannot get joint count for non-character entity.
Error: Unable to load model: The operation couldn’t be completed. (RealityKit.Entity.LoadError error 4.)
It seems it cannot load the mesh / skeleton. The app runs and I can see the camera view, but no 3D character/mesh is ever rendered.
Can anyone give me a hint as to where to find a 3D model that will work with the ARKit3 framework? Has anyone seen anything like this error before?

Can you confirm that your device definitely has an A12 chip (meaning it's an iPhone XR, XS, XS Max, iPad Mini (2019), iPad Air (2019), or iPad Pro (2018))? Additionally, ensure your Xcode is running the latest Beta 4 release (build 11M374r, as of the time of this writing) and your iOS device is running the iOS 13 beta.
These may seem rudimentary, but I cannot replicate the issues you indicate when downloading the sample project on my end. I can launch the project, set my signing team, load on my iPhone XS Max, and the project functions as it should; when a body is detected in the frame, the 3D "skeleton" appears alongside and motion follows.
It may be worth mentioning that the 3D body tracking technology appears to require a USDZ model that has existing joints already configured. The USDZ models on Apple's site mostly do not (the robot, for example, lacks any such joints that could be tracked). See this screenshot for an example of what the structure of Apple's "skeleton" looks like.
The error messages you provided from Xcode make it seem like the model you are trying to load lacks the skeletal structure to conform to this technology. Could you try re-downloading the sample project and confirm you get the same error?

Related

Hololens 2 Multi-User Capabilities error DllNotFoundException: AzureSpatialAnchors

I've been following this tutorial https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/tutorials/mr-learning-sharing-02 to make a Hololens 2 app that can be used by 2 or more users, however, I haven't been able to make it work, because after finishing the tutorial and trying to run the app, I get this build error message:
DllNotFoundException: AzureSpatialAnchors
I'm not sure what i'm doing wrong, I tried googling this problem but I seem to get nowhere. pls keep in mind that i'm a new developer unu
I included an image to give a better idea of the problem, it seems to be the only error message D:
(I tought the problem may have been something to do with my spatial anchor resource on azure, but even after creating a new resource and pasting the new ids, it seems to still have the problem unu. also, i do have a hololens 2 visor, so i'm sure the problem doesn't have to do with the emulator while pressing play.)
i hope the image helps
Azure Spatial Anchors are not supported in Unity Player (per your image, you are running it in Player) nor Hololens Emulator. You need to build & deploy the app to a Hololens in order to test ASA.

Kinect not being detected on other computers after deployment of UWP

I recently finished to develop a UWP based on the SDK example CameraFrames. On the second screen of this example (and also on my app) you can choose to preview the frames taken by the Kinect v2.0 as shown below.
On the top of the image on the right of "Grupo de fontes" (Source group) I am able to choose between the different cameras that are connected to my PC. The problem comes when I deploy my app to another PC, I am unable to see "Kinect V2 Video Sensor". Thus rendering my app obsolete as it needs to be portable between PCs. I have checked that inside "Package.appxmanifest->Capabilities->Web Cam" checkbox is ticked.
I am out of ideas as I don't have a clue why my app works flawlesly on my computer but not on the rest. If you need any extra info to help me with my problem please let me know.
It is worth noting that on the other PCs that I've tried my app can read frames via Kinect Studio or MatLab.
Inside "Camera privacy settings" my app has privileges to use the camera.
Thank you in advance.
Update due to Nico Zhu's comment
My OS is Windows 10 and my target version is "10.0.16299.0". I have downloading and deploying CameraFrames on the second computer that I'm working with but it doesn't recognize the Kinect as in input source. Even though CameraFrames doesn't work doesn't read anything, I can properly make use of the kinect using Kinect Studio.
It seems that my problem is focused on my second computer not being able to make use of the Kinect on any deployed UWPs. What should I installed in order to make sure that I have all that's needed to properly read from the Kinect?
At the end of a lot of headaches I just needed to upgrade my drivers.

ARKit with multiple users

What is the best way, if any, to use Apple's new ARKit with multiple users/devices?
It seems that each devices gets its own scene understanding individually. My best guess so far is to use raw features points positions and try to match them across devices to glue together the different points of views since ARKit doesn't offer any absolute referential reference.
===Edit1, Things I've tried===
1) Feature points
I've played around and with the exposed raw features points and I'm now convinced that in their current state they are a dead end:
they are not raw feature points, they only expose positions but none of the attributes typically found in tracked feature points
their instantiation doesn't carry over from frame to frame, nor are the positions exactly the same
it often happens that reported feature points change by a lot when the camera input is almost not changing, with either a lot appearing or disappearing.
So overall I think it's unreasonable to try to use them in some meaningful way, not being able to make any kind of good point matching within one device, let alone several.
Alternative would to implement my own feature point detection and matching, but that'd be more replacing ARKit than leveraging it.
2) QR code
As #Rickster suggested, I've also tried identifying an easily identifiable object like a QR code and getting the relative referential change from that fixed point (see this question) It's a bit difficult and implied me using some openCV to estimate camera pose. But more importantly very limiting
As some newer answers have added, multiuser AR is a headline feature of ARKit 2 (aka ARKit on iOS 12). The WWDC18 talk on ARKit 2 has a nice overview, and Apple has two developer sample code projects to help you get started: a basic example that just gets 2+ devices into a shared experience, and SwiftShot, a real multiplayer game built for AR.
The major points:
ARWorldMap wraps up everything ARKit knows about the local environment into a serializable object, so you can save it for later or send it to another device. In the latter case, "relocalizing" to a world map saved by another device in the same local environment gives both devices the same frame of reference (world coordinate system).
Use the networking technology of your choice to send the ARWorldMap between devices: AirDrop, cloud shares, carrier pigeon, etc all work, but Apple's Multipeer Connectivity framework is one good, easy, and secure option, so it's what Apple uses in their example projects.
All of this gives you only the basis for creating a shared experience — multiple copies on your app on multiple devices all using a world coordinate system that lines up with the same real-world environment. That's all you need to get multiple users experiencing the same static AR content, but if you want them to interact in AR, you'll need to use your favorite networking technology some more.
Apple's basic multiuser AR demo shows encoding an ARAnchor
and sending it to peers, so that one user can tap to place a 3D
model in the world and all others can see it. The SwiftShot game example builds a whole networking protocol so that all users get the same gameplay actions (like firing slingshots at each other) and synchronized physics results (like blocks falling down after being struck). Both use Multipeer Connectivity.
(BTW, the second and third points above are where you get the "2 to 6" figure from #andy's answer — there's no limit on the ARKit side, because ARKit has no idea how many people may have received the world map you saved. However, Multipeer Connectivity has an 8 peer limit. And whatever game / app / experience you build on top of this may have latency / performance scaling issues as you add more peers, but that depends on your technology and design.)
Original answer below for historical interest...
This seems to be an area of active research in the iOS developer community — I met several teams trying to figure it out at WWDC last week, and nobody had even begun to crack it yet. So I'm not sure there's a "best way" yet, if even a feasible way at all.
Feature points are positioned relative to the session, and aren't individually identified, so I'd imagine correlating them between multiple users would be tricky.
The session alignment mode gravityAndHeading might prove helpful: that fixes all the directions to a (presumed/estimated to be) absolute reference frame, but positions are still relative to where the device was when the session started. If you could find a way to relate that position to something absolute — a lat/long, or an iBeacon maybe — and do so reliably, with enough precision... Well, then you'd not only have a reference frame that could be shared by multiple users, you'd also have the main ingredients for location based AR. (You know, like a floating virtual arrow that says turn right there to get to Gate A113 at the airport, or whatever.)
Another avenue I've heard discussed is image analysis. If you could place some real markers — easily machine recognizable things like QR codes — in view of multiple users, you could maybe use some form of object recognition or tracking (a ML model, perhaps?) to precisely identify the markers' positions and orientations relative to each user, and work back from there to calculate a shared frame of reference. Dunno how feasible that might be. (But if you go that route, or similar, note that ARKit exposes a pixel buffer for each captured camera frame.)
Good luck!
Now, after releasing ARKit 2.0 at WWDC 2018, it's possible to make games for 2....6 users.
For this, you need to use ARWorldMap class. By saving world maps and using them to start new sessions, your iOS application can now add new Augmented Reality capabilities: multiuser and persistent AR experiences.
AR Multiuser experiences. Now you may create a shared frame of a reference by sending archived ARWorldMap objects to a nearby iPhone or iPad. With several devices simultaneously tracking the same world map, you may build an experience where all users (up to 6) can share and see the same virtual 3D content (use Pixar's USDZ file format for 3D in Xcode 10+ and iOS 12+).
session.getCurrentWorldMap { worldMap, error in
guard let worldMap = worldMap else {
showAlert(error)
return
}
}
let configuration = ARWorldTrackingConfiguration()
configuration.initialWorldMap = worldMap
session.run(configuration)
AR Persistent experiences. If you save a world map and then your iOS application becomes inactive, you can easily restore it in the next launch of app and in the same physical environment. You can use ARAnchors from the resumed world map to place the same virtual 3D content (in USDZ or DAE format) at the same positions from the previous saved session.
Not bulletproof answers more like workarounds but maybe you'll find these helpful.
All assume the players are in the same place.
DIY ARKit sets up it's world coordinate system quickly after the AR session has been started. So if you can have all players, one after another, put and align their devices to the same physical location and let them start the session there, there you go. Imagine the inside edges of an L square ruler fixed to whatever available. Or any flat surface with a hole: hold phone agains surface looking through the hole with camera, (re)init session.
Medium Save the player aligning phone manually, instead detect a real world marker with image analysis just like #Rickster described.
Involved Train an Core ML model to recognize iPhones and iPads and their camera location. Like it's done with human face and eyes. Aggregate data on a server, then turn off ML to save power. Note: make sure your model is cover-proof. :)
I'm in the process of updating my game controller framework (https://github.com/robreuss/VirtualGameController) to support a shared controller capability, so all devices would receive input from the control elements on the screens of all devices. The purpose of this enhancement is to support ARKit-based multiplayer functionality. I'm assuming developers will use the first approach mentioned by diviaki, where the general positioning of the virtual space is defined by starting the session on each device from a common point in physical space, a shared reference, and specifically I have in mind being on opposite sides of a table. All the devices would launch the game at the same time and utilize a common coordinate space relative to physical size, and using the inputs from all the controllers, the game would remain theoretically in sync on all devices. Still testing. The obvious potential problem is latency or disruption in the network and the sync falls apart, and it would be difficult to recover except by restarting the game. The approach and framework may work for some types of games fairly well - for example, straightforward arcade-style games, but certainly not for many others - for example, any game with significant randomness that cannot be coordinated across devices.
This is a hugely difficult problem - the most prominent startup that is working on it is 6D.ai.
"Multiplayer AR" is the same problem as persistent SLAM, where you need to position yourself in a map that you may not have built yourself. It is the problem that most self driving car companies are actively working on.

Unity Tango app crashing when using FindPlane function

Recently I've started porting my older Unity code with an earlier version of the Tango / Unity SDK to the latest version. Overall, it's working great. Faster frame rate, less drift, everything seems pretty good....Until: BLAM... Sudden crash. So, I tried paring down my app to the essentials to see if I could reproduce the crash and what I've found is that if I follow the AR Unity example in the docs to the letter, no problem. But, if I add a 'FindPlane' call within the Update() function so I place a sphere at the planeCenter of whatever is at 960,600 (middle of screen), after a few minutes the app will crash. So my suspicion is that this is what's causing the crash in my larger app (with many more moving parts, so to speak).
My question is two part:
1) can anyone suggest some debugging processes to help me identify exactly what the problem is here, in case it isn't the FindPlane function after all?
2) does anyone know why the FindPlane function might cause an error? Even if it doesn't successfully find a point it should still return Vector3.zero and a new/default Plane object, neither of which should result in a crash.
Thank you for your thoughts on this perplexing issue.
EDIT: I tried installing and activating Tango-Debug-Overlay recently and it shows a bit of diagnostic info. The problem appears to be thermal, and from what I can tell, related to the depth sensor. So now I'm trying to set a very low FPS, as a test, and disabling the depth sensor between frames, to see if that has any impact. I will post updates as I find out info.

output different from simulator and iphone device

The output from simulator and iphone device is different. what is the actualy problem?can download the sample code from below link. the path of the road is not the same for both. i also need to move the car from start to end with the validation. currently my validation is not working.all the details are in Readme
Link Download (1.3MB)
There are a lot of situations where the behavior of the simulator and the device differs. Mostly they are triggered by bugs in your code, like messing up your memory management or trying to write to a file that isn't writable on the device.