Go to Post I like how the photo is of John Neun, and everyone is still making fun of John V-Neun - Jay Trzaskos [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 14-02-2013, 08:50
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,513
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Single Motor Teleop/Autonomous being quirky.

It causes no end of problems in LabView when people use multiple set motor outputs in different locations.

My suggestion is to have your set motor outputs in Autonomous and Teleop, because you know they never operate concurrently. Have a global variable set the output. Then, set the value of that global variable in the periodic task loop.

Likewise, never set a global variable in more than one place at one time. You can set them in teleop and in auton. Or you can set them in periodic tasks. But you should not set them in teleop AND periodic, and you should never set them in auton AND periodic. You will inevitably run into race conditions if you set a global in 2 vi's that are running at the same time.
  #2   Spotlight this post!  
Unread 14-02-2013, 13:58
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,112
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: Single Motor Teleop/Autonomous being quirky.

I noticed a couple of oddities in your code that probably aren't related to anything you're having problems with, but they still should be addressed.

You have some confusion in the labeling of your drive motors when you open them in Begin. Two of the motors are labeled simply "Left Motor", and the other two are labeled simply "Right Motor". But one of the left ones is connected to the Rear Right Motor input, and one of the right ones is connected to the Front Left Motor input.

In Periodic Tasks, you have moved the Compressor Control Loop code from its default location and put it inside a While loop. The CCL itself is a neverending While loop. If you open it up and look at its front panel, you'll find this comment:
This VI loops and doesn't return.
Placing it into another loop will
prevent that loop from iterating.

Periodic tasks is a good location for it.
Take it back out of the While loop and leave it where it was to begin with, outside any other loops.
  #3   Spotlight this post!  
Unread 16-02-2013, 00:36
Arkamond Arkamond is offline
Registered User
FRC #3102
 
Join Date: Jan 2013
Location: Minnesota
Posts: 23
Arkamond is an unknown quantity at this point
Talking Re: Single Motor Teleop/Autonomous being quirky.

Tom Line's solution worked well. Using two "Global Variables" fixed my issues almost entirely! Although I could only put the "Motor Set-Output" in Teleop, putting the Firing mechanism Case Structure would make the Motor turn off and then back on after it was done. So I put a global variable in Teleop that is only enabled in Teleop and then compares that to a function of "Enabled?" on an "Equals?" gate in Periodic Tasks to the boolean that controls the Case Structure of the firing mechanism. Both Autonomous and Teleop work fine and there's no major issues except that the driver station still reports that the drive system isn't running "fast enough", although it still drives. I've tried a lot to fix this, but I just can't figure out how.

There's still some small quirks, though. If Autonomous is enabled in the middle of a function of the firing function in Teleop, it sticks and shuts off everything else unless the robot is re-booted. I have no idea what could be causing this, as it's an anomoly that is most likely hidden underneath many operations colliding that I do not have the experience to detect.

-If anybody would be willing to look over my programming thoroughly and suggest what can be fixed/fix it themselves, I would be greatly appreciative. All of the major functions work, but I want to learn more about these types of issues and how to prevent them/what would cause them. (Plus it would add to my "solution" response on my original post for whoever has this same issue)

Here is the latest code that works:
Self-Extracting 7-Zip Archive
7-Zip Archive
Zip Archive

Thanks to everybody who has helped! I really do appreciate it.
  #4   Spotlight this post!  
Unread 15-02-2013, 01:58
Arkamond Arkamond is offline
Registered User
FRC #3102
 
Join Date: Jan 2013
Location: Minnesota
Posts: 23
Arkamond is an unknown quantity at this point
Re: Single Motor Teleop/Autonomous being quirky.

Quote:
Originally Posted by Tom Line View Post
It causes no end of problems in LabView when people use multiple set motor outputs in different locations.

My suggestion is to have your set motor outputs in Autonomous and Teleop, because you know they never operate concurrently. Have a global variable set the output. Then, set the value of that global variable in the periodic task loop.

Likewise, never set a global variable in more than one place at one time. You can set them in teleop and in auton. Or you can set them in periodic tasks. But you should not set them in teleop AND periodic, and you should never set them in auton AND periodic. You will inevitably run into race conditions if you set a global in 2 vi's that are running at the same time.
This fixed my issue completely. I set the the latch gate which use to go to the Set-output in Period Tasks, to go to a custom global variable using a Boolean T/F function to set the output of Enabled or Disabled to the Global Variable, in accordance to whether the Boolean was True or False.
The Global variable was read in Teleop and lead to an "Equals?" gate that when both outputs are "enabled" it outputs a true Boolean which goes to a Boolean T/F Function and to the motor output node for values of 0 when False and -1 when True.

Although, the sequence structure inside the case structure that is used for firing in Teleop would turn off the motor whenever it ran because both of them in Teleop would overpower it. So I moved it back to the Period Tasks loop and used an "and" gate and a Global Variable that is written in Teleop as Enabled to go to the And gate and only send a true when it is set as enabled. So no Solenoid Set-Outputs or Motor Set-Outputs are conflicting with the ones in Autonomous and all is working well.

The only thing I'm questioning though, is all the programming correct and efficient? I don't have the experience to tell currently, I only know that it works, but I want it to be the best it can be programmicly. If anybody would have any suggestions as to what could be done better, please say so!
(I'l change some other small things later, I'm talking about larger functions and ways of doing them)

Here is the code that works:
Self Extracting 7-Zip Archive
7-Zip Archive
Zip Archive
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


All times are GMT -5. The time now is 01:37.

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