View unanswered posts | View active topics It is currently Thu Dec 05, 2013 11:09 am

 Page 1 of 1 [ 11 posts ]
 Print view Previous topic | Next topic
Weird Autonomous Problems/Inability to use Competition Contr
Author Message
Rookie

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

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

Thu Nov 17, 2011 9:52 pm
Moderator

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

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

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

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

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

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

Joined: Tue May 15, 2007 9:02 am
Posts: 399
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
ROBOTC Support

Fri Nov 18, 2011 10:08 am
Rookie

Joined: Mon Mar 15, 2010 2:56 pm
Posts: 3
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.

Fri Nov 18, 2011 11:41 pm
Rookie

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

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

Mon Nov 21, 2011 9:36 pm
Moderator

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 11 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    CS2N Robot Virtual Worlds Competitions       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014       2013 Robotics Summer Of Learning          VEX Toss Up Programming Challenge          FTC Ring It Up! Programming Challenge    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions    Robotics Merit Badge Robotics Discussions    General Discussions    Project Discussions International Forums    Spanish Forums       ROBOTC for MINDSTORMS       ROBOTC for VEX    French Forums       ROBOTC pour Mindstorms       ROBOTC pour IFI VEX    Japanese Forums （日本語のフォーラム） Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC