0

BN055 Vertical Orientation
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: BN055 Vertical Orientation

by jps2000 on Fri Jun 18, 2021 4:35 pm

Obviously you need to debug your servo first.
I am not familiar with the servo.h library.
I do not understand your starting values at least

float rollServoAdj = 90;
float pitchServoAdj = 95;
float rollServoStart = rollServoAdj;
float pitchServoStart = pitchServoAdj;
float servo_start_offset = 20;

you can input angles and the servo should follow them accordingly.
To debug a servo you need to open the loop to see where is the problem

jps2000
 
Posts: 660
Joined: Fri Jun 02, 2017 4:12 pm

Re: BN055 Vertical Orientation

by gammaburst on Sat Jun 19, 2021 11:51 am

"acceleration could be an issue as the rocket thrusts upward"
I suggest you compare the rocket's expected flight characteristics to the BNO055's performance limits. Beware, the limits depend on whichever operating mode you've selected.
Then fly the rocket with servos disabled, collect IMU data, study the data, and solve whatever measurement problems you see. Then enable the servos.

gammaburst
 
Posts: 591
Joined: Thu Dec 31, 2015 12:06 pm

Re: BN055 Vertical Orientation

by jps2000 on Sat Jun 19, 2021 12:47 pm

Stabilizing a rocket works with a gyro not with an accelerometer because direction of acceleration is always in the axis of the rocket.
Quats can be also used provided they are valid. Small rockets face very high acceleration values that are for sure out of range of a BNO.
The gyro in the BNO however will work correctly.

jps2000
 
Posts: 660
Joined: Fri Jun 02, 2017 4:12 pm

Re: BN055 Vertical Orientation

by ppecch on Sat Jun 19, 2021 1:29 pm

sj_remington wrote:If you are using the raw sensor data, in the code you may simply permute the indices in all the subsequent mathematical formulas as follows:
x, y, z -> z, x, y -> y, z, x
That preserves the handedness of the coordinate system, which is essential when obeying navigational conventions.

For example, the conventional formula for pitch and roll Euler angles from accelerometer data can be remapped to:
Code: Select all | TOGGLE FULL SIZE
  roll = atan2(y, z) * 57.3; //about x
  pitch = atan2((- x) , sqrt(y * y + z * z)) * 57.3;  //about y
 
 // replace x, y, z -> z, x, y
 
  roll = atan2(x, y) * 57.3; //about z
  pitch = atan2((- z) , sqrt(x * x + y * y)) * 57.3;  //about x
 
//  replace x, y, z -> y, z, x
 
  roll = atan2(y, z) * 57.3; //about y
  pitch = atan2((- x) , sqrt(y * y + z * z)) * 57.3;  //about z


Well sj_remington I went back to the drawing board and you sir are a lifesaver! I pulled the raw accel and gyro data, then used a complimentary filter, ran it through the cyclic permutation, incorporated a PID algorithm and we have a functioning thrust gimbal that works. It should be good enough to get an air shot of about 800-1000 feet and that's all I want for now. I believe model rocketry has moved beyond complimentary filters but I need to start somewhere. I'll have to do a lot more research into quaternions, rotation matrices and IMUs before I can get to the next level.

I just want to thank everyone on here for their contribution, I've learnt a lot through the discussions and I greatly appreciate all the tips along the way.

ppecch
 
Posts: 16
Joined: Mon Jun 14, 2021 12:11 pm

Re: BN055 Vertical Orientation

by sj_remington on Sun Jun 20, 2021 1:31 pm

Correction to and clarification my first post in this series. Sorry for the transcription error!

Code: Select all | TOGGLE FULL SIZE
// Z axis UP
  roll = atan2(y, z) * 57.3; //about x
  pitch = atan2((- x) , sqrt(y * y + z * z)) * 57.3;  //about y
 
// Y axis UP  replace x, y, z -> z, x, y
 
  roll = atan2(x, y) * 57.3; //about z
  pitch = atan2((- z) , sqrt(x * x + y * y)) * 57.3;  //about x
 
// X axis UP replace x, y, z -> y, z, x
 
  roll = atan2(z, x) * 57.3; //about y
  pitch = atan2((- y) , sqrt(z * z + x * x)) * 57.3;  //about z

sj_remington
 
Posts: 134
Joined: Mon Jul 27, 2020 4:51 pm

Please be positive and constructive with your questions and comments.