Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019448
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:06:20+00:00 2026-05-20T10:06:20+00:00

I have a very simple application where I am trying to use the gyroscope

  • 0

I have a very simple application where I am trying to use the gyroscope thru core motion.

At this point, for test purposes, I am just grabbing the values of roll, pitch and yaw and printing on screen. According to the picture below and as far as I know, roll, pitch and yaw correspond to the red, green and blue axis, right?

OK. When I put the iphone on a table resting on its left side (home button on the right), perfectly at 90 degrees in relation to the table plane, these are the values I read for roll, pitch and yaw: -90, 0, 0. Then I start to rotate the iPhone according to the table’s vertical axis in an anti-clockwise fashion, that would be on the positive direction according to the table vertical axis. On the iPhone, that would mean a pitch rotation, but as I rotate, pitch remains constant and YAW is the one that changes!!!!!

If the iPhone is resting on its left side on the table, the green axis (pitch) is vertical. If I am rotating the device anti-clockwise (positive) on X, I should see an increase on the pitch angle, not yaw.

The only explanation I have for this is, the gyroscope axis don’t rotate when you rotate the device. So, if I am using the default attitude reference, the iPhone considers that the face up resting position is the default and the blue axis (yaw) will always be the vertical one. Is this correct?

This is the code I am using…

on the main code

motionManager = [[CMMotionManager alloc] init];
motionManager.deviceMotionUpdateInterval = 1.0/60.0; //60 Hz
[motionManager startDeviceMotionUpdates];


timer = [[NSTimer scheduledTimerWithTimeInterval:(1.0/60.0) 
          target:self
    selector:@selector( readIt )
userInfo:nil
 repeats:YES]
 retain];

the remaining code

#define degrees(x) (180.0 * x / M_PI)

- (void) readIt {

//  CMAttitude *referenceAttitude;
    CMAttitude *attitude;

    CMDeviceMotion *motion = motionManager.deviceMotion;        
    if (!motion) {
        return;
    }

    attitude = motion.attitude;

    NSLog(@"roll = %f... pitch = %f ... yaw = %f", degrees(attitude.roll), degrees(attitude.pitch), degrees(attitude.yaw));


}

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:06:21+00:00Added an answer on May 20, 2026 at 10:06 am

    Check out my question and the selected answer for some more information on this. I think the answer, in particular, tells you why the two are connected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My use case is very simple : I have a GUI application, and inside
I have a very simple WPF application in which I am using data binding
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very simple question. I want to test whether a particular port
I have a very simple application with a form, a richedit and a menu.
I am trying to create a very simple application (part of my learning program),
i have very simple problem. I need to create model, that represent element of
I have a very simple problem which requires a very quick and simple solution
I have a very simple bit of script that changes the status of an
I have a very simple TCP server written in C. It runs indefinitely, waiting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.