SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
User avatar
By vesich
#238385
Hello everyone,

I am trying to achieve a mouse pointer like movement with the IMU. In other words, if one moves the sensor to the right, the point would move to the right, if move to the left, then to left, etc.

I am able to get and parse the data from the device, but from that point, I am not sure how to proceed. I tried using the MadgwickAHRS algorithm, but after that only the orientation of the object works. https://github.com/xioTechnologies/Open ... ickAHRS.cs

How can I make the object move based on the quaternion or is there another way?
User avatar
By vesich
#238404
Hey TS-Russell , thank you for your quick response. I am still quite new to all of this. Maybe I should have elaborated more on what I am trying to achieve.

I would like to make the movement in another application, where I can have more control of it and it's behavior. I am using Unity3D. So ideally, the IMU should send the data to a unity application, where I can parse it and do the movement. And also this should be completely wireless.

Would that be still possible with HID library? I found something called Mouse https://www.arduino.cc/reference/en/lan ... usb/mouse/. Not sure if it is the one you are referring to.
User avatar
By vesich
#238466
I tried something else - I took the example in the sketches IMU_DMP_Quat6 and sent the roll, pitch and yaw to may application. I looked at some code from here: https://www.hackster.io/movsensllc/diy- ... cro-548353

From there I used this code:
Code: Select all
            
            vertValue = yaw - vertZero;
            horzValue = roll - horzZero;
            vertZero = yaw;
            horzZero = roll;

            if (vertValue != 0)
                transform.position = new Vector3(0, vertValue * sensitivity, 0); // move mouse on y axis
            if (horzValue != 0)
                transform.position = new Vector3(horzValue * sensitivity, 0, 0); // move mouse on x axis


The object moves on the screen, so far so good. However, my object doesn't move correctly. Does someone here know what could be wrong? I am also not sure what is the correct way to hold the device.
 Topic permissions

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