Go to Post THE GAME PIECES ARE BEARS - JohnSchneider [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-03-2012, 21:18
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
CPU usage 100% & twitchy robot?

When we enable our robot the code seems to run fine for a couple of seconds then it becomes twitchy and/or laggy. What I mean by twitchy is the light on the motor controllers flicker periodically and the motors controlled by joystick buttons do not respond quickly. Also, the CPU usage on the DS graph changes from 65% to 100% at the same time that the robot seems to become twitchy. In previous years we have had much larger code without problem.

In addition, when I put probes in the teleop vi the probes indicate that the code is running perfectly. However, the motors on the robot do not.

I have included a picture of our teleop code. Any ideas?
Attached Thumbnails
Click image for larger version

Name:	LabView Code_Teleop.jpg
Views:	71
Size:	5.2 KB
ID:	12211  
Reply With Quote
  #2   Spotlight this post!  
Unread 05-03-2012, 21:21
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: CPU usage 100% & twitchy robot?

The attached image is tiny, so I can't help much.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 05-03-2012, 21:38
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: CPU usage 100% & twitchy robot?

Here is a bigger picture.
Attached Thumbnails
Click image for larger version

Name:	LabView Code_Teleop_2.jpg
Views:	79
Size:	133.1 KB
ID:	12212  
Reply With Quote
  #4   Spotlight this post!  
Unread 05-03-2012, 21:43
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: CPU usage 100% & twitchy robot?

You can also attach a .vi file.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
Reply With Quote
  #5   Spotlight this post!  
Unread 05-03-2012, 21:44
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: CPU usage 100% & twitchy robot?

I don't think the behavior has much to do with the teleop code. To see how often it is being called, you may want to put the Elapsed Times VI into teleop. You can find it in the support folder in your project window.

I think the twitch is likely caused by the robot drive motors being updated less than every 100ms. The next issue is to find the code that runs so often or takes so long that it slows down teleop. One place to look is vision, the other is periodic tasks. Finally, Since I can't see the code run in the other case of the button 5 switch, it could be that it is sleeping for a long time and causing the issue, but I suspect this isn't the case.

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 05-03-2012, 21:55
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: CPU usage 100% & twitchy robot?

Your problem could also be caused by unhandled errors within your code - this often takes up a lot of CPU resources (the watchpuppies are a good example of this). On your driver station, go to the "Diagnostics" tab and look at the errors. If it's telling you about an error somewhere in your code, see how fixing it affects your robot response times.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #7   Spotlight this post!  
Unread 05-03-2012, 21:58
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: CPU usage 100% & twitchy robot?

Thanks for the help. I'm not at the shop to hook up to the test bot. I'll run the teleop code with the Elapsed time VI tomorrow. What should I be looking for? If it is not calling the teleop vi fast/slow enough what else should I look for?

PS- I attached a picture of button 5.
Attached Thumbnails
Click image for larger version

Name:	button 5.jpg
Views:	34
Size:	92.4 KB
ID:	12213  
Reply With Quote
  #8   Spotlight this post!  
Unread 05-03-2012, 22:11
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: CPU usage 100% & twitchy robot?

I'd check that all your refnums all match and are correct. That's a common error. And I'd check that your safety isn't tripping (like Greg suggested). Check for code that takes a long time to execute (one iteration of your Teleop VI should take ~20 ms, the amount of time it takes for a new DS packet to reach the robot).

And once you get access to your robot, if there's an error, the error message should tell you exactly what is wrong and which VI it's located in.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #9   Spotlight this post!  
Unread 05-03-2012, 23:30
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: CPU usage 100% & twitchy robot?

I don't think your bridge manipulator motor is going to work the way you want it to. You're setting it in two places, and the second one (on the right) is going to win.
Reply With Quote
  #10   Spotlight this post!  
Unread 06-03-2012, 01:27
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: CPU usage 100% & twitchy robot?

Quote:
Originally Posted by Alan Anderson View Post
I don't think your bridge manipulator motor is going to work the way you want it to. You're setting it in two places, and the second one (on the right) is going to win.
Actually, we can't know which one will win: They are not dependent on each other, since the motor ref branches before the set vis. In the purist analysis, either one can fire first and their firing order could be "randomly" re-chosen each iteration. In reality, the optimizer might clump those two commands in an arbitrary order determined at compile time. The "winning" set will still be "randomly" chosen as the fpga timing interacts with the CPU timing, though one will be heavily favored over the other.

Regardless, the result will be a twitchy bridge manipulator. It will toggle between the two set commands unpredictably.


My prediction is that you actually have two problems: The twitchiness is caused by the two set commands racing eachother, and your CPU is being pegged to 100% by a separate error (likely a while loop with no wait in it).
Reply With Quote
  #11   Spotlight this post!  
Unread 06-03-2012, 01:37
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: CPU usage 100% & twitchy robot?

Quote:
Originally Posted by EricVanWyk View Post
Actually, we can't know which one will win: They are not dependent on each other, since the motor ref branches before the set vis.
Oops, you're right. I thought the device reference went from the output of one to the input of the other. I guess I was distracted by the odd placing of the functions, with a bunch of right-to-left wires running along with the left-to-right ones.
Reply With Quote
  #12   Spotlight this post!  
Unread 06-03-2012, 22:29
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: CPU usage 100% & twitchy robot?

Rookie Mistake!

Phil you were right. We named two of our motors with the same refnum name. DUH!

Alan- We did have to fix the bridge manipulator motor.

We are new to programming and rely on this forum to get a robot running.

Thanks for the help
Reply With Quote
Reply


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 22:06.

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