Program Check Please..any bugs?

please help… my drive system is working really slow and my mentor thinks its the programming please double check to make sure i didnt miss anything?

MyRobot.cpp (5.16 KB)


MyRobot.cpp (5.16 KB)

remove the speedModifier all together and see what happens.

… as far as i can see that’s the only thing that could affect it in your code

What type of speed controllers are you using? If you’re using Victors, you will run into problems like this (I don’t remember the exact behavior) because the RobotDrive assumes that you’re using Jaguars. If you want to use Victors, you need to create your speed controllers and pass them into the constructor.

One good check to see if it’s software or hardware is to apply full throttle on your joystick and look at the LEDs on the speed controllers. We only use Victors, so you’ll need a Jaguar expert to comment on the Jaguar behavior (or look at the Jaguar documentation). The Victor LED will turn green when full forward is sent to the motor and red when full back is sent to the motors. If the LED is off that means that a value other than full range is being sent. If you’re certain that you’re giving it full power (i.e. a print in the code shows a 1 being set), then your speed controllers may not be properly calibrated. Refer to the documentation on how to do that (I’m not sure if that applies to Jaguars). If the speed controller is showing the correct LED state for the input you’re giving it, then the problem is with your hardware.

I see that you have a Wait(5.00) commented out at the end of your code. That would be a huge source of delay if it was uncommented. I’m assuming that you’ve tested with the code in the state that you posted it, so this probably isn’t your problem (but could be a problem in the future).

Not that it really matters here, but here are some things you can do to improve your code.

  • You should only have to call compressor.Start() once in your constructor.
  • You’re disabling the watchdog in autonomous. That’s probably a bad idea. It’s there to protect you, so you should be using it appropriately.
  • You’re creating new local variables every time through your while(IsOperatorControl()) loop. These declarations should be outside the loop for efficiency.