Timing and 4 sets of data

OpenMV related project discussion.
MatthewJBailey
Posts: 6
Joined: Sun Nov 10, 2019 3:49 am

Timing and 4 sets of data

Postby MatthewJBailey » Sat Nov 30, 2019 1:26 pm

Good afternoon,

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):

1) X postiion
2) X velocity
3) Angle between two blobs
4) 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.

Best Regards,

Matt
User avatar
kwagyeman
Posts: 4436
Joined: Sun May 24, 2015 2:10 pm

Re: Timing and 4 sets of data

Postby kwagyeman » Sat Nov 30, 2019 3:12 pm

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:

http://docs.openmv.io/library/index.html
Nyamekye,
MatthewJBailey
Posts: 6
Joined: Sun Nov 10, 2019 3:49 am

Re: Timing and 4 sets of data

Postby MatthewJBailey » Sat Nov 30, 2019 3:17 pm

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.

Best regards,

Matt
User avatar
kwagyeman
Posts: 4436
Joined: Sun May 24, 2015 2:10 pm

Re: Timing and 4 sets of data

Postby kwagyeman » Sat Nov 30, 2019 3:29 pm

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.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests