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

!HELP! Motors are not moving at the speeds needed
http://robotc.net/forums/viewtopic.php?f=52&t=1082
Page 1 of 1

Author:  ai8643 [ Thu Jan 08, 2009 4:41 pm ]
Post subject:  !HELP! Motors are not moving at the speeds needed

Our robot is having some problems and I dont know if the problem is with the programing or with how i have set up the wiring. This is the code i have on the Robot C, and im running on the latest update.

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  HTMotor,  none)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C3_1,     motorF,        tmotorNormal, openLoop)
#pragma config(Motor,  mtr_S1_C3_2,     motorG,        tmotorNormal, openLoop)
#pragma config(Servo,  servo1,          serv1,                tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
   getJoystickSettings(joystick);

  while(joystick.StopPgm)
   {

    getJoystickSettings(joystick);
      wait1Msec(50);

   motor[motorD] = -50;
   motor[motorE] = -50;
   wait1Msec(2000);

   motor[motorD] = 0;
   motor[motorE] = 50;
   wait1Msec(500);

   motor[motorD] = 50;
   motor[motorE] = 0;
   wait1Msec(500);
   
   motor[motorF] = 25;
   motor[motorG] = 25;
   wait1Msec(500);

   motor[motorF] = -25;
   motor[motorG] = -25;
   wait1Msec(500);

   motor[motorF] = 0;
   motor[motorG] = 0;
   wait1Msec(1000);

   motor[motorD] = 0;
   motor[motorE] = 0;
   wait1Msec(1000);

   motor[motorD] = 100;
   motor[motorE] = 100;
   wait1Msec(2500);

   motor[motorD] = 0;
   motor[motorE] = 0;

   motor[motorD] = -100;
   motor[motorE] = -100;
   wait1Msec(2500);

   motor[motorD] = 0;
   motor[motorE] = 0;
}

   while (true)
  {
    getJoystickSettings(joystick);
    motor[motorD] = joystick.joy1_y1;
    motor[motorE] = joystick.joy1_y2;

      if(joy1Btn(1))
      {
         motor[motorA] = 100;
         motor[motorB] = 100;
      }
      else
      {
         motor[motorA] = 0;
         motor[motorB] = 0;
     }
      if(joy1Btn(3))
      {
         motor[motorB] = -100;
         motor[motorA] = -100;
      }
      else
      {
         motor[motorB] = 0;
         motor[motorA] = 0;
      }
      if(joy1Btn(8))
      {
         motor[motorF] = 100;
      }
      else
      {
         motor[motorF] = 0;
     }
      if(joy1Btn(6))
      {
         motor[motorF] = -100;
      }
      else
      {
         motor[motorF] = 0;
      }
      if(joy1Btn(7))
      {
         motor[motorG] = 100;
      }
      else
      {
         motor[motorG] = 0;
     }
      if(joy1Btn(5))
      {
         motor[motorG] = -100;
      }
      else
      {
         motor[motorG] = 0;
     }
           if (joy1Btn(4))
      {
      servo[serv1] = -180;
    }
    else
    {
      servo[serv1] = -15;
    }
    if (joy1Btn(2))
      {
      servo[serv1] = 180;
    }
    else
    {
      servo[serv1] = -180;
      }
   }
}


Motor D and E are the ones used for the wheels and they work just fine. But Motors F and G are for the Arm going up and down and Arm extender to make the arm longer, these two motors go really slow no matter at what speed I put onto the program. We have the motors set up onto two hitecnic controllers and are both connected to the port labeled S1.
Any help would be appreciated and thanks in advance.

Author:  Sunny1261 [ Thu Jan 08, 2009 6:53 pm ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

Try a simple code to ensure that your motors truly work, and then reply back to confirm it. It could be a problem with the motors.

Author:  Jeff McBride [ Thu Jan 08, 2009 7:28 pm ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

Do the arm motors make a loud humming noise while trying to move the arm? How heavy is it?

Author:  ai8643 [ Thu Jan 08, 2009 11:11 pm ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

its not the motors themselves, we have already switched them with the ones used for the wheels and they still run really slow, and i have even included the arms in the autonomous mode and they work as I would want them to(really fast) but for some reason when the autonomous mode ends the motors go back to being really slow, so its not an issue of weight.

Author:  hobbseltoff [ Fri Jan 09, 2009 2:28 pm ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

I've had this problem before, I solved it by going to the "Motors and Sensors Setup" windows, going to the "Motors" tab and un-checking "PID Control" next to the affected motors. You might also have a bad battery for your motor controller.

Author:  ai8643 [ Fri Jan 09, 2009 3:53 pm ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

its not the pid i already did that, doesn't anyone know anything

Author:  hobbseltoff [ Sun Jan 11, 2009 4:16 am ]
Post subject:  Re: !HELP! Motors are not moving at the speeds needed

Well you don't have to be rude about it.

I see what your problem is.

Code:
if(joy1Btn(8))
      {
         motor[motorF] = 100;
      }
      else
      {
         motor[motorF] = 0;
     }
      if(joy1Btn(6))
      {
         motor[motorF] = -100;
      }
      else
      {
         motor[motorF] = 0;
      }


Let's say in this chunk of code, you are holding down button 8. The first if statement will set the power of motorF to 100 like you want it to. However, since you are NOT pressing down button 6, the 2nd if statement will return false, setting your motor power back to zero. The same thing applies to motorG.

Here is how I would format it:
Code:
if(joy1Btn(8))
{
motor[motorF] = 100;
}
else if(joy1Btn(6))
{
motor[motorF] = -100;
}
else
{
motor[motorF] = 0;
}


Hope this helps.

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