I have a 12 volt geared motor driving my power steering on a John Deere 5055e. The Pixhawk channel 1 output is going into a JRK12V12 motor controller which is receiving angle sensor input from my AG Leader steering angle sensor. I have consistent RTK float GPS status coming from my ComNav K501G receiver.
I’m looking for suggestions on how to improve cross track error. I have adjusted 3 steering related settings to find the best fit (i.e. NAV1_PERIOD = 24; STEER2SRV_P = 19 and STEER2SRV_D = 0.00625). My min and max xtrack error is -0.19 and 0.20 respectively after waypoint 1 on a 150 yard test run at a ground speed about 1.3 m/s.
Video URLs with 3 tests with different STEER2SRV_D are below. Visually there is not much difference between the three settings. Graphing the xtrack error and steering channel shows:
I’m wondering what additional settings might smooth my servo 1 output and make my steering control motor oscillate less with the result being a tighter xtrack error.
Hi, what's your steering actuator - is that off the shelf?
I'm far from an expert on the tractor side, but here are a few thoughts. Also, I don't know your background so apologies if any of this is telling you how to suck eggs.
1) What's the mapping between steering wheel angle and wheel angle? Is it direct? It looks like you're getting a lot of steering wheel movement with not much wheel movement. Is it just a really high gearing ratio, or is there something that's not direct in there (like a deadband or slop)?
If you jack up the front of the tractor and turn the wheel, is it a direct relationship - should 30 degrees of steering wheel always correspond to 5 degrees of wheel movement? Have you confirmed the tuning and the response of the steering controller itself? Is there any slop between the steering wheel, the wheels, and the sensor? Is there any non-linearity in the linkage between the wheels and the angle sensor?
2) Are you able to log ACTUAL steering position against command? If it's an analog position sensor you may be able to feed it back into the Pixhawk through one of the ADC inputs. One possible problem could be that the pixhawk is commanding movements that are faster than the steering can respond to and "winding up" the integral. How does it behave when you are driving it in MANUAL with the RC controller - do you notice much of a lag or an oscillation?
Any oscilation in MANUAL mode would point to the tuning of the Pololu controller.
In the second and third videos there's a bit of slop in the steering actuator - the motor housing moves back and forth. Can you tighten that up? It's not much movement so it may not be a problem, but potentially a quick thing to eliminate.
The tuning docs - http://ardupilot.org/rover/docs/tuning-steering-and-navigation-for-... - refer to TCONST. I see you've tweaked that - how did you get to that value?
3) Where are the pixhawk and GPS located in relation to the centre of gravity (or maybe centre of steering?) for the tractor? If you're chasing super high precision an offset between the GPS, Pixhawk, and tractor centre might be problematic - image the extreme case of your GPS being on a 20 foot pole out the front - any deviation would be magnified.
4) Have you looked at your speed plot? My understanding of the Pixhawk steering controller is that it commands a desired yaw rate which is a function of speed. If there's any variation in your speed measurement (which could be a large % at such low speeds) that may be throwing off the rates. Does RTK give you high accuracy speed at low velocities?
If your RTK velocity isn't up to scratch, maybe wheel speed encoders would help.
5) How well do you understand PID controllers? The Pixhawk steering output looks (to my untrained eye) like your P term is too high.
6) Have you tested it in STEERING mode? My understanding is that uses the same steering rate controller so can help you isolate the steering PID values from the navigation Period and L1 parameter effects.
First off, thank you for your thoughts. There is a lot here which is great. It helps me think through this. Let me try and go through it 1-by-1.
“what's your steering actuator - is that off the shelf?” – The configuration is a power wheels 12 volt motor driven by a Pololu Jrk 12v12 controller which is receiving signals from the Pixhawk on servo output channel 1. In essence it is acting as a big servo which has a rotation of 4.1 revolutions.
“…What's the mapping between steering wheel angle and wheel angle?... or is there something that's not direct in there (like a deadband or slop)?...”, - See the additional videos. I don’t believe there is any deadband. A variable I do see is what signal comes from the joystick in the neutral position. In the “no dead space” video I was barely moving the joystick and the motor responded instantly.
“…should 30 degrees of steering wheel always correspond to 5 degrees of wheel movement?...” Yes
“…Is there any non-linearity in the linkage between the wheels and the angle sensor?...”, No
I have made a simple video showing full left, full right and then going from full left to full right without stopping using the RC control. Takeaways:
- From center position to full left is 720+45 = 765 degrees (assuming 360 degrees is 1 rotation)
- From center position to full right is just shy of 720 degrees, say 700
- It takes approximately 3.7 seconds to go from full left to full right. 1465 degrees (4.1 turns)
There is a Pololu utility I can connect directly to the motor controller and see the incoming and outgoing signals. It started to rain today so I had to take a break.
“…Are you able to log ACTUAL steering position against command? …” - With the JRK utility connected I can. If it is critical to have consistent access to the angle sensor voltage output I can do as you suggest and feed it into the sonar sensor pin…that is a really clever idea you have.
“…How does it behave when you are driving it in MANUAL with the RC controller - do you notice much of a lag or an oscillation?...”, - There is zero oscillation or delay in Manual mode. In the video folder are images of the rc channel output and the heading collected during manual mode. Once I visually got on the correct heading the tractor steered straight without interruption except for a couple of minor touches to the joystick. You can also view the telemetry log. Manual driving starts at 12:05:00
“….the motor housing moves back and forth. Can you tighten that up? …”. Tightened.
“…refer to TCONST. I see you've tweaked that - how did you get to that value?...” – I don’t recall changing that. I started with a default settings because I was previously injecting GPS corrections, but abandoned the EMLID Reach units in favor of ComNav and wanted to be sure I was back to a default set of configuration settings before integrating the ComNav kit.
“…Where are the pixhawk and GPS located in relation to the centre of gravity (or maybe centre of steering?)..” - See photo in folder referenced above. Pixhawk is on the roof on a point that is above the steering wheel, on the center line of the rover. The GPS is slightly in front of the steering wheel on the center line.
“…Have you looked at your speed plot? …” – Image of speed plot in folder. It does vary between 1.1 and 1.5 m/s. Any idea if that is contributing to my steering command oscillation?
“…Does RTK give you high accuracy speed at low velocities?...” – I don’t know and am not sure how I would test that. I am sending position and velocity data at 10 Hz from the RTK. I’m not sure if the Pixhawk is using the velocity data in the Novatel GPS-TYPE driver I am using.
“…How well do you understand PID controllers?...” – I would categorize my knowledge as a trial and error user, not someone that can write the underpinning code. My knowledge comes from watching maybe a dozen different videos on the subject.
“…The Pixhawk steering output looks (to my untrained eye) like your P term is too high….” – I started tuning with the P term at 10 with other factors at 0. I went as high as 24. 19 gave me the least amount of weaving after multiple attempts.
“…Have you tested it in STEERING mode? …”, I tried it briefly for the first time today. I abandoned the test because the joystick control was reversed, (i.e. left joystick went right and right joystick went left). What results should I have received do you think?
I did get a chance to test PID_I today. I ran two tests. One at 0.1 and one at 1. 0.1 produced a MIN xtrack error of -0.142 and a MAX xtrack of 0.014. PID_I of 1 weaved too bad an I abandoned and then it started to rain. Motor oscillation was no different. I was happy using 0.1 and will try and increment up to 0.2 to see if xtrack improves, but I am not hopeful it will "quiet" my steering motor.
If it's steady in MANUAL mode, then that looks like your Pololu is pretty well configured. You were doing some nice slow movements. See if it oscillates if you do some fast short-travel oscillations (like the Pixhawk is commanding it to do).
3.7s from lock to lock is MUCH slower than a standard servo. Try bumping up the TCONST. I don't know the precise maths behind it (maybe someone else can answer) but the doco refers to that "slowing" the steering system response.
You say your speed varies from 1.1 to 1.5m/s. Do you think your speed is ACTUALLY changing that much? Try increasing "GPS_MINSPEED" (or something like that) to 2.0m/s. You may lose some precision in your speed control, but it might smooth out the steering. The system (IIRC) commands a steering angle to get the right yaw rate based on your speed. A sudden 50% change in speed might be throwing that off.
To fix STEERING mode, go into the RC input config and "reverse" the roll channel. That should sort steering mode. STEERING mode should let you tweak the yaw rate controller (STEER2SRV) parameters separately from the L1 and PERIOD.
I think you need to look at two things - the rapid oscillation in the steering, as well as your cross track deviation. When you were running low P values and getting higher cross-track error, was the steering behaving more sensibly?