|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
PWMs not outputting in Autonomous
Hello! I don't know if this question has been answered yet, but I didn't seem to find an answer anywhere.
When we are trying to run autonomous code, PWMs 1-12 aren't doing anything, and the speed controllers that are hooked up into those PWMs are blinking yellow. We think that the PWMs aren't being enabled, but we're not quite sure how to do that in the autonomous code. We have the drivetrain motors in PWMs 13-16, and those are working fine. Nothing else, however, will work. // If it might be part of the problem, we're using Kevin's streamlined code as a base. Please help as soon as possible! Thanks! |
|
#2
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Perhaps you deleted this line:
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */ which goes after Generate_Pwms |
|
#3
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Quote:
Anything else that might be the problem? Last edited by 937Programmers : 06-02-2007 at 21:32. |
|
#4
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Mind posting your User_Autonomous_Code?
|
|
#5
|
||||
|
||||
|
Re: PWMs not outputting in Autonomous
If you leave the robot in autonomous mode do you get a code error light?
|
|
#6
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Quote:
As for posting my code, I'll get to that ASAP. I should be able to get it up tomorrow. |
|
#7
|
|||||
|
|||||
|
Re: PWMs not outputting in Autonomous
Blinking yellow speed controllers usually indicate a connectivity problem with the signal...I'm assuming they work under human operation?
Are you calling something that might modify the PWM values before you call PutData()? Try printing out the values RIGHT before you PutData(). |
|
#8
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
I had the same problem with my motor output during autonomous. I changed the "Generate Pwms" function to his "PWM" function and everything worked. Hope the problem is as simple as that.
|
|
#9
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Make sure that your PWM outputs are not 127 by default. At the top of the autonomous loop, all the PWMs are set to 127 by default, this may have something to do with it.
|
|
#10
|
|||
|
|||
|
Re: PWMs not outputting in Autonomous
Well, all the motors work under human operation, and I haven't gotten around to messing with it yet today (I just got here
)Anyways, here's my autonomous function before modification today: Code:
void User_Autonomous_Code(void)
{
/* Initialize all PWMs and Relays when entering Autonomous mode, or else it
will be stuck with the last values mapped from the joysticks. Remember,
even when Disabled it is reading inputs from the Operator Interface.
*/
pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/* Add your own autonomous code here. */
// STEP 1 - Initialize the Camera
Tracking_Info_Terminal();
Camera_Handler();
Servo_Track();
if(Get_Tracking_State() >= TARGET_IN_VIEW)
{
// STEP 2 - Make Robot Face the Light
if((((int)PAN_SERVO-124)*65)/124 < 0)
{
pwm13 = pwm14 = 62;
pwm15 = pwm16 = 192;
centered = 0;
}
else if((((int)PAN_SERVO-124)*65)/124 > 0)
{
pwm13 = pwm14 = 192;
pwm15 = pwm16 = 62;
centered = 0;
}
else
{
pwm13 = pwm14 = pwm15 = pwm16 = 127;
centered = 1;
}
// STEP 3 - Drive Robot forward until 4 feet in front of Rack
if((((int)TILT_SERVO-144)*25)/50 < 67 && centered == 1)
{
pwm13 = pwm14 = pwm15 = pwm16 = 192;
}
if(centered == 1 && (((int)TILT_SERVO-144)*25)/50 >= 67)
{
pwm13 = pwm14 = pwm15 = pwm16 = 127;
// STEP 4 - Move the arm to the center position
if(counter < 624 && arminpos == 0)
{
pwm08 = 254;
counter++;
if(counter == 624)
{
arminpos = 1;
}
}
}
counter = 0;
// STEP 5 - Place the tube on the leg
if(arminpos == 1)
{
pwm13 = pwm14 = pwm15 = pwm16 = 192;
counter++;
if(counter == 26)
{
overdisk = 1;
pwm13 = pwm14 = pwm15 = pwm16 = 127;
}
if(counter < 208 && clawopen == 0)
{
pwm05 = 192;
if(overdisk == 1)
{
counter++;
}
}
if(counter == 208)
{
clawopen = 1; counter = 0; pwm05 = 127;
}
}
if(clawopen == 1)
{
pwm13 = pwm14 = pwm15 = pwm16 = 62;
}
// END AUTONOMOUS CODE
}
PWM(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
}
|
|
#11
|
||||
|
||||
|
Re: PWMs not outputting in Autonomous
[quote=937Programmers;574561]
PWM(pwm13,pwm14,pwm15,pwm16); In the line when you generate the pwm's, make sure that any pwm that you are using is included in that list. That should solve your problem |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Camera not working in autonomous | Roger | Programming | 9 | 09-03-2006 07:38 |
| Gyro not working in Autonomous? | kaszeta | Programming | 7 | 11-02-2006 01:28 |
| printf statements do not display in autonomous mode | PVC Pirates | Programming | 3 | 22-02-2005 15:41 |
| New to C but not to basic, need help on autonomous | cdennisxlx2 | Programming | 4 | 02-02-2005 03:38 |
| pwms 13 and 15 in autonomous mode | Chris Bright | Programming | 1 | 24-02-2004 22:25 |