LSM6DS33 and Balboa32U4 control loop

Hello!
I am working with an LSM6DS33 gyroscope+ accelerometer sensor onboard Balboa32U4 robot. I referred Pololu’s arduino library and was able to balance the robot at control loop frequency of 100 Hz, and sensor update frequency of 208 Hz, 1000 dps scale.
To understand the feedback control further, I tried and tested different loop frequencies and sensor output data rates:

Control loop frequency(Hz) Sensor output data rate(Hz) Performance mode Observations
100 208 Default (high) smooth balance of robot with no tuning of parameters required
100 104 Default (high) wild back-and-forth oscillations, even after tuning of parameters
100 104 Normal mode smooth balance of robot; no parameter tuning required
50 104 Normal mode smooth balance of robot, after tuning parameters
50 52 Low performance mode robot balances, albeit not very smoothy, after tuning parameters

The performance mode of the sensor is configured through CTRL7_G register. I faced these questions after the above observations-

  1. How exactly is the performance mode of the sensor related to the tuning of parameters in calculation of motorSpeed, responsible for balance of the robot?
  2. How does the LSM6DS33 sample the data? Does the balboa control board take the most recent value from the register to which the sensor writes the data, or does it consider some computed value of the new and previous sensor samples?
  3. Why is parameter tuning necessary when changing the sensor’s output data rate, keeping the control loop frequency constant?

I could not find any definite answers to these questions in the sensor’s datasheet, as well as the robot’s user guide, and pololu’s lsm6-arduino library. I may have missed something simple, but would appreciate a lot for any help. Thanks!
-Som

Hello.

We have not characterized how the performance mode and output data rate affect the balancing performance in detail, but the difference in results between lines 2 and 3 of your table seem odd. Can you post the code that you used to set the registers for each case?

By the way, aside from the documentation you found already, I think Paul’s series of blog posts about how to make a Balboa 32U4 robot balance would be a good read for learning more about how balancing works. I will link to part 2 below since that one specifically deals with the inertial sensors.

- Patrick

Thanks for sharing the post. I went through the article, but couldn’t really find the source of the problem. I have shared a picture of configuring the registers in my code.

It is not clear what conditions you were trying to test in this version of your program since the code for writing to the CTRL2_G register does not match your comment.

Can you post your code you for setting the CTRL2_G and CTRL7_G registers corresponding to lines 2 and 3 of the table in your first post? Please make sure it is clear which code is for which line of your results table. It also might be good for you to repeat the test to confirm it really does behave as you indicated for those settings just in case there was just a mistake when you tested it the first time.

By the way, instead of posting photos of your computer screen, it should be sufficient here to just copy and paste the relevant lines of code. In your post, you can format the code using the “Preformatted text” button.

- Patrick