Posts

Post not yet marked as solved
0 Replies
422 Views
Hello friends I’m currently developing an iOS application that uses the attitude from CoreMotion. For this I need to evaluate the specific values of Pitch, Roll and Yaw. As long as the app is in landscape mode and the device upright (X-axis up), I only need some small adjustments of the values to get the right attitude data. New: Pitch -> Y-axis, Yaw -> X-axis and Roll = Z-axis. func startDeviceMotion() { if motionManager.isAccelerometerAvailable { self.motionManager.deviceMotionUpdateInterval = self.interval self.motionManager.showsDeviceMovementDisplay = true self.motionManager.startDeviceMotionUpdates(using: .xTrueNorthZVertical) // Configure a timer to fetch the motion data self.timer = Timer(fire: Date(), interval: self.interval, repeats: true, block: { (timer) in if let motion = self.motionManager.deviceMotion { // write the values my own orientation data structure self.orientation.azimuthAngle = Measurement(value: -motion.attitude.yaw, unit: UnitAngle.radians) self.orientation.inclinationAngle = Measurement(value: -motion.attitude.roll-(Double.pi/2.0), unit: UnitAngle.radians) self.orientation.bankAngle = Measurement(value: motion.attitude.pitch, unit: UnitAngle.radians) } }) // Add the timer to the current run loop. RunLoop.current.add(self.timer!, forMode: RunLoop.Mode.default) } } However, when I use it in portrait mode (Y-axis up), I can't find a suitable conversion that provides me good values. Most of the time I get mixed values. The goal is that the following axes define Pitch, Roll and Yaw. Pitch -> X-axis, Yaw -> Y-axis, Roll -> Z-axis Has anyone ever had this problem and could explain how to get meaningful pitch, roll and yaw values with an iPad in portrait mode? Kind regards
Posted Last updated
.
Post not yet marked as solved
0 Replies
372 Views
Hello Friends I am currently developing a framework that offers a SwiftUI menu among other things. In this menu I use a normal FileImporter. import SwiftUI import UIKit import UniformTypeIdentifiers struct SimulatorConnectionView: View { @State private var isImporting: Bool = false @State private var fileSelected: Bool = false @State private var filename: String = "Select File" @State private var url: URL = URL(string: "/")! var body: some View { VStack{ // some code HStack { StandardButton(title: filename, width: 250, locked: false, action: { isImporting = true }) } // some code }.fileImporter( isPresented: $isImporting, allowedContentTypes: [UTType.text], allowsMultipleSelection: false ) { result in do { guard let selectedFile: URL = try result.get().first else { return } url = selectedFile fileSelected = true filename = selectedFile.lastPathComponent } catch { // Handle failure. print(error.localizedDescription) } } } } I’m using XCode 14.3.1 and I’m building for an iPad Air (4. Gen) with iOS 16.2 When I now run the application that uses the framework and open the FileImporter, the standart window opens. But after a certain time, it starts to flicker and eventually crashes. The following Error Message occurs: 2023-08-29 09:36:37.652586+0200 “MyApplication” [2161:397002] [lifecycle] [u 8130AA3A-2C68-4F54-91D0-9CA032B2644F:m (null)] [com.apple.DocumentManagerUICore.Service(1.0)] Connection to plugin interrupted while in use. 2023-08-29 09:36:37.654256+0200 “MyApplication” [2161:397002] [lifecycle] [u 8130AA3A-2C68-4F54-91D0-9CA032B2644F:m (null)] [com.apple.DocumentManagerUICore.Service(1.0)] Connection to plugin invalidated while in use. 2023-08-29 09:36:37.663598+0200 “MyApplication” [2161:396793] [DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted} 2023-08-29 09:36:37.663672+0200 “MyApplication” [2161:396793] [DocumentManager] Remote view controller crashed with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}. Trying to relaunch. 2023-08-29 09:36:37.668171+0200 “MyApplication” [2161:397042] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> Unfortunately, I’ve no idea what this messages want to tell me and google couldn’t help me ether so far. Has maybe someone an idea what the problem could be or can give me at least a hint in which direction I have to search? Kind regards
Posted Last updated
.