View Single Post
  #1   Spotlight this post!  
Unread 06-11-2010, 18:01
rzoeller rzoeller is offline
MN GOFIRST Recruitment Officer
AKA: Ryan Zoeller
FRC #2169 (RI3D 'Snow Problem; KING TeC)
Team Role: Alumni
 
Join Date: Nov 2009
Rookie Year: 2007
Location: Savage, MN
Posts: 111
rzoeller is a jewel in the roughrzoeller is a jewel in the roughrzoeller is a jewel in the rough
Re: [FTC]: Not Deadbands now.....speed limits

To circumvent the double compile problem (I have experienced it as well), use a different name for each version. You should do this anyways, but just tag it with a version number and it will update correctly.

One solution to the other problem is to use a parabolic system, demonstrated by the code below.
Code:
#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.
void initializeRobot()
{
  return;
}
void scaleMotor(char motorname, int joyVal)
{
  int sign = joyVal / abs(joyVal); //Returns a 1 or -1
  float ratio = ((joyVal * joyVal) / (16129)); //Gets a ratio from a parabolic curve
  int scaledVal = (sign * 100) * ratio;
  motor[motorname] = scaledVal;
}

task main()
{
  initializeRobot();

  waitForStart();   // wait for start of tele-op phase
  while (true)
  {
    getJoystickSettings(joystick);
    scaleMotor(DriveL, joystick.joy1_y1);
    scaleMotor(DriveR, joystick.joy1_y2);
  }
}
You add if statements to that to limit when it will scale the motors, I.E. below 75%.
__________________
Ri3D - 'Snow Problem Programmer
MN GOFIRST Recruitment Officer
FRC 2169 Alumni
Reply With Quote