It needs to be placed in the “IsOperatorControl()” loop where TankDrive() is being called now. call the GetY() method of the joysticks to get the value and multiply it by your scale. I would use decimals like 0.25. For example:
Alright thanks, I did not know to use the GetY after the joysticks. For now it has all been working because I had just set the motors up as 2 different declarations and it worked there. So I will be switching it over today because its just much smoother.
Pardon my ignorance (or misreading of the post), but how do you get away with calling the TankDrive function (method?) with what looks like different data types as parameters? Is this what’s known in C++ speak as “polymorphism”?
R_myRobot.TankDrive(J_stick1->GetY() * 0.25, J_stick2->GetY() * 0.25);
It is a form of polymorphism. Function overloading and templates are what is known as static polymorphism. When speaking with most C++ programmers though, polymorphism generally refers to dynamic polymorphism, implemented using function pointers and virtual functions. Static polymorphism is decided at compile time, and is based upon the visible type of the objects to the compiler. Dynamic polymorphism, however, is actually based upon the run-time type of the object.