ROBOTC.net forumshttp://www.robotc.net/forums/ Weird Autonomous Problems/Inability to use Competition Contrhttp://www.robotc.net/forums/viewtopic.php?f=11&t=3747 Page 1 of 1

Author:  Eddie [ Thu Nov 17, 2011 9:52 pm ]
Post subject:  Weird Autonomous Problems/Inability to use Competition Contr

Problem 1:

1. Autonomous starts sucessfully
2. Checks a sensor to see if the value is less than the "max", if not, moves the arm up
3. For some reason the arm drops after ~1 second and then tries to raise again
4. Repeatedly does this

Code Example:
 Code:    int armVal = SensorValue[armPotentiometer];    while(armVal <= ARM_MAX)  {    armVal = SensorValue[armPotentiometer];        motor[elevLeft1] = 90;    motor[elevLeft2] = 90;    motor[elevRight1] = 90;    motor[elevRight2] = 90;   }

The problem is that the robot will never make it to the ARM_MAX variable and therefore will continue to move up a little bit and then drop. Does anyone know of a way to resolve this?

Problem 2:

2. Open VEX Competition Control in RobotC
3. Click "User Control"
4. Press start on the debugger window
5. Autonomous starts

I'm not too sure what an example code for this would be so I am not including one. It is just a basic autonomous that prints out to an LCD screen. Does anyone know of anyway to solve this?

 Author: magicode [ Thu Nov 17, 2011 10:10 pm ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C For problem number one:You can use a PID loop. There is sample code on how to do that on this forum and on the VEX forums. You should be able to find a good example if you look around. I have found however, that for just keeping an arm in position, a proportional loop works just fine. A proportional loop is less complicated than a PID loop, but it may produce slightly less accurate results. If you want an example of that, look on this page: http://www.vexforum.com/showthread.php?t=52387&page=2Problem number two: Are you sure that you have the correct competition template in your code?

 Author: Eddie [ Thu Nov 17, 2011 11:31 pm ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C I actually have a PID control that runs into the same problem. From the debugger it seems that the motor value is being zeroed each time it goes through the while. I temporarily replaced the PID with this to make sure that I hadn't just coded it wrong and the same problem arises with both.The competition template is the one found in RobotC v3.03The only changes that have been made are my adding code to autonomous and teleop.

 Author: magicode [ Thu Nov 17, 2011 11:53 pm ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C If your arm is very heavy, the motors could be overheating and tripping the PTC when they are bearing a lot of load, but that should only happen if they are under severe stress. Are you periodically disconnecting? Perhaps the movement of your arm causes some wires to temporarily disconnect? It's a more common problem than you would think.

 Author: Eddie [ Fri Nov 18, 2011 12:02 am ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C The arm works perfectly fine when I run only a simple teleop program that controls the arm. I am able to repeatedly lift and lower the arm with little to no problems at all. The arm itself is rather heavy but we have a lot of help from elastic tubing to help the arm. (It is extremely buoyant.)

 Author: magicode [ Fri Nov 18, 2011 12:10 am ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C I have one more suggestion, and then I'm out of ideas. What are your potentiometer values looking like? It is possible that your potentiometer is going out of range when your arm is going up, and then coming back into range when it drops. That would explain why it works during teleop and not during autonomous.

 Author: Eddie [ Fri Nov 18, 2011 12:14 am ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C The potentiometer reaches a minimum value of 2889 and a maximum value of 4010. The value scales the entire way there and never does anything "funky".

 Author: jbflot [ Fri Nov 18, 2011 10:08 am ] Post subject: Re: Weird Autonomous Problems/Inability to use Competition C I have actually seen some potentiometers where their value will "bounce". What I mean is that they may jump from 2300, briefly to 2500, then back to 2300.You might try to see if your sensor is bouncing... it may be why the arm stops raising prematurely and has to try again shortly after.

Author:  Eddie [ Mon Nov 21, 2011 9:36 pm ]
Post subject:  Re: Weird Autonomous Problems/Inability to use Competition C

Problem 1 was caused by an improperly tuned PID constant that went unnoticed. The solution to the competition control problem was to uninstall and then install RobotC. Thanks for the help.

We did pretty well at the competition. I was pretty angry at myself early in the morning as I forgot my flash drive at home with my complete autonomous on it and so I had to write a basic code there. We ended up losing 18-16 in the Finals.

Author:  magicode [ Mon Nov 21, 2011 9:55 pm ]
Post subject:  Re: Weird Autonomous Problems/Inability to use Competition C

Congrats on getting it to work.
 Eddie wrote:I was pretty angry at myself early in the morning as I forgot my flash drive at home with my complete autonomous on it and so I had to write a basic code there. We ended up losing 18-16 in the Finals.

This happened to me once, and from then on, I would always email myself the code the night before competition.

Author:  Littledrumer [ Wed Feb 05, 2014 1:50 pm ]
Post subject:  Re: Weird Autonomous Problems/Inability to use Competition C

 jbflot wrote:I have actually seen some potentiometers where their value will "bounce". What I mean is that they may jump from 2300, briefly to 2500, then back to 2300.You might try to see if your sensor is bouncing... it may be why the arm stops raising prematurely and has to try again shortly after.

I am having the same issue with the potentiometer values "bouncing." In robotc the potentiometer shows a value of 1500 and when it is counting down at a value of 1000 it will jump to a value of 248 then back to 1000 then continue counting down normaly!! Does anyone know of a fix?

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