Page 2 of 2

Re: setHubPort not working?

Posted: Wed Mar 07, 2018 3:31 pm
by jdecoux
As Patrick said, you should be using the timestamp parameter to calculate the time between measurements. The timestamp is in milliseconds.

Also, to ensure your sensor is set up correctly every time you run the program, I recommend making use of the attach message to automatically set your parameters once the device is attached, as depicted in the attached image.

Re: setHubPort not working?

Posted: Wed Mar 07, 2018 6:48 pm
by IanBloomfield
ok, have set in the attach loop

with the timestamp - I would need the interval between two timestamp events rather than the total timestamp?

Re: setHubPort not working?

Posted: Wed Mar 07, 2018 7:30 pm
by IanBloomfield
excellent - have worked out the timestamp

according to this - I am getting a data event 250ms. I surely must be able to make this faster?

does the computations lag the events or am I missing something?

Re: setHubPort not working?

Posted: Wed Mar 07, 2018 7:32 pm
by IanBloomfield
here is my screenshot

Re: setHubPort not working?

Posted: Wed Mar 07, 2018 7:43 pm
by IanBloomfield
Smokes - fixed this

had space between words

should read - setDataInterval 20

it is phenomenal now the number speed

Re: setHubPort not working?

Posted: Thu Mar 08, 2018 5:39 pm
by IanBloomfield
not sure if this is a good way

have incorporated a way of calibrating the gyros using switches and bangs then automatically feed this result back to my gyros.

I have the complimentary filter in place but was still getting significant drift from the gyro - mainly from pitch it never returned to 0 would be usually 5-10 degrees out and this would accumulate each rotation.

so I put a split and if / or / else type thing - seems complicated but essentially my thought was if the gyro was not actively moving it would take reading from accels and transfer this as the input as a way of resetting the gyro numbers?

or is there a better way?
I can't get my head round programming quaternions and kalman filters.
also I haven't used the magnetometer as I'm not worried about yaw movements as its not common for what I want.

but I will switch the formulae for roll and pitch as really I 180 degrees of roll and on 90 of pitch. I know that's not aeronautically standard notation but is the reality of hand movements.

Ian

If you are able to look at my patch now would be great - but only if I'm not being too frustrating -

I'm actually really enjoying the challenge and loving the "programming"

Re: setHubPort not working?

Posted: Mon Mar 12, 2018 12:11 pm
by Patrick
If your gyro is rotating in multiple axes at once, and your want to accumulate rates over time to track orientation, then you MUST do the required math (quaternions or rotation matrices) - there really isn't any choice, because rotation in one axis can affect degree of rotation in another axis.

Re: setHubPort not working?

Posted: Tue Mar 13, 2018 3:42 am
by IanBloomfield
What I don't understand with quaternions is what value do I take from the raw gyro for the angles for quaternions?

I've read lots of forums etc about it.

I have the atan2 formula for the accelerometer calculation - but I use this as my correction for they gyro when its not moving.

I can't work out rotation matrices from the gyro data.

I have a pretty complete program at present.

It gives me out the angles and results I need, Have tested it extensively and everything performs as expected. I'm not requiring super uptodate exact position sensing, just the idea of extent of movement. But would love to get my head round the maths.

I'll keep looking - do you know of good guides for gyros and quaternions?

Re: setHubPort not working?

Posted: Tue Mar 13, 2018 9:42 am
by Patrick
We have a C# example which uses rotation matrices to calculate orientation. I'm not really experienced with Quaternions, but I do know they are preferable to rotation matrices. At some point, I'd like to have some app notes on IMUs, including kalman filters, etc. but just don't know when we'll get to it.

-Patrick

Re: setHubPort not working?

Posted: Thu Mar 15, 2018 3:40 pm
by IanBloomfield
Do you think it would work with the jit.axisquat obj? If I plug gyro data into it with an expr $f1*timestamp to create a degree rotation? That obj is supposed to convert 3axis rotation into a quaternion? My numbers at present work completely fine accept if I rotate the pitch >60degrees then try to roll. It can't register the roll. But pitch works completely normally