Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyb library? #1

Closed
kswain1 opened this issue Nov 13, 2015 · 10 comments
Closed

pyb library? #1

kswain1 opened this issue Nov 13, 2015 · 10 comments

Comments

@kswain1
Copy link

kswain1 commented Nov 13, 2015

I am having a problem importing the pub library where I can I find it. Tried using pip, and didn't have any luck.

@kswain1
Copy link
Author

kswain1 commented Nov 13, 2015

I'm using python 2.7, and I'm not using a micro python board. I am using OS X YOSEMITE to filter information.

@kswain1
Copy link
Author

kswain1 commented Nov 13, 2015

I only need the pyb module to complete this method Integrate to yield quaternion. Is there any other way I can do the integration with another module besides pyb? These two are the methods

  • deltat = pyb.elapsed_micros(self.start_time) / 1000000
  • self.start_time = pyb.micros()

@turbinenreiter
Copy link
Member

You will have to replace the pyb calls with calls to time or datetime.

pyb.micros() is the time in microseconds
pyb.elapsed_micros(arg) gives the elapse time in micros since arg

@kswain1
Copy link
Author

kswain1 commented Nov 13, 2015

Yes I have added the time function to instead of pyb.
Do you know if this is similar function to pyb micros

import time
def micros():
return time.time()/1000000

def elapsed_micros(start_time):
return time.time()/1000000 - start_time

If so, I am currently getting all zero's for my yaw, pitch, and roll,which is definitely wrong.
What are some average angles to expect?

@peterhinch
Copy link
Contributor

time.time() returns seconds so you need to multiply by 1000000 to get microseconds rather than divide.

@kswain1
Copy link
Author

kswain1 commented Nov 13, 2015

Thank you will try it in the next couple of hours to let you know the results, so we can close this issue.

@neep8
Copy link

neep8 commented Nov 14, 2015

Hi I won't have my computer until the end of the month... But I was looking at getting the IMU code working in python3 with a mpu6050. Like you I struggled to find the pyb library. Hope it works for you.

@kswain1
Copy link
Author

kswain1 commented Nov 14, 2015

Hey I believed the solutions works! I am getting results, but my next question is for the calibration function during the initial time does the algorithm start the position at (0,0,0) until the chip is moved? If so I am having problems with the calibration portion of the algorithm.

@turbinenreiter
Copy link
Member

Make sure to share your patches.

@kswain1
Copy link
Author

kswain1 commented Nov 16, 2015

I believe everything is working. Patch Update
import time
def micros():
return time.time()*1000000

def elapsed_micros(start_time):
return time.time()*1000000 - start_time

replace these functions with pyb, and you should be ok.

@kswain1 kswain1 closed this as completed Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants