Home › Forums › Forums › Technical Support for BerryIMU › angelx
- This topic has 13 replies, 3 voices, and was last updated 5 years, 5 months ago by PeterP.
- AuthorPosts
- June 17, 2018 at 5:10 pm #7394ad van der endeParticipant
A observation on GRYX/Y/Z angle numbers is that they accumulate over time. They never gave me a different number when moving the raspberry with the BerryIMU on the pins.
The ACCX and ACCY do give other readings when moving the pi.
Also the CFangleX and CFangleY give different readings when moving.
Using the gyro readings on my Iphone I do get different readings on X,Y,Z when moving the iphone.
What is wrong with my assumption that I expect change in readings on x,y,z with BerryIMU?
Attached my berryIMUsimple.py
ACCX Angle 179.75 ACCY Angle -175.49 GRYX Angle -668.20 GYRY Angle 743.21 GYRZ Angle -471.04 CFangleX Angle 179.37 CFangleY Angle -175.10 HEADING 105.00 tiltCompensatedHeading 100.25
June 17, 2018 at 5:11 pm #7395ad van der endeParticipantattached py as txt
Attachments:
June 17, 2018 at 7:35 pm #7397Mark WilliamsKeymastercan you please attached the first 200 lines of the program output. From this output i will be able to get more information
Please have the IMU laying flat and not moving.
Mark --OzzMaker.com --
June 20, 2018 at 1:33 am #7410ad van der endeParticipantthe first 200 lines of output
Attachments:
June 20, 2018 at 11:51 am #7414PeterPParticipantThey gyro readings look good.
The accelerometer readings don’t look good.
Are you running this on a Raspberry Pi? Has the code been modified in anyway?
Is it up the correct way? this is when the skull logo is facing down.We need to have a look at the raw values for the accelerometer;
Just after this section of code;ACCx = IMU.readACCx() ACCy = IMU.readACCy() ACCz = IMU.readACCz() GYRx = IMU.readGYRx() GYRy = IMU.readGYRy() GYRz = IMU.readGYRz() MAGx = IMU.readMAGx() MAGy = IMU.readMAGy() MAGz = IMU.readMAGz()
can you add an extra line as shown below;`
ACCx = IMU.readACCx()
ACCy = IMU.readACCy()
ACCz = IMU.readACCz()
GYRx = IMU.readGYRx()
GYRy = IMU.readGYRy()
GYRz = IMU.readGYRz()
MAGx = IMU.readMAGx()
MAGy = IMU.readMAGy()
MAGz = IMU.readMAGz()
print (“accXYZ %i %i %i “) % (ACCx,ACCy,ACCz),`Peter --OzzMaker.com --
June 20, 2018 at 3:38 pm #7415ad van der endeParticipantJune 20, 2018 at 3:39 pm #7417ad van der endeParticipantskull is not upside down.
Attachments:
June 20, 2018 at 4:19 pm #7419PeterPParticipantYou need to make some modifications to the code. Have a look at berryimu.py in the same folder, it has comments within on what needs to be done.
Peter --OzzMaker.com --
June 20, 2018 at 4:30 pm #7420ad van der endeParticipantPeter,
“some modifications” is a bit too fage.
Do I need to make all the suggested modifications bcz of the skull upside down issue?
“what is meant by upside down? : skull is not visible at all or it is not facing the same as on your assembly pages/instructions?
Bcz the latter is the case with mine BerryIMU.
Kind regards
ad
June 20, 2018 at 5:23 pm #7421PeterPParticipantyes. make all of the changes.
When the skull logo is underneath and the chips on top, this is the correct orientation.
When the skull logo is on top and the chips are underneath, this is upside down.
Peter --OzzMaker.com --
June 21, 2018 at 1:05 am #7422ad van der endeParticipanthi,
I have made the neccessary changes in the code for upside down.
Funny that a gyro , which is upside down or not influences the readings?
So the gyro should not go head over heels?
anyway:
gyroXangle+=rate_gyr_x*LP
gyroYangle+=rate_gyr_y*LP
gyroZangle+=rate_gyr_z*LPthe “+=” is the reason why the gyroXangle is accumulating!
is this correct?
kind regrdas
adriaan
June 21, 2018 at 12:14 pm #7428Mark WilliamsKeymasterno need to change gyro calcs.
Regarding the accumulating of the gyro readings. This is normal, this is due to the noise from the gyro sensor. This is why the gyro and accel readings are fused to get a accurate result.
The values you need to use are CFangleX and CFangleY. CF = complementary filter.
You can see that the complementary filter doesn’t use the accumulated gyro value, it only uses the rate of rotation since since the last loop.
rate_gyr_x*LP
This is rate of gyro x rotation (degrees per second) since the last reading. multiple this by the loop time.#Complementary filter used to combine the accelerometer and gyro values. CFangleX=AA*(CFangleX+rate_gyr_x*LP) +(1 - AA) * AccXangle CFangleY=AA*(CFangleY+rate_gyr_y*LP) +(1 - AA) * AccYangle
more info here
https://ozzmaker.com/berryimu/
Mark --OzzMaker.com --
June 21, 2018 at 6:54 pm #7430ad van der endeParticipantHi Mark,
The usage for the GYRO readings is to monitor the swing of my caravan/trailer.
I want the PI in my caravan and send readings via websocket server on the pi ( via wifi) to my iPhone app ( a websocket client) in my car.
The iPhone app will then render the readings into graphs or warning signals when the x or y is too large, meaning the caravan is swinging to much, please break.
For this I can use the X and Y readings only, right?
Kind regards
ad
June 21, 2018 at 7:33 pm #7431PeterPParticipant - AuthorPosts
- You must be logged in to reply to this topic.