View Single Post
  #13   Spotlight this post!  
Unread 13-03-2012, 15:56
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Mecanum Code weird bug need help

Assuming the wheels are installed correctly (X pattern viewing from the top), it could be a software issue. The way we software calibrated our mecanum drive train is as the following:
  • Make sure you put the PWM channels (or CAN IDs) in the correct sequence when instantiating RobotDrive(frontLeft, rearLeft, frontRight, rearRight).
  • Put the robot on some 2x4's so the wheels can be freely turning without the robot running away.
  • In code, execute MecanumDrive_Cartesian(0.0, 0.5, 0.0) and make sure all the wheels are going forward.
  • If not, note the wheels that are turning backward and add the following line for each wheel that needs correction (need to change kFrontLeftMotor to the corresponding motors):
    SetInvertedMotor(kFrontLeftMotor, true);
  • Now, write the teleop code that uses the joystick(s) to drive the robot.
  • If tank drive, pushing the left joystick forward should turn the left wheels forward. If not add a minus in front of the joystickLeft.GetY().
  • Do the same for the tank drive right joystick.
  • If arcade drive, push the joystick forward should turn all four wheels forward. If they are reversed, put a minus in front of joystick.GetY().
  • For arcade drive, push the joystick to the right and the robot should turn right (left wheels forward and right wheels reverse). If not, put a minus in front of the joystick.GetX().
  • Similarly, for strafe, correct the corresponding joystick sign if it is not going the direction you want.
__________________

Last edited by mikets : 13-03-2012 at 16:07.
Reply With Quote