This sounds interesting!
I have a few thoughts about this:
- Collect data. You should test feasibility by buying a few components to start with. One ultrasonic, arduino board and the rest that is needed to connect them. Next you mount the ultrasonic sensor on a adjustable frame on a bicycle. You should have the arduino collect data for later processing. Mount it at the same height as when it would be mounted on the sprayer arm. Next start the collector and walk with the bike, or get up and drive steadily at 7 mph. You should do this out in the field. Go back and download it to a PC. Now repeat the processes but this second time you mount it at an height which you consider to high above the ground for the sprayer arm, and the third time mount it a bit too low.
Next you and/or some companion needs to take this numbers and process it though a filter and see if a steady value, it shouldn't flux to much so it approaches the barrier to the other two sample data at the wrong heights.
If possible (depending on season) try to replicate this in the growing crops.
If it works, congratulations! Otherwise you might need better (and more expensive) ultrasonic sensor. If turns out that you can't do this project, well then you haven't bought all the equipment for a system which wouldn't work. And you haven't spent time mounting it on the sprayer and the control of the hydraulic valves.
- Equipping the sprayer. I don't think you need a 6-axis sensor. Perhaps you don't have hilly field and probably not so sharp shifts in gradient. And if it would be really necessary it can be added later. But I think you should equip the sprayer with 4 ultrasonic sensors. One at each end (or close to the end) of the outer sections and 2 at the middle section's leftmost and rightmost location (at the joint to the outer section. This allows you to take the mean value for each section. And perhaps weight it a bit so the sensor data from the outer sensors is a bit more important when determining the height above ground for the outer sections.
You asked if you could do it based on your programming skills. I think you need to learn a little bit more and perhaps have some help.