Yes, I was excited to do more control directly from the Pi but I had the concern of delays throwing a wrench in timing-critical operations. I appreciate that you reinforced that issue.
I ended up doing some testing directly from the Pi. That allowed me to tweak the steering settings. I had great success! I found that I need to use PWM at around 40 Hz to get good control of the proportional valve. It cracks at around 233/255 duty cycle. I am able to make the wheels steer at a nearly imperceptible rate. It’s so cool.
I have been concerned about proportional valve control since I started. It was never clear to me if I need current control or if I can simply use straight PWM. Until now I’ve been unable to get slow steer speeds (low flow) and I thought that it might be because I’m not controlling current adequately. But now I know I don’t need to do that! It seems that I get the full range of flow with straight PWM at a sufficiently low frequency. It’s easy to find the right frequency - if it’s too high then low flows aren’t possible, and if it’s too low it pulses. This is so important! And yet even when I suspected it was an issue, I didn’t find much mention of frequency adjustments.
Also, inspired by a video I found (https://www.youtube.com/watch?v=-SE6X6t1HNQ), I chopped I and D from my PID steering (angle) controller. With the ability to go at a low rate, proportional seems to be all that I need.
Once I did all of my testing on the Pi, I re-worked my Arduino code a bit and it seems to be good. I’ll stick with it for now.
I’ve been thinking about how well Tractobot02 (300HP tracked tractor) stuck to my line, even at high speeds (19 MPH). I want that level of control with Tractobot03. Tracked tractors are designed to go straight but I’m sure I can do something similar with an IMU. So tonight I laid a Tinkerforge IMU Brick V2 in Tractobot02’s enclosure. Here’s what I’m considering…
Instead of trying to calibrate the steer angle sensor to steering angles, I’ll simply control the steering valve with a PID fed by rate of turn data. That would allow me to say “Go straight” and it should find the steer angle to do so. That gets me to Tractobot02’s level of control.
Once I can control rate of turn, I can use the PID that’s fed by the cross-track distance to feed the rate of turn PID. This means that if I’m left of my line, the PID would command an appropriate rate of turn to the right to re-capture the line.
I thought about throwing in a PID to maintain a given heading but I don’t think that’s needed if I can do rate of turn. We’ll see…