We are attempting a swerve drive and could really use some help programming it. We have MA3 Miniature Absolute Magnetic Shaft Encoders on each wheel that measures the angle it has been turned. We need help writing it into the program. We’ve seen a couple of examples using PID logic, and would love to go that rout, but still are not fully understanding exactly what a PID does or how to implement it into our program. If we have four wheels and four encoders, how do we program PID logic for all four? Is it separate for each wheel? Then how does tele-op work?
Any help or tips would by much appreciated!
Ether, thank you for the links! I’ve watched the video and downloaded the program. If I follow the steps for finding KVP that were shown in the video, what would the value of KVP in the example shown for a 6-1 PID controller in ModelQ? What should a “sustained and stable oscillation” look like? I’m having trouble defining what is a stable oscillation in ModelQ.
MaGiC_PiKaChU, we are using Talon motor controllers. If you could help us figure out this swerve drive, that would be fantastic! Our biggest problem in trying to figure out how to implement the PID vi supplied by labVIEW. We don’t know what to put in the ports. For example, what do we put in for process variable?
if you are using absolute shaft magnetic encoders you have to get it trough an analog channel(how it’s called in java)
I dont think you can use one PID subsystem for all your wheels, we used Talon SRX controllers so we could use their PID closed loop and put our swerve drive in a regular subsystem. Correct me if i’m wrong, but you have to use 4 subsystems only for wheels rotation
I recommend you control each wheel’s angle individually so they will get to their setpoint no matter what. (each wheel has it’s own PID, so you don’t send all motors the same command that would mess with synchronization with time.)
if you have any questions on that, feel free to send me an email
We’ve managed to get the robot moving without the use of encoders, but as suspected, the wheels do not turn at the same rate when turning due to the different ages of the motor controllers and the wheels initial starting positions. Now we just need to figure out how to implement the encoders to make the wheels turn simultaneously. We are not particularly worried about making the robot make an angled turn or pivot on a wheel at this moment, so I believe it would be alright to use only one PID since two wheels would be set to the setpoint and the other two would be the same but opposite.
I still need help setting up PID in labVIEW. I believe the MA3 uses analog signal, but I don’t know how to set that up in labVIEW.