I’m trying to build a project that detects the following (using two color blob detection scheme, one at the base and one at the top of the pendulum):
- X postiion
- X velocity
- Angle between two blobs
- Angular velocity
For my project, there needs to be a very consistent sampling period/frequency as well. Is there anyway I could implement this and send the data over SPI/UART on a scheduled basis? To reiterate, I’d like to get each of these data points and send them out to my transmitter at a certain sampling period. Is this possible?
Edit: Furthermore, I have been trying to read up on your APIs and even visited the github. Where can I learn more about the image module, particularly blob? And also the modules needed for the displacement/velocity examples? Looks like the imports are just: sensor, image, and time (all three of which seem to be very prominent in most examples). I went to the tutorial page too and I’m finding it difficult to find what I need. My apologies if I am missing something right in front of me, I am also quite tired.
Hi, find_blobs() returns a list of color blobs in the image matching a set of thresholds you want to track. Once you have these blobs you have the centroid of the x and y position of each. The angle between the two blobs is just math.atan2(y1-y2,x1-x2). The angular velocity is then the rate of change of that over time. You can use the pyb.mills() method to get the exact amount of milliseconds that have passed and then only execute the main loop of your code once that amount of time has passed.
Docs are here:
Thank you kwagyeman! The docs are going to be really great to look though, and I appreciate you clarifying some things. I can’t wait to get this project up and running. Speaking of which, is there a place you guys like the community to post finished projects? I’m going to be uploading all of my code to github of course for version control, but it’s always good for the brand to show off what can be done with this tool.
Typically, folks post to the forums. It’s all searchable via google. So, it’s not hard to find when folks want to find it. Otherwise, post on Hackaday or elsewhere to show off the project.
Me/Ibrahim don’t really have much time to stand up anything else except to keep the company running.