View unanswered posts | View active topics It is currently Thu Aug 21, 2014 10:29 pm






Reply to topic  [ 7 posts ] 
Tetrix Motor... Shaking? 
Author Message
Rookie

Joined: Thu Oct 06, 2011 6:37 pm
Posts: 9
Post Tetrix Motor... Shaking?
Today, while programing our Tele-Op mode, I was testing the movement motors. About half-way through the hour, whenever I would run the program, whenever I would use the Joystick, It would move, but not in a "flowing" motion. It would "shake" as it was moving. In the Joystick Debugger, I clicked "Audible Feedback" and the NXT played a tone - but it was not constant. It sounded a bit like Morse Code!

Thanks, and any help will be great!!!


Fri Dec 02, 2011 6:28 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Tetrix Motor... Shaking?
Unless we see your code, it's kind of hard to help you. If you post it we'll have a look.

_________________
sudo rm -rf /


Fri Dec 02, 2011 6:34 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Tetrix Motor... Shaking?
It sounds like you are losing wireless connection. Check the global variable bDisconnected. If it ever becomes true, you have lost connection. That will zero out the whole joystick structure (except for a certain fields). In that case, your drive motors will be off since the axes of the joystick will become all zero.


Fri Dec 02, 2011 8:50 pm
Profile
Rookie

Joined: Thu Oct 06, 2011 6:37 pm
Posts: 9
Post Re: Tetrix Motor... Shaking?
Hello again!

More information:

-The brick is wired with a USB cord into our computer.
-Even the most basic Joystick programs are not working, but I will attach our code.
- we completely eliminated the second joystick, by not activating the dual controller, and working on one only, which did work.
Here is some code!

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  HTMotor,  HTMotor)
#pragma config(Motor,  mtr_S1_C1_1,     tread_left,    tmotorNormal, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     belt_left,     tmotorNormal, PIDControl, encoder)
#pragma config(Motor,  mtr_S1_C3_1,     tread_right,   tmotorNormal, openLoop)
#pragma config(Motor,  mtr_S1_C3_2,     belt_right,    tmotorNormal, PIDControl, reversed, encoder)
#pragma config(Motor,  mtr_S1_C4_1,     crane_arm,     tmotorNormal, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C4_2,     crane_lift,    tmotorNormal, openLoop, encoder)
#pragma config(Servo,  srvo_S1_C2_1,    tray_top,             tServoStandard)
#pragma config(Servo,  srvo_S1_C2_2,    extender_right,       tServoStandard)
#pragma config(Servo,  srvo_S1_C2_3,    extender_left,        tServoStandard)
#pragma config(Servo,  srvo_S1_C2_4,    magnetic,             tServoStandard)
#pragma config(Servo,  srvo_S1_C2_5,    crane,                tServoStandard)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
CONTROLLER ASSIGNMENTS:
  Controler I (Driver)
    Left Joystick
      Y Axis: tread_left/crane_arm
    Right Joystick
      Y Axis: tread_right/crane_lift
    Button 5: Hold down to enable crane_arm (during crane mode)
    Button 6: Nitro boost
    Button 9: Change Joystick Mode
  Controller II (Assistant)
    Right Joystick:
      Y Axis: Conveyor Belts (both synced)
    Button 2: Top Tray Closed
    Button 4: Top Tray Open
    TopHat 0: Front Extenders Down
    TopHat 4: Front Extenders Up
*/

// CONFIG [start]
int throttle = 20;
int cranemode = 0;
int cranearmpwr = 20;
int craneliftpwr = 25;
  // SERVO CONFIG [start]
  // 0 = FIRST POSITION (IN, DISABLED, OR CLOSED)
  // 1 = SECOND POSITION (OUT, ENABLED, OR OPEN)
  int srvcrane0 = 0;
  int srvcrane1 = 255;
  int srvextendersL0 = 0;
  int srvextendersL1 = 255;
  int srvextendersR0 = 255;
  int srvextendersR1 = 0;
  int srvtoptray0 = 0;
  int srvtoptray1 = 255;
  int srvmagnetic0 = 0;
  int srvmagnetic1 = 255;
  // SERVO CONFIG [end]
// CONFIG [end]

int nitro=throttle;
int srvextenders=4;
int J1Btn9=0;

#include "JoystickDriver.c"       // call joystick driver

task main()
{
  while(true)
  {
    getJoystickSettings(joystick);      // get joystick settings
// CONTROLLER I (DRIVER) [start]
    if(joy1Btn(9) == 0) {J1Btn9 = 0;}     // if Button 9 is not pressed reset count to 0
    if(joy1Btn(9) == 1) {J1Btn9++;}       // if Button 9 is pressed add 1 to count
    if(J1Btn9 == 1)                      // if and only if J1Btn9 count is 1 then:
      {
        if(cranemode == 0) {cranemode=2;}       // if cranemode is off switch it on using Triangle Method
        if(cranemode == 1) {cranemode=0;}       // if cranemode is on switch it off
        if(cranemode == 2) {cranemode=1;}       // if Triangle Method has a temporary value, switch cranemode on
      }
    if(cranemode == 0)          // if cranemode is off then turn on Driving Mode
    {
      if(joy1Btn(6) == 1)       // if Button 6 is pressed NITRO on (play tone)
      {
        if(nitro == throttle)
          {
            PlayTone(174.61, 10);
            PlayTone(261.63, 10);
            PlayTone(349.23, 10);
           }
       nitro = 100;
      }
       if(joy1Btn(6) == 0)      // if Button 6 is not pressed NITRO off (play tone)
      {
           if(nitro == 100)
          {
            PlayTone(349.23, 10);
            PlayTone(261.63, 10);
            PlayTone(174.61, 10);
           }
       nitro = throttle;
      }
    motor[tread_right] = nitro*(joystick.joy1_y2/100);  // move motor according to corresponding joystick
    motor[tread_left] = nitro*(joystick.joy1_y1/100);   // move motor according to corresponding joystick
    }
    if(cranemode == 1)                                  // if cranemode is on then turn off Driving Mode
    {
      if(joy1Btn(5) == 1) {motor[crane_arm] = cranearmpwr*(joystick.joy1_y1/100);}
      motor[crane_lift] = craneliftpwr*(joystick.joy1_y2/100);}
    }
// CONTROLLER I (DRIVER) [end]
// CONTROLLER II (ASSISTANT) [start]

     motor[belt_left] = joystick.joy2_y2;
     motor[belt_right] = joystick.joy2_y2;

     if(joy2Btn(2) == 1) {servo[tray_top] = 255;}        // If Button 1 is pressed, open top tray servo
     if(joy2Btn(4) == 1) {servo[tray_top] = 0;}          // If Button 2 is pressed, close top tray servo
     if(joystick.joy2_TopHat == 0) {srvextenders = 0;}   // If TopHat 0 is pressed, set extender servos to go in
     if(joystick.joy2_TopHat == 4) {srvextenders = 4;}   // If TopHat 4 is pressed, set extender servos to go out
     if(srvextenders == 0)                        // If extender servos are set to move out:
     {
       servo[extender_left] = srvextendersL1;     // Move left extender down and out
       servo[extender_right] = srvextendersR1;    // Move right extender down and out
     }
     if(srvextenders == 4)                        // If extender servos are set to move in:
     {
       servo[extender_left] = srvextendersL0;     // Move left extender up and in
       servo[extender_right] = srvextendersR0;    // Move right extender up and in
     }
// CONTROLLER II (ASSISTANT) [end]
}


Thank you so much, as we have tried everything we know how to do!

Thanks,
-Christian


Mon Dec 05, 2011 3:39 pm
Profile
Rookie

Joined: Thu Oct 06, 2011 6:37 pm
Posts: 9
Post Re: Tetrix Motor... Shaking?
****UPDATE*****

After further testing, we have started to have the "shaking" problem while using one controller. Also, we have updated RobotC and our firmware on our NXT, yet we are still having a problem. Any ideas will be extremely appreciated.

Thanks a MILLION!
-Christian


Tue Dec 06, 2011 3:09 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Tetrix Motor... Shaking?
If the shaking happens regardless of the joystick, does it also happen anytime in autonomous? If so, that could possibly mean a bad motor controller. Have you tried switching the motor controller out?

_________________
sudo rm -rf /


Tue Dec 06, 2011 4:11 pm
Profile
Rookie

Joined: Fri Apr 15, 2011 10:29 am
Posts: 37
Post Re: Tetrix Motor... Shaking?
christianik1407 wrote:
****UPDATE*****

After further testing, we have started to have the "shaking" problem while using one controller. Also, we have updated RobotC and our firmware on our NXT, yet we are still having a problem. Any ideas will be extremely appreciated.

Thanks a MILLION!
-Christian


Humor me for a second. Bring up the debugger windows, and verify that there is only one "Joystick" window enable. (Make sure that both Joystick - Basic and Joystick - FTC) aren't both selected.

Note, due to bugs in RobotC, the joystick window may not show up on the screen. When both joystick debug windows are selected, they 'fight' each other.

Nate - Student of the hard-knocks school of knowledge.


Tue Dec 06, 2011 9:42 pm
Profile
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.