ROBOTC.net forums
http://robotc.net/forums/

Trouble getting gradual turning
http://robotc.net/forums/viewtopic.php?f=52&t=854
Page 1 of 1

Author:  alxmarcond [ Sat Oct 25, 2008 10:03 am ]
Post subject:  Trouble getting gradual turning

we have been able to get the robot to turn on point with the program at the end but what we want to be able to do is turn gradually using only one wheel. Its really time consuming of those 2 min we have to do on point turns every time. The button press requirement is to compensate for the lack of our controllers accuracy when coming back to zero. That is another problem, we would like to get rid of the button pressing so if anyone can tell use how to redefine zero we would deffinantly like to know! the following are our two programs, the first is our current one with the button pressing and the working point turn. The second is an expiramental program that we were trying to redefine zero and it didnt work :/

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
  while(true)
  {
     getJoystickSettings(joystick);
    if (joystick.joy1_Buttons == 32)
  {
    motor[motorD] = joystick.joy1_y1;
    motor[motorE] = joystick.joy1_y2;
  }
  else
  {
  motor[motorD] = 0;
  motor[motorE] = 0;
  }
  }
}



Program 2

Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Motor,  motorA,          ,              tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C2_1,     ,              tmotorNone, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     ,              tmotorNone, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    servoA,               tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{

  while (true)
{
   getJoystickSettings(joystick);
   motor[motorE] = joystick.joy1_y2;
    if (-5 < (joystick.joy1_y1) < 0)
    {
       motor[motorD] = 0;
    }
    else
    {
       motor[motorD] = joystick.joy1_y1;
    }
    //motor[motorD] = joystick.joy1_y1;
    motor[motorE] = joystick.joy1_y2;
   // if ((joystick.joy1_y1) > -5)
   // {
   //    motor[motorD] = 100;
   // }
   // else
   // {
   //    motor[motorD] = joystick.joy1_y1;
   // }
}
    //else
    //{
      //  motor[motorE] = joystick.joy1_y2;
    //}
    //if (joystick.joy1_y2) = (5,-5)
    //{
    //  motor[motorD] = 0;
    //}
    //else
    //{
      //  motor[motorE] = joystick.joy1_y2;
    //}

  //}
//}
}

Author:  tfriez [ Wed Oct 29, 2008 3:48 pm ]
Post subject:  Re: Trouble getting gradual turning

I'm not sure how you're going to "redefine zero".

You might want to look at the "dead band" code and the "single joystick drive" code available here on the forums for some more assistance.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/