Tag Archives: parallel thread

Class sensor.py ready!

After some complementary activities (build a new table for next experiments, for example) I finalized the test on the IMU and created this sensor object  that can run in a parallel thread , so I can get last updated sensor information anytime (every 5 -8 ms) while my main quadcopter loop is running.
You can find and download the sensor_test  example.When you run it you can see on the terminal the current roll,pitch and yaw of your IMU.

The available data are: angular position [deg],angular rate[deg/sec], linear acceleration[m/sec]

The main differences respect the IMU_test are:

  • I saw that the  mpu6050 initialization of same parameter can fail.The order on how you set the IMU parameter can affect the setting itself. So I added a function to verify the parameters are in fact what I decide.
  • The accelerometer vector has been normalized, so the lenght ,when not moved is equal to the gravity. this can help if I want to integrate it to extimate the linear speed and the linear movement
  • the class sensor.py  can run in a parallel thread, so anytime I can have the current sensor values.
  • minor adjustments done on the naming of the variables.

Next steps are:

  • Buy some connectors and do some soldering to have a final version of the wiring
  • mount the sensor on the frame and test it with running motors and see if i need more severe filtering.
Advertisements