# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Steering objects by gyroscope?Posted: Sat Jun 16, 2012 3:46 pm

Joined: Sat Jun 02, 2012 6:42 pm
Posts: 3
Hi,

I am trying to rotate (not teleport but move) kinematic object by data from phone's gyroscope. I want rotation of this object to be exactly what I have rotation of the phone.
But how I am doing this now: I take quaternion from my gyroscope, take another quaternion from my kinematic object, convert both quaternions to euler angles, and calculate difference of angles between phone and object, and based on this I calculate angular velocity to move my object into the phone position. But It is not working properly, I have few problems when I am doing this, one of these is gimbal lock.

I know in PhysX is something like rotateObjectToQuaternion(), and I can rotate my object (not teleport but move) to specific position based on quaternion.

But I can not find something similar in Bullet. Is there something like that?
If so, can someone tell me what is that function, or how can I accomplish similar result?

Every suggest are appreciate

Top

 Post subject: Re: Steering objects by gyroscope?Posted: Tue Jun 19, 2012 6:15 pm

Joined: Sat Jun 02, 2012 6:42 pm
Posts: 3
http://www.euclideanspace.com/physics/kinematics/angularvelocity/quatDiff1stAttempt.htm
http://www.euclideanspace.com/physics/kinematics/angularvelocity/

I did something like:

Code:
btQuaternion diffQuater = gyroQuater - boxQuater;
btQuaternion diffConjQuater;

diffConjQuater.setX(-(diffQuater.x()));
diffConjQuater.setY(-(diffQuater.y()));
diffConjQuater.setZ(-(diffQuater.z()));

////////////////
//W(t) = 2 * dq(t) /dt * conj(q(t))

btQuaternion velQuater;

velQuater = ((diffQuater * 2) / d_time) * diffConjQuater;

But it is not working as I expect, I mean, there is written, vector part of the result quaternion should be vector of angular velocity, and scalar part should be 0, but my result is not like that.

Quote:
angular velocity vector represented as quaternion with zero scalar part, i.e
W (t ) = (0, W x (t ), W y (t ), W z (t ))

Any ideas?

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: Google [Bot] and 7 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities