I'm really surprised that this compiles... are you sure you're building the correct project?
One thing I do notice is that the OperatorControl code is only going to execute once. You need to do something like this:
Code:
void OperatorControl()
{
while (IsOperatorControl())
{
update_drive();
}
}
Additionally, your joysticks and PWM objects need to be declared as member variables within the class, rather than local variables in the class constructor. As it is in your code right now, leftmotor, rightmotor, leftjoy, rightjoy are all only available to use in the constructor.
I'd also recommend against using the PWM class directly. Instead you should use Victor or Jaguar.
Also, take note that the Joystick class will return a float from -1.0 to +1.0 when you look at an axis, not an 8-bit uint from 0-255.
You should have something more like this:
Code:
#include "WPILib.h"
class MyRobot : public SimpleRobot
{
Victor leftMotor(1);
Victor rightMotor(2);
Joystick leftStick(1);
Joystick rightStick(2);
void Autonomous()
{
// Autonomous code goes here.
}
void OperatorControl()
{
while (IsOperatorControl())
{
// Drive code goes here.
}
}
};
START_ROBOT_CLASS(MyRobot);
Hope this is enough to get you started.