View unanswered posts | View active topics It is currently Tue Sep 02, 2014 11:47 am






Reply to topic  [ 3 posts ] 
General Motor Issue 
Author Message
Rookie

Joined: Thu Mar 01, 2012 9:11 pm
Posts: 6
Post General Motor Issue
Our team recently began testing out different components and evaluating them to determine which ones do their jobs the best and will be mounted on the robot. I used this code to test the crane arm, to be sure the motor could lift the load.
Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  motorA,          claw,          tmotorNXT, PIDControl, encoder)
#pragma config(Motor,  mtr_S1_C1_1,     craneM,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     motorB,   tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C2_1,    pivotS,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

}

task main()
{
while(true)
   {
if(joy1Btn(4))
{
motor[craneM]=100;
}
else
{
motor[craneM]=0;
}
if(joy1Btn(2))
{
motor[craneM]=-50;
}
else
{
motor[craneM]=0;
}
}
}

But the motor doesn't event try to turn. There is no audible hum, nothing. I've tested the motor works, the motor controllers are fine, the cables are fine, which leaves a programming error. What can I do to fix this?


Mon Jan 14, 2013 6:36 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: General Motor Issue
Yep, there's a programming error I see. Lets step through your code, and you'll see what it is. Here's some simple pseudo-code to start with:
Code:
while(true){
  if(button 1 is pressed){
    motor = 100;
  else{
    motor = 0;
  }
  if(button 2 is pressed){
    motor = -50;
  }
  else{
    motor = 0;
  }
}


What power will the motor run at if you press button 1? What about button 2? Calculate the power, just like the processor would, and I think you'll see the error.

_________________
sudo rm -rf /


Mon Jan 14, 2013 8:09 pm
Profile
Rookie

Joined: Thu Mar 01, 2012 9:11 pm
Posts: 6
Post Re: General Motor Issue
Oh, I see now, double negative feedback for double failure. Unless both buttons are pressed but then the commands would still conflict. Thanks so much!


Mon Jan 14, 2013 8:54 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.