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?
Excellent work Matthew. Just saw this project and I am impressed with your progress. I'm grinning thinking of the fun I would have with this.
When you say your tractor has electric over hydraulic steering, what do you mean? You have a wheel, so I'm guessing it's turning an HMU for piloting a steering valve. Is this right? How is it electrified? If the steering valve is electrohydraulic actuated, then you could probably find a way to actuate it directly with a controller that takes PWM as an input.
Regarding a kill feature, does the tractor have a hydraulic park brake? These are typically fail-safe - meaning you have to energize a solenoid valve to provide hydraulic pressure to disengage the brake. If you lose hydraulic pressure or electricity to the solenoid, the brake applies. This is usually tied into some lock out features in the cab, such as doors, seat belts, etc as part of a safety system. If you have this type of park brake, you could simply interrupt the 12V going to the solenoid with a normally open RC relay switch. That way the RC link failsafe would stop the tractor as well as a tx kill switch. Of course, I would combine this with some type of engine disable as well.
So I smoked my first component today (serial to lower voltage logic convertor). I feel like I earned some kind of badge as a result. I'm glad it was cheap. As a result I had to switch to the 3dr GPS. It is definitely not as accurate as my agricultural gps (various kinds) but I was running it in the following video and the results were quite good so I think I will use it so I have some gps redundancy. It'll be my main gps until I get a new board lol. There is a screenshot of my app in the video as well that will be in the combine as the control interface to the grain cart. I updated the "follow me mode" so that it outputs gps points that are to the left and ahead of the combine location. What this means is that I can swath the field any direction or even combine curves and the cart will keep right up.
Hi Matthew. I would put your good tractor GPS on GPS1 and the 3DR GPS on GPS2. Ardupilot kind of expects the main GPS to be on GPS1 and the secondary on GPS2. Let me know if you need a hand with the configuration.
FollowMe Mode is working well in Master but not in a release yet. However, I have no configuration to add offsets. I'll add it to my todo list.
Thanks Grant. Ill do that and I shouldn't have any trouble with the settings. Here's my python function for creating the offset use it if its helpful.
# returns lat lon that is dist left and dist ahead of combine location.
#combineLoc is a list with 3 elements in the same form that getGpsLoc returns
#angle between headingLeft and hyptoneus line formed by the triangle
#created with distLeft + distAhead
#alpha is the angle between 0(north) and the hyptoneus line
#(if you drew a line between combineloc and projected point)
#delta lat and delta lon equals the sine and cosine of alpha multiplied
#by hypotenues length (h)
#convert delta lat and delta lon to decimal degrees add to combine
#lat lon and return the result
Ok so here is a video of the tractor running entirely on its own beside my sprayer. I now have control of all functions on the tractor from the simple GCS app I wrote that runs on my laptop. I plan to put the app on a touchscreen so that it can easily be operated by the combine driver. The tractor is driving only with the 3dr gps. I had to mount the gps on the hood to get a good signal. It worked the other day in the cab but then I added the linear actuators for speed control and to start stop the tractor and one of the boards was causing a bunch of interference and I couldn't get a gps lock. I tried covering the board in a plastic container wrapped in tinfoil with no result, Just goes to show that wearing a tinfoil hat does not stop the government from reading your thoughts, ha ha. So after much headbanging I choose the obvious solution and moved the gps outside. I'm just too impatient to wait for my new logic convertor board. One thing I noticed is that if you imagine that the tractor is on a mechanical linkage connected to the sprayer then there seems to be about 1m of slop in that linkage. Not sure if this is the 3dr gps or the truncated location coordinates sent over mavlink. Either way it's not a big deal the grain cart is a big target but it'll be something to keep an eye on as I proceed.
Love these updates. Keep them coming!
Here's a video of driving the tractor using mission planner. It's just a little easier to see how the tractor is responding than when you have to look through my sprayer boom. Next video will be a demonstration of safety features. After that's done the testing is going to a more wide open location so I can figure out the work flow for this fall. I really think it's going to happen. This thing is going to be in my field without a driver in fall.
Big thanks to Grant Morphet and Philip Rowse for spending time helping me think through and troubleshoot different issues I had, I'm sure there will be a few more before this is done.
Tinfoil (or much more likely aluminum foil) won't really work.
Aluminum foil will very slightly attenuate an RF signal but not much more than that.
Now if you had real tinfoil or better steel, you can definitely shield it.
You can also use graphite or carbon or MOS2 based paint, which is what the military uses for Stealth aircraft to absorb the RF (Radar in their case) and convert it to heat.
You also need to ground the shielding medium.
I take it your cab is fiberglass, because it would be a seriously bad idea to put the GPS inside a metal cab.
Wow thanks Gary I had no idea. I thought for sure aluminum foil would work and I didn't know that it should be grounded. I love posting here and lurking on the forum I learn so much.
My tinfoil hat is going to look really silly if I have to drag around a grounding cable to make it work.
My wife already sent this to almost everyone I know, so why not post it here. I did not get enough sleep this week but now that I got my tractor to work completely beside the sprayer I think I'll sleep like the dead.
Safety Feature Video
I've spent a lot of time thinking about safety and I think I have finally come up with a solution that I think is going to be reliable enough and robust enough that I can start testing without a person in the cab. My original plan was to kill the engine in an emergency, but this proved untenable. When you shut the tractor off while it is moving the stop is so sudden that if you tried it at any speed over a slow crawl I am sure something would be wrecked. I'm not sure if the parking brake is automatically applied when the engine quits or if it has something to do with the CVT transmission needing hydraulic power or both, but if I want my tractor to keep working I can't stop it this way.
There are two main ways to stop the tractor and a third that can slow it down to below a walking pace. The first way is the shuttle shifter, this is connected to the throttle channel of apm rover. This is the main way to start and stop the tractor. It can be operated off the rc transmitter but it will be mostly controlled by my GCS. The second method is an air actuated cylinder attached to the brake pedal. It has a spring return so that you must apply air for the brake to come off (much like the brakes on a semi truck). This is connected to the throttle channel of the rc transmitter, the brake will be applied if the rc transmitter goes out of range or loses connection for any reason. The brake can also be manually applied from the rc transmitter by moving the throttle stick to the low position. When the brake is not applied there will be a flashing light on the roof to warn people not to approach the tractor. I still need to mount a big bar across the front of the tractor that will trip a switch, causing the brakes to be applied if it comes into contact with any obstacle. The brake is also applied anytime the pixhawk is disarmed. Also if the pixhawk loses power the brakes will be applied. The third option is that by moving the tractor speed selector to the very lowest setting the tractor drives slower than a walking pace so as a matter of last resort it would be possible to hop into the cab while the tractor was moving. Obviously I never want to have to do this but it could be an option if everything else failed.