View unanswered posts | View active topics It is currently Thu Oct 23, 2014 9:49 am






Reply to topic  [ 7 posts ] 
!HELP! Motors are not moving at the speeds needed 
Author Message
Rookie

Joined: Thu Jan 08, 2009 4:19 pm
Posts: 7
Post !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.


Thu Jan 08, 2009 4:41 pm
Profile
Novice

Joined: Thu Oct 09, 2008 7:58 pm
Posts: 79
Post 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.


Thu Jan 08, 2009 6:53 pm
Profile
Professor

Joined: Fri Sep 19, 2008 1:22 am
Posts: 200
Post 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?

_________________
Jeff McBride
Benson Robotics Club


Thu Jan 08, 2009 7:28 pm
Profile
Rookie

Joined: Thu Jan 08, 2009 4:19 pm
Posts: 7
Post 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.


Thu Jan 08, 2009 11:11 pm
Profile
Rookie

Joined: Thu Jan 08, 2009 7:51 pm
Posts: 25
Post 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.

_________________
It must be user error.


Fri Jan 09, 2009 2:28 pm
Profile WWW
Rookie

Joined: Thu Jan 08, 2009 4:19 pm
Posts: 7
Post Re: !HELP! Motors are not moving at the speeds needed
its not the pid i already did that, doesn't anyone know anything


Fri Jan 09, 2009 3:53 pm
Profile
Rookie

Joined: Thu Jan 08, 2009 7:51 pm
Posts: 25
Post 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.

_________________
It must be user error.


Sun Jan 11, 2009 4:16 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.