Go to Post Build season can't come soon enough. - Ryan Dognaux [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, 00:47
Arkamond Arkamond is offline
Registered User
FRC #3102
 
Join Date: Jan 2013
Location: Minnesota
Posts: 23
Arkamond is an unknown quantity at this point
Exclamation Single Motor Teleop/Autonomous being quirky.

Status: Unsolved

Background Information:
I am in an FRC team and am the lead programmer and an electrical designer/engineer.

Specs:
FRC NI cRIO II
Labview 2012(13) with latest update
2Go PC D12 Rugged, Driver Station
2x Thrustmaster T.Flight Stick X Joystick
4x Victor 888 (Drive system)
1x Jaguar (Launching Motor)

Issue:
-"Custom Teleop" is a loop in Periodic Tasks.vi that should only function in Teleop and does all the major functions except for driving.

Motor Controller is not being outputted to properly from Autonomous or Teleop. I spent the last 4 hours debugging with no clear solution to my issues, although it's probably something obvious in my programming that is causing this issue.

The Jaguar controller is outputted for half a second before it automatically flips off in Autonomous. In Teleop, only every other "enable" to the robot from the driver station in Teleop will allow the motor to be turned on via Joystick button. On the other times, the Jaguar turns on then blinks red and then goes back to being turned off, a couple clicks later and it then works, but it's still a large issue.

This issue is seemed to be cause only after I caused a value of -1 to the motor controller in Autonomous, but before that, whenever the motor was running in the Periodic Tasks custom Teleop loop, it would shut off whenever the case structure to the right of it would start, and then it would start back up. I'm not entirely sure on what is wrong, but that is why I post before you today.

Tl;dr, Motor controller turns on then off very quickly in Autonomous, blinks red in Custom Teleop and with Autonomous fixed; the the motor in Custom Teleop turns off when the sequence structure executes and then on again after it's done.

Custom Teleop: Motor/Firing Case Structure/Sequence Structure


Autonomous


Here is my Robot Project Code, I put it in multiple formats to make it easier for people. Each archive contains the same exact files.

Self-Extracting 7-Zip Archive

7-Zip Archive
Zip Archive

If anybody would like to help me personally, rather than a forum, please PM me. I will answer any questions if anybody wants/needs more information, ask away! Thanks.
  #2   Spotlight this post!  
Unread 14-02-2013, 06:25
rwood359 rwood359 is offline
Registered User
AKA: Randy
FRC #0359 (Hawaiian Kids)
Team Role: Mentor
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Waialua, HI
Posts: 212
rwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to all
Re: Single Motor Teleop/Autonomous being quirky.

It looks like you are trying to control LMotor1 using both Autonomous and Periodic Tasks at the same time. Autonomous will set LMotor1 to -1. Within 100 ms, Periodic Tasks will set LMotor1 to 0 or -1 depending on the state going into the selector.
__________________
  #3   Spotlight this post!  
Unread 14-02-2013, 08:41
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 rwood359 View Post
It looks like you are trying to control LMotor1 using both Autonomous and Periodic Tasks at the same time. Autonomous will set LMotor1 to -1. Within 100 ms, Periodic Tasks will set LMotor1 to 0 or -1 depending on the state going into the selector.
Any way to fix this? Maybe a Case structure that is hooked up to the global node of "Robot Mode" global variable with the loop put inside of that?
  #4   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,509
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.
  #5   Spotlight this post!  
Unread 14-02-2013, 12:17
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,544
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Single Motor Teleop/Autonomous being quirky.

Quote:
Originally Posted by Arkamond View Post
The Jaguar controller is outputted for half a second before it automatically flips off in Autonomous. In Teleop, only every other "enable" to the robot from the driver station in Teleop will allow the motor to be turned on via Joystick button. On the other times, the Jaguar turns on then blinks red and then goes back to being turned off, a couple clicks later and it then works, but it's still a large issue.
Can you describe the speed at which the jaguar blinks red? It may be a high current shutdown. Your mechanism may be right on the edge of tripping it at startup.
  #6   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.
  #7   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
  #8   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.
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 11:02.

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