Is it possible to speed up execution time of a c++ program in raspberry pi solely by increasing the i2c baudrate and increasing the sampling frequency of the sensors?
I have the issue of sudden jerkiness of my quadcopter and found the culprit which is the frequency at which my loop excecutes which is only about 14Hz. The minimum requirement for a quadcopter is 100-200hz. It is similar to the issue he faces here https://robotics.stackexchange.com/questions/6720/raspberry-pi-quadcopter-thrashes-at-high-speeds
He said that he was able to increase his sampling rate from 66hz to 200hz by increasing the i2c baudrate. I am confused on how that is done.
In the wiring pi library, it says that we can set the baudrate using this command:
gpio load i2c 1000
will set the baud rate to 1000Kbps – ie. 1,000,000 bps. (K here is times 1000)
What I am curious about is how to set this baudrate to achieve my desired sampling rate?
I plan on optimizing it further to achieve at least a 100Hz sampling rate
As of now, the execution time of each loop in my quadcopter program is at 0.07ms or 14Hz.
It takes 0.01ms to 0.02ms to obtain data from the complementary filter.
I have already adjusted the registers of my sensors to output readings at 190Hz (Gyroscope L3GD20H) and 200Hz (Accelerometer LSM303) and 220Hz (Magnetometer LSM303).