0
\$\begingroup\$

I am using a BNO055 sensor with a ESP32 development board to control my mouse cursor. I'm able to get data from the sensor as angular velocity, or as absolute orientation in quaternions and use that to control the cursor movement on screen.

My aim is to be able to get yaw and pitch angular velocity measurements, which align to the movement of the hand in space, with the device attached to the hand. I'm able to do this when the device is straight. But I'm facing issues, if the device is rotated on its frame's roll axis. This results in a movement of the hand registering angular velocity on both the yaw and pitch axis. I have made a short video to demonstrate the issue, which hopefully makes more sense than the written explanation.

If you would like to view the current project code that is available here.

I understand this is very specific, and potentially time-consuming to answer so no expectations! Still, I would appreciate any guidance on how to approach solving this.

PS. Sorry for bad video quality, I have RSI and can't spend too long on touchy stuff like this.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ an accelerometer would tell you the direction of the gravity vector with respect to the plane of your PCB... It feels like that should help somehow... \$\endgroup\$
    – vicatcu
    May 19 at 11:48
  • 1
    \$\begingroup\$ I didn't watch the full video; but, Once you rotate the hand about the roll axis and move your hand left right with respect to the desk/screen, the gyro on the watch / IMU sees it as a pitch movement and not yaw movement. But, you still want to interpret it as yaw movement. For that, (IMO) the angular velocity should be resolved in the global-frame or desk/monitor-fixed-frame in your case and not the watch/IMU-fixed-frame. Try rotating the current result angular velocity vector you have obtained with the current quaternion; this (when done correctly) should txform it to global frame. \$\endgroup\$
    – AJN
    May 19 at 14:10
  • 1
    \$\begingroup\$ Not directly related to your question, but, with the way the hand moves in the video, it seems to have more translation than rotation, perhaps you should use the accelerometer data rather than the angular velocity data. \$\endgroup\$
    – AJN
    May 19 at 14:12
  • 1
    \$\begingroup\$ My answer on the related question hints about the transformation to home axis in the last sentence. \$\endgroup\$
    – AJN
    May 19 at 14:14
  • 1
    \$\begingroup\$ See if this result looks like what you want. If so, I think my previous answer holds good and this question is effectively a duplicate. please note that the code cannot be used as-such since I have not taken care to check for the correct quaternion and sign conventions! It is only for demonstrating that the earlier answer that I wrote can be adapted to resolve the angular velocity in global frame or body frame as required. \$\endgroup\$
    – AJN
    May 19 at 15:00
0
\$\begingroup\$

With some help, I was able to figure out code, that does what I need. I've uploaded it here. Hopefully somebody find it useful, it has comments describing the steps being taken, but in all honesty I do not understand the maths behind it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.