Go to Post After assisting with the animation last year I realized how cool and useful Inventor was and I started flirting with it. Half a year later I think I have lost all possibility of ever having a girlfriend, and frankly I don't care because I would definately bare the child of this program. - negfrequency [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-03-2008, 19:32
Golto's Avatar
Golto Golto is offline
Registered User
AKA: Pat Plude
FRC #4572 (BArlow RobAutics)
Team Role: Mentor
 
Join Date: Oct 2006
Rookie Year: 2007
Location: Bethel, CT
Posts: 91
Golto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of light
IR not changing state or var

Hello everybody! I have an interesting dilemma!

I have mapped the IR board to Digital Input 1-4 on the RC, and called these to be read in Autonomous.

Now, When a button is pressed on the remote in Hybrid, the status of the variable won't change. Though if I am holding the button and reset the robot the variable changes?!

I do not believe that Autonomous is being called after the first routine. As in, I think it's just doing the default and kicking out, rather than looking for the variable.

I am including the code for the autonomous (I program in EasyC and am using the code box on the right to copy this, by hand, my laptop has not network.) I only copied 1 output code, the others are copied from the "IF (Out0 =1)" block, and modified for their function

Code:
#include "Main.h"

void Autonomous (void)
{
unsigned char Out0 = 0 //IR Output 0
unsigned char Out1 = 0 //IR Output 1
unsigned char Out2 = 0 //IR Output 2
unsigned char Out3 = 0 //IR Output 3
signed char count = 0 //Smart Counter

while (1 == 1)
{
  Out0 = GetDigitalInput (1);
  Out1 = GetDigitalInput (2);
  Out2 = GetDigitalInput (3);
  Out3 = GetDigitalInput (4);

  if (Out0 = 0)
  {
    if (Out1 = 0)
    {
      if (Out2 = 0)
      {
        if (Out3 = 0)
        {
          // ADD DRIVE CODE HERE
          for (count; count = 0; count ++)
          {
            Wait (300);
          }
          for (count; count = 1; count ++)
          {
            Wait (200);
          }
          for (count; count = 2; count ++)
          {
            Wait (200);
          }
          for (count; count = 3; count ++)
          {
            Wait (200);
          }
          for (count; count = 4; count ++)
          {
            Wait (1500);
          }
          for (count; count = 5; count ++)
          {
            Wait (500);
          }
          for (count; count = 6; count ++)
          {
            Wait (500);
          }
          for (count; count = 7; count ++)
          {
            //STOP HERE!
          }
        }
      }
    }
  }
  if (Out0 ==1) //Button 1 pressed
  {
    Out1 = 0;
    Out2 = 0;
    Out3 = 0;
    SetDigitalOutput (15, 1) // LED1 ON
    SetDigitalOutput (16, 0) //LED2 OFF
    SetDigitalOutput (17, 0) // LED 3 OFF
    SetDigitalOutput (18, 0) //LED4 OFF
    if (count <=3)
    {
      //SET RELAYS OFF!!!
      count = 4;
    }
   else
   {
      count = count;
    }
    break;
  }
}
//COPY OUT0 AND MODIFY FOR OTHER MODES

// END AUTO
}
__________________
  #2   Spotlight this post!  
Unread 05-03-2008, 23:47
SL8's Avatar
SL8 SL8 is offline
...
AKA: Jesus
FRC #0647 (Cyber Wolf Corps)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Killeen, Texas (Fort Hood)
Posts: 352
SL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud of
Send a message via Yahoo to SL8
Re: IR not changing state or var

I would like to help but I can not understnd what your code is supposed to do, could you clarify it?
__________________


  #3   Spotlight this post!  
Unread 06-03-2008, 00:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: IR not changing state or var

Your first few if statements are setting variables to zero instead of testing for being equal to zero. Replace the = 0 with == 0 to fix that.

I don't understand what the for statements are supposed to be doing. The initialization does nothing, and I suspect you've made the same = vs. == error in the continuation check.
  #4   Spotlight this post!  
Unread 06-03-2008, 05:48
Golto's Avatar
Golto Golto is offline
Registered User
AKA: Pat Plude
FRC #4572 (BArlow RobAutics)
Team Role: Mentor
 
Join Date: Oct 2006
Rookie Year: 2007
Location: Bethel, CT
Posts: 91
Golto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of lightGolto is a glorious beacon of light
Re: IR not changing state or var

Thanks.

The FOR statements are only to keep the counter time.

There is a 7-step autonomous that can be interrupted by the IR commands. The counter is so it can pick up where it left off.

Otherwise, I'll change the operators and cross my fingers!
  #5   Spotlight this post!  
Unread 06-03-2008, 13:56
SL8's Avatar
SL8 SL8 is offline
...
AKA: Jesus
FRC #0647 (Cyber Wolf Corps)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Killeen, Texas (Fort Hood)
Posts: 352
SL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud of
Send a message via Yahoo to SL8
Re: IR not changing state or var

Quote:
Originally Posted by Alan Anderson View Post
Your first few if statements are setting variables to zero instead of testing for being equal to zero. Replace the = 0 with == 0 to fix that.

I don't understand what the for statements are supposed to be doing. The initialization does nothing, and I suspect you've made the same = vs. == error in the continuation check.
You are probably correct, I can't believe I missed that. Everyone makes mistakes.
__________________


  #6   Spotlight this post!  
Unread 06-03-2008, 14:10
BHOP BHOP is offline
Registered User
FRC #0399 (Eagle Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2003
Location: CA
Posts: 62
BHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud of
Re: IR not changing state or var

I'm sure pretty your while loop isn't going to do anything because auto gets called in main.c every 26ms or so. so even though you are trying to get stuck in the while loop with 1==1, your not stuck because auto will just get called again.

I'm not entirely sure, but I think this is one problem. (I'm kinda new at this)
__________________
BHOP

ME CoE University of Michigan
503 Frog Force 830 Rat Pack
399 Eagle Robotics
  #7   Spotlight this post!  
Unread 06-03-2008, 15:48
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: IR not changing state or var

BHOP - easyC / WPILIB will only call the autonomous() function once when the field switches. Also, everything you do in easyC / WPILIB runs at full speed in the user processor. So, his while(1==1) will loop as fast as it can. Any commands going to the Master Processor ex. PWM/OI will sync every 26ms due to the nature of how the master processor is programmed by IFI. But, in this case all the inputs are tied directly to the user processor so the 26ms loop doesn't apply.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #8   Spotlight this post!  
Unread 06-03-2008, 16:45
BHOP BHOP is offline
Registered User
FRC #0399 (Eagle Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2003
Location: CA
Posts: 62
BHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud ofBHOP has much to be proud of
Re: IR not changing state or var

thanks for that info...i've never tried easyc
__________________
BHOP

ME CoE University of Michigan
503 Frog Force 830 Rat Pack
399 Eagle Robotics
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hawaii Gov. Lingle State of State speech-FIRST and STEM MoeMom FIRST In the News... 0 29-01-2008 17:04
Code not changing robots function! popo308 Programming 3 25-01-2008 11:17
OI digital inputs and Var res switches. Gdeaver Control System 1 16-10-2007 13:17
Encoders not changing... paulcd2000 Programming 28 18-02-2007 08:34
::CHANGING SERVERS:: Brandon Martus General Forum 5 21-12-2001 10:33


All times are GMT -5. The time now is 00:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi