This blog tells you of my progress with Sidbot and the IMU sensor.
The sensor is working fine. I can get it to work with the higher baud rates RobotC offers. Just not reliable. So I have to dive into this. I really need to have the higher baudrate to run the algorhithm for balancing at high speed. I aim for 100 Hertz, but I hope 50 Herz will do.
My drivers for the sensors are working well. This I consider finished.
I made a wrong descision to include the blinkM with the IMU unit. As the now share the same port, they also share the same band width. What’s more, they also have to share the same thread as the I2C calls in robotC are not thread safe.
Getting 3D attitude information from a 3-axis gyro is not obvious. I have to dive deep into trygonometry and vector math to understand and code for the transformations required. This is because the robot and the gyro are not fixed in space, they can have any attitude. And when the robot is upside down a clock-wise turn seems counter clockwise for the sensor. You have to account for this in the code, and not just for this extreme attitude but for all possible attitudes. It is funny how my robot building projects always seem to end up in math and statistics. I can only conclude that my mind is drawn to this as I find little similar experiences on the web. What’s even more funny is that my best source of information has been a book written by a guy who’s primary field of interest were missile guidance systems. So it really is rocket science!
In the mean time I have also modified Sidbot, I have lowered the center of gravity as much as possible. This makes it more stable. It can now handle much larger accelerations. You have to remember that it must perform in tilted situations when on the ball. It gave me some quality time with my son.
Next weeks will be spent on writing an inertial navigation system (INS) for the robot. So that it will always know its attitude and position. The code will just take a few lines. I expect more problems with the stability of the system. It must be reliable/stable for a few minutes but this might not be a realistic goal. We’ll see.