I want to use pixhawk with the apm rover firmware to operate an agricultural tractor. I need to set up my tractor as an rc vehicle. My plan is as follows: any feedback I can get is appreciated. I plan to order the parts in the next couple days but if there is something I've overlooked or my plan has no chance of success let me know.
Throttle control: Linear servo (https://www.servocity.com/html/25_lbs__thrust_linear_actuator.html#...) I don't see too many problems here.
GPS: I plan to use the gps already installed in the tractor. I am planning on buying a pololu 23201a to convert the serial nmea to something I can input to the pixhawk.
Steering: This is what I'm most worried about. The tractor has an electric over hydraulic steering valve, so basically provide 12v to right side tractor turns right, provide 12v to left side tractor turns left. I am planning to put in a dual 12v relay controlled by pwm signals for the steering https://www.servocity.com/html/electronic_pwm_controlled_dual.html#... Anybody have a gut feel on whether this will work or not? The problem is the steering output from pixhawk needs to reach a certain threshold before steering valve will operate this is quite a bit differnt than how it is set up on my rc car where each pwm value corresponds to a specific steering angle.
Clutch: Much testing has to be done with a person in the cab to operate the clutch and some sort of ignition failsafe installed before I get the tractor to be totally autonomous but I would like to start thinking about the clutch, and start testing some setups with a person in the cab. I could get a linear actuator that releases the clutch when throttle pwm reaches some predefined threshold? But I would really like a system that if the power is cut or signal is lost clutch is automatically depressed which will stop the vehicle. I could set the clutch up to be always depressed and use a linear actuator to engage it. Connect the actuator to the clutch with an electric solenoid so if power is lost actuator releases and clutch disengages. Anyone else have some good ideas?
Still no luck with my linear servo. https://www.servocity.com/html/heavy_duty_linear_servo__25__l.html#.... I've got the pixhawk powered off the battery on my tractor using the power module. The linear servo works if I plug it straight into my turnigy 9x reciever but not when the servo cable is plugged into the pixhawk. It does provide power to the power rail and if i plug in the small steering servo from my rc car that moves, which verifies that I have the power ground and signal wires installed correctly and that I am getting a pwm output from the pixhawk. I've tried my linear servo and my small steering servo on different ports same result so I can rule out a bad pin. I used the terminal and pwm test... to test my small steering servo and got it to move so I tried the same for my linear servo at various update rates but still no change so I can rule that out too. So to summarize the signal my linear servo gets from my turnigy 9x receiver moves it but the one it receives from pixhawk does not. Do I need an oscilliscope to measure the two waves? Then I could see how they compare. I don't have an oscilliscope so any other way to do that?
Ok so I know this isn't the right thing to do but I used my digital multimeter to measure voltage between signal and ground on both pixhawk and my turnigy reciever when connected to my linear servo. Pixhawk 0.16V reciever 0.33V so even though this isn't a true measure it shows that the signal from my reciever is stronger than the signal from pixhawk. Not sure how to fix it or proceed from here.
It could just be a voltage issue. I'd suggest you power the servo rail from a BEC or equivalent. See this page here:
We need to do this when we plug the LIDAR into a pixhawk in PWM mode
so perhaps your linear servo requires the same thing.
The Linear servo does power the rail. Ill try hooking up servo leads from the esc on my car also and see if that solves anything.
I got the steering up and running. Video is posted below. It works not bad. Its a little wavy so I'll either need a driver as Philip sugessted or find a way to increase the rate at which the steering changes. It will always be going left right left right but that is how the autosteer works on this tractor and it manages to drive straighter than pixhawk. All in all very excited I think this project may one day be a useful tool on my farm not just a hobby.
BIG THANKS!!! to everyone who has answered questions in this discussion and others. Couldn't have done it without you!!
That was excellent. Please keep posting video's as you progress.
That's pretty cool. I started to think you might have to use a proportional valve on the steering system or perhaps something with a different pilot valve setup to get finer directional control but if you post a DF log that would help to explain what is going on. There are probably 50 ways to create a situation where the heading is hunting, including the update rate from the GPS. I suspect it might be the output PWM range. A log would tell us a lot.
I could but the steering system is hydraulic and has creep in it meaning that if you turn the steering wheel to position x a few minutes later position x will be position y. If you are trying to drive straight on a sidehill multiple revolutions of the steering wheel will be needed. If I need to build feedback into the system I will have to put a sensor at the articulation point of the tractor.
I did get the tractor to steer and drive straight today. If you ask it to drive to a point that is on a heading that diverges too much from the current heading it makes a few lazy s turns before it straightens out again. I think if I just set the maxg force setting lower so that it can't turn as sharp that will help a lot. Basically what happens is it turns to its sharpest angle but then it takes too long to turn back to straight so it makes s turns but if I limit how much it turns that should work pretty good. I'm dealing with big spaces so a large turn radius is fine. I haven't looked up how to get or look at my DF log but once I figure it out I can post one if you are still interested?
Here a video of my tractor following gps coordinates that I output from my sprayer. (It's a version of follow me) At the start the tractor has some trouble finding the line and the operator has to help a bit but after that its all pixhawk, and APM rover. At the end of the video it looks like the tractor is getting away but it does come back all on it's own and follows nicely for another few minutes. I am super excited about this. There is definitely some bugs to work out but i've only spent 6 hrs actually testing. The long term goal is to have this in the field at harvest time with a big cart behind to get grain from the combine. Just google "Kinze autonomous grain cart" to see what I want to accomplish. If I can do anything close to that with pixhawk mine will be a lot cheaper. HIP HIP HOORAY for open source!!
Yes please post the log.
You have probably already been through this page but just in case here it is again. Note the last section discussing how to fix weaving.
And keep those video's coming! Highlight of my day to see a tractor driven by APM:Rover :-)