Have you given consideration to the requirement for occasional recalibration for the Z access due to settling through the crop year? I am assuming most people will fully dig their beds once a year, at which point the ground level will be quite high. It may also not be level (in fact, you probably want a bit of slope for drainage). Over time, the soil will settle, and will be further away. This will be particularly needed for weeding.
Two half baked ideas on possible ways to do this…
Take an image, move a little bit and take another image then use stereo vision with open CV to compute the range map to the ground. I have not tired this and know idea if the platform is stable enough to do stereo vision like this. If someone took a 3 photos that only were 5 cm apart on the y axis with the camera about 30 cm off the soil, I could see what sort of data one might be able to get off of them.
As the moisture sensor starts to move into the ground does the electrical signal from it change abruptly enough to detect when it has started to go into the ground ?
Thanks for the ideas!
Thanks for the images.
The gantry looks like it is very stable and the images match up well so I think this has a chance of working. I computed the range images and it is show below. You can see places where a twig shows up as a brighter “closer” object than the ground it is on. Would need to do some calibration to make this really work but at first pass it looks encouraging.
Code I used for this is at https://github.com/fluffy/playRangeImages
The resulting range images from your first two images is: