Quaternion Rotations

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Frederico B. Klein
Posts: 2
Joined: Fri Dec 03, 2021 3:47 am

Quaternion Rotations

Post by Frederico B. Klein » Tue Mar 29, 2022 1:43 pm

Hi,
I am trying to implement a real-time inverse kinematics solver using IMUs from https://github.com/mitkof6/OpenSimRT which is build using OpenSim.

I am just trying to implement this using my own IMUs.

My issue is hopefully very simple.

I get some quaternions from the IMUs and I need to pass it to the inverse kinematics solver, however they do not represent the same rotation as the IMUs used in the original implementation, so I need to do a conversion from one set of quaternions to another set of quaternions.

In order:
  1. The first rotation is to define a link (with its IMU and its quaternion) as the base link. Some samples are collected at start time and every other IMU is rotated to this standard pose.
  2. In the code, there is following rotation to define the initial ground pose with an initial heading frame as the axis of your IMUs and the frame of reference of OpenSim will likely not be the same.
These are implemented in https://github.com/mitkof6/OpenSimRT/bl ... brator.cpp

For their sensor it is +z: [-90,-90,0]

For my sensor, these did not work.

And I also didn't find any simple way of determining these angles. The best I could do was guess a combination of angles which gives me correct yaw and pitch, but the roll is inverted.

The numbers that give me this behaviour are +z: [0, 180, 180]

I considered, "maybe all axis are inverted, and they should all be 180", but that did not work.

As I was out of options, and I just I thought I could just try every combination of (+/-) (x,y,z) (0, 90,180,-90), but this also surprisingly didn't work(!). (Note that this is 2.3.4.4.4 = 384 possibilities, which took me around 2 hours to test, so something I don't want to do again).

Or maybe I thought I systematically tried them all, but I made some mistake.

Right now I am wondering if the quaternion I am getting from my sensor is left-handed? Is that even possible?

In any case how can I fix this issue?

Thank you in advance for your help!

POST REPLY