I've posted about this before and have made a few steps since then but not many. I am building a device to be pulled by a tractor. It consists of: a camera, a computer, an arduino DUE, an encoder, and a bank of alligned solenoids covering a witdh of 10 cm. the device will take a photo every 30 cm and the image will cover a span of 30 cm length by 10 cm width.This will then create a matrix of x(depending on the accuracy) by 10 cells as the columns of the matrix represent the solenoids.
Note: the image processing will be handle by a different school so I dont have much say in how to get this working. I was told i would be recieving a matrix. For that reason I was planning on recieving that through the serial port and modfying that data however necessary.
My original plan was to recieve the array via the computer, create a loop for as many rows as necessary, and doing ten if statements to read each value. but now i feel like spliting the matrix into columns would be a better plan.
In any case, I would have to find a way to "mark" specific steps in the encoder to activate the soleoid sprayer. Would it be best read the entire matrix and "mark" the encoder steps or to read row by row when a nozzle must activate? Other suggestions are gladly accepted.
Thanks, and to those who have commented before, thanks for your patience!
pamoreno:
My original plan was to recieve the array via the computer, create a loop for as many rows as necessary, and doing ten if statements to read each value. but now i feel like spliting the matrix into columns would be a better plan.
In any case, I would have to find a way to "mark" specific steps in the encoder to activate the soleoid sprayer. Would it be best read the entire matrix and "mark" the encoder steps or to read row by row when a nozzle must activate? Other suggestions are gladly accepted.
I'm not sure what the encoder is doing...
As a general rule, data is data - access it, use it.
Why cant you set up an actual test environment and just try all these things you're thinking about? (as opposed to using the arduino forums for that).
A test environment would be a laptop simulating the data from the vision processing, going into your arduino, >>insert your ideas here<< and then use a bank of LED's or serial prints or whatever as your solenoid outputs. Rig it so that you can step through time at your leisure...
pamoreno:
My original plan was to recieve the array via the computer, create a loop for as many rows as necessary, and doing ten if statements to read each value. but now i feel like spliting the matrix into columns would be a better plan.
I would HIGHLY suggest you get options on what will be available.
the visual recognition folks very well could send you a hi/lo signal indicating the presence of a weed.
I would not ask for it in any special way, but ask what ways are available. it would be a crime to make them create some unusual format, that, in the end, is unusable to you when their raw format is the simplest solution.
if they spit out a steam with a stop bit, then a 1 or 0 depending on their results
and they have 10 sensors, and you have 10 solenoids, then your task is super simple.
1:1:
I'm not sure what the encoder is doing...
As a general rule, data is data - access it, use it.
Why cant you set up an actual test environment and just try all these things you're thinking about? (as opposed to using the arduino forums for that).
A test environment would be a laptop simulating the data from the vision processing, going into your arduino, >>insert your ideas here<< and then use a bank of LED's or serial prints or whatever as your solenoid outputs. Rig it so that you can step through time at your leisure...
the jist of the project is that the visual guys 'see' a weed
then they have a high/low value based on the processing.
since this is done with 10 cameras on a cabbage patch, each of the 10 streams is independent.
the idea of the encoder is that if the sprayer is 1 foot, 1 inch or 10 feet behind the camera, the distance traveled, the speed it takes to calculate the value, etc, will offer the solenoid that moment when it should fire to spray the weed and not the cabbage.
you are correct, a treadmill, some paint and a simple IR sensor should offer the opportunity to test this.
Ah so the camera position is offset from the solenoid.
Ok, I see why it's slightly more interesting/problematic and that a virtual test environment might be quite a hassle in itself. It could be argued either way which is most efficient (building a virtual test environment vs. building an actual simulation of the environment).
Hrrrm, in terms of the data types I see an array of arrays with a pointer to the current 'head' 1D array that loops using a mod function overwriting its tail. The count of sub arrays (the required buffer due to the separation) would be a function of the distance between the camera and the solenoids. The 'head' would be the camera data write (or block of writes) the tail would be the solenoids (or block) - read array(s) activate solenoids, then write new camera data in that spot, then offset pointer ('loop' around using the % function). ...repeat...
Maybe this has been discussed already? Or something better?
Also, another quick idea re. encoder you could infer velocity from the vision processing itself - but let's not complicate things with suggestions of simplifying it
the tractor pulls the trailer
the video sees an anomaly and sends out some signal.
this team then gets that signal
and is charged with timing the solenoid so that the sprayer will paint the anomaly with spray.
if there are 10 rows. then one can anticipate that either the signal with be updated multiple times a seconds in a data stream, or only a signal that row 7 has an anomaly.
once the input side of things is aware that there is an anomaly, the fun begins.
timing has to occur so that x milliseconds after the signal, the solenoid is turned on and off.
best guess is that there will be a roller that is a feedback of speed, ergo time.
the time from the presence of the signal to the time the solenoid is fired is to be calculated.
the time the solenoid is open is to be calculated
the solenoid is opened at the precise instant and then closed at the precise instant.
if the video folk offer parallel output, then each row is super simple.
if they offer a serial output, then there is some small work to be done.
anything under the sun is possible for that signal at this time.
I envision a bicycle wheel with an encoder attached to the sprayer measuring the distance between detection of a weed and the trailing position of the spray head.