Quote:
Originally Posted by RBB
Our code takes in a vector (direction and magnitude) in order to move. This was implemented in order to simplify PID. We have been using a wheel and a joystick for our driver setup, but we are looking to switch to two joysticks.
Now to my main question. Is there any way to take the values of the left and right joysticks and turn them into a vector? I have seen ways to go from a vector to left and right motor power, but not the other way around.
|
So the old drive system was controlled by two inputs, a wheel for direction and one axis of a joystick for magnitude. The old code used this to derive set values for the motors in your drive system. I don't think you said, but if you're using PID, I'm guessing this may be something like a swerve drive? This might also explain why you want to use a single vector to control things? In case it isn't clear, it is hard to answer without a pretty detailed description. For example, was there a way to command the robot to turn in place? Really, it is helpful to know the drive system configuration and the operator inputs in some detail, along with how you want the new controls to work.
Now, you want to control this same drive system with a two-joystick tank-style operator interface. So you want to use two y-inputs (or whatever) to derive a single vector? How do you expect the controls to work?
Rather than try to answer based on this much speculation, it would be good to have confirmation or the specific details. I hope I didn't confuse things and that this makes sense...