I feel like this is a dumb question, but I am going to ask it anyway.
I have been playing around with the vision examples that come with MRL. These are very cool and work well. The OpenCV GUI is very nice and friendly. It is what brought me to MRL. Playing with faceTracking.py, I see that that the location and size of the box is printed to the python window. My question is this, how would one send this data across a serial port?
I have looked at Alessandruino's tutorials for a pan-tilt kit, but they use the arduino service to control the Arduino through MRL via MRLcomm.ino. For various reasons (one of which being that I don't really know Java or Python) I was just hoping to use MRL for the vision stuff since it makes it so much easier and then send the raw data back to the Arduino. Ie, from facetracking.py I was hoping to send the values of rect.x, rect.y, rect.width, and rect.height across a COM port to an Arduino.
Can this be done with the Arduino or Python service? Any help would be appreciated.
Rule One @ MRL - THERE ARE NO
Rule One @ MRL - THERE ARE NO DUMB QUESTIONS !
There are only the questions that everyone is wondering about.. and those which people are brave enough to ask !
The OpenCV Service publishes data (like face locations, tracking point info, etc)
The Arduino service controls an Arduino via the serial communication from MRL --to--> Arduino running MRLComm.ino
They Python Alessandruino created, is the "glue" which connects the two services....
At the moment the Arduino doesn't know what it's supposed to do with "raw" data coming out of OpenCV. As time progresses and the services become more evolved there is a possibility that it "will" know what to do with "raw" data .. or at least try something.
But at the moment you need a script.
That being said, It really "SHOULD" be as easy as copying and pasting Alessandruino's script into the Python tab, and hitting execute. Is this not working for you? Or do you have other ideas on how you want it to behave?
Thanks for the question !
:)
I did try Alessandruino's
I did try Alessandruino's script and it appeared to work (I didn't actually have the Arduino hooked up to a pan-tilt kit). However, I was hoping to just send the raw x,y coordinates to the Arduino (microcontroller) without using the Arduino service or having MRLcomm loaded on the board.
The way I would think it would work would be opencv --> Python --> some sort of terminal service --> microcontroller or serial device of choice.
In my case I would then do a parseInt() in my sketch on the Arduino side to get the values from the computer. Then I could do whatever I needed to by changing my Arduino sketch. MRL would just supply a constant stream of coordinates for the Arduino to read.
Ahhh.... More than one
Ahhh....
More than one person has been interested in driving an Arduino without the Arduino service.
I'd be interested in making a raw SerialPort service... but I'm a bit busy working on other parts..
I'm betting that Python has the capability of opening up a serial port and writing directly too it... You might ask Alessandruino about this. (Or at least about Python using aditional Python libraries).
Ya ... hmmm a serial port service .. I think that would be a long overdue and good idea... just need to find the time to do it...
Just so you know, the Arduino service with MRLComm.ino can do about anything any Arduino sketch can do, except the logic would be in Python and not in the Arduino's sketch. You can write, pwm, read, and drive motors & servos with the Arduino service + MRLComm.ino
Did you have something else in mind? Or is it, your more cofortable with Arduino's language vs Python ?
The language is the primary
The language is the primary reason, but there are a few others. It would be cool to be able to get vision data on an ATtiny chip for instance. But yes, it is mostly the language. I am not a savy programmer, but everything I have learned has been in Arduino style C, and I suspect this is true for many other people out there.
I have Googled around and found THIS. Apparently it isn't hard to do serial comms with Python with the pySerial library. I just don't know how to go about loading that library into the MRL service.
MRL is really cool. I doubt I would be of any help to you, but if there is anything I can do, let me know. I would be happy to do what I can.
Raver has installed
Raver has installed MRLComm.ino on a ATtiny .. The Arduino service works on both controllers :)
The Python language versus C is not very different. Alessandruino is our resident Pyrhon guru, and he started just a couple months ago.
Of course there are things you could do !! The first thing it to start a project which you feel excited about, next is just figuring out how to do it with help. :)
Is a pan tilt tracking system of interest? Let us know !
Pan tilt seemed like a good
Pan tilt seemed like a good place to start with vision. End game, I was hoping to use it for some localization on a small robot I have. The evil plan was ceiling mounted camera + MPU6050 gyro + bluetooth module with some ultrasonic sensors thrown in just because.
The last 3 I mostly have working with their respective Arduino libraries (or they were working when I last thought about them..). Now I was taking a look at vision. I knew about RoboRealm from previous encounters (FIRST teams get it free) which lead me to free alternatives which led me to MRL!
All that to say, pan tilt tracking is of interest.
GREAT !Now all we have to do
GREAT !
Now all we have to do is build it ! :)
(oh, post lots of pictures .. it helps alot since pictures are work 1000+ words :)