I'm writing some code to help the team prototype some drivetrain ideas. As a quick hack, I defined 2 joysticks and was going to use the joystick triggers to control some steering motors. I'm using the WindRiver workbench, and I used the simple template. In the OperatorControl() function I created 2 Joystick objects, and used GetTrigger(). Doing something like this:
Code:
Joystick *left_stick, *right_stick;
left_stick = Joystick::GetStickfromPort(1);
right_stick = Joystick::GetStickfromPort(2);
while(isOperatorControll()) {
if(left_stick->GetTrigger()) {
left_steer.Set(.5);
right_steer.Set(.5);
}
else {
left_steer.Set(0.0);
right_steer.Set(0.0);
}
if(right_stick->GetTrigger()) {
left_steer.Set(-.5);
right_steer.Set(-.5);
}
else {
left_steer.Set(0.0);
right_steer.Set(0.0);
}
}
And yes I know that both triggers down isn't being handled.
The odd thing is that the left_stick trigger works just fine (turning on/off the motors), but the right_stick trigger doesn't work at all. Commenting out the left_stick GetTrigger() block of code, and now the right trigger starts working. I've tried allocating the joystick on the stack, using new directly, etc. Bottom line is that I can get only one trigger working at a time. I'm using the KOP joysticks. I'm going to hook up a serial port and put some debug prints but was curious if anyone else is seeing the same thing. I do know that the the GetAxis functions are working because, using the same declarations for the joysticks, I was able to get the TankDrive() function to work properly.