View unanswered posts | View active topics It is currently Thu Jul 24, 2014 2:52 am






Reply to topic  [ 12 posts ] 
Weird Autonomous Problems/Inability to use Competition Contr 
Author Message
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post 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:

  1. Compile and download program
  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?

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Thu Nov 17, 2011 9:52 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post 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=2

Problem number two: Are you sure that you have the correct competition template in your code?

_________________
sudo rm -rf /


Thu Nov 17, 2011 10:10 pm
Profile
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post 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.03
The only changes that have been made are my adding code to autonomous and teleop.

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Thu Nov 17, 2011 11:31 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post 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.

_________________
sudo rm -rf /


Thu Nov 17, 2011 11:53 pm
Profile
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post 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.)

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Fri Nov 18, 2011 12:02 am
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post 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.

_________________
sudo rm -rf /


Fri Nov 18, 2011 12:10 am
Profile
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post 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".

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Fri Nov 18, 2011 12:14 am
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post 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.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Fri Nov 18, 2011 10:08 am
Profile
Rookie

Joined: Mon Mar 15, 2010 2:56 pm
Posts: 3
Post Re: Weird Autonomous Problems/Inability to use Competition C
RE your Problem 1: Arm drops after one second.
Since you didn't post the whole code, the problem could easily be somewhere else in your code.
Is power 90 enough to move the arm in the direction you want it to go?
Are the motors fighting each other?

You also don't explain clearly what you want the robot to do, and the overall situation; only that it is doing this 1sec lift and droop thing that you didn't expect. A better formatted question might prompt better responses.

I'll make a guess:
If you want to keep the arm at a certain position, while driving around, a while-loop that prevents any other motor settings while moving the arm, may not be the best way.

When you post to the Official RobotC help forum on Vexforum, its only Jbflot that can answer you there. You might try posting your whole code to the Community support, or tech forum there. Its most likely your coding problem is a logic problem, not a Robot-C specific problem, so posting to a more populated forum could help you out.
Good luck in your competition tomorrow. Maybe some other team can look at your whole code, and help you out.


Fri Nov 18, 2011 11:41 pm
Profile
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post Re: Weird Autonomous Problems/Inability to use Competition C
jgraber wrote:
RE your Problem 1: Arm drops after one second.
Since you didn't post the whole code, the problem could easily be somewhere else in your code.
Is power 90 enough to move the arm in the direction you want it to go?
Are the motors fighting each other?

You also don't explain clearly what you want the robot to do, and the overall situation; only that it is doing this 1sec lift and droop thing that you didn't expect. A better formatted question might prompt better responses.

I'll make a guess:
If you want to keep the arm at a certain position, while driving around, a while-loop that prevents any other motor settings while moving the arm, may not be the best way.

When you post to the Official RobotC help forum on Vexforum, its only Jbflot that can answer you there. You might try posting your whole code to the Community support, or tech forum there. Its most likely your coding problem is a logic problem, not a Robot-C specific problem, so posting to a more populated forum could help you out.
Good luck in your competition tomorrow. Maybe some other team can look at your whole code, and help you out.


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.

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Mon Nov 21, 2011 9:36 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post 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.

_________________
sudo rm -rf /


Mon Nov 21, 2011 9:55 pm
Profile
Rookie

Joined: Sun Apr 21, 2013 4:14 pm
Posts: 3
Post 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?


Wed Feb 05, 2014 1:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.