Go to Post If your robot doesn't work, it doesn't matter, because the robot is really meaningless, in the long run. What is the important thing, the reason we're all in FIRST then? To better our understanding of Science and Technology, and hopefully make the world a better place. - Ian W. [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 18-02-2014, 18:30
brunoUC's Avatar
brunoUC brunoUC is offline
Registered User
AKA: Bruno Toso
FRC #1156 (Under Control)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Novo Hamburgo, RS, Brasil
Posts: 23
brunoUC is an unknown quantity at this point
Exclamation Autonomous starving teleop?

Hello!

We have been using our robot normally in the last few days, but after integrating the automous mode to the code we have been experiancing a response delay during teleop mode. This delay disapears if i remove the automous mode and i am usong labview. Any tips on what could be causing it?
  #2   Spotlight this post!  
Unread 18-02-2014, 19:49
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,756
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: Autonomous starving teleop?

The Charts tab traces what code runs when. It may be helpful to review to see that Auto actually stops when the period is over. If you zoom in it will also show if you are skipping processing teleop packets and shows CPU usage, communication loss and latency to see if that is involved.

If you don't make progress with this extra data, please post an image or the log file.

It may also be useful to use the Support Code folder in the project. It contains a timing VI that you can crop into various loops. When running, you can open the panel of the VI to see the period of the instrumented loops.

Greg McKaskle
  #3   Spotlight this post!  
Unread 19-02-2014, 21:24
brunoUC's Avatar
brunoUC brunoUC is offline
Registered User
AKA: Bruno Toso
FRC #1156 (Under Control)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Novo Hamburgo, RS, Brasil
Posts: 23
brunoUC is an unknown quantity at this point
Re: Autonomous starving teleop?

Hello, Thank you for your quick reply! Before bagging our robot i was able to run some tests and there is some packet loss as well as the following error on the driver station:

ERROR <Code> -44061 occurred at "Left and Right Motors" in the VI path: Robot Main.vi
<time>03:01:28 02/19/2014
FRC: The loop that contains RobotDrive is not running fast enough. This error can occur if the loop contains too much code, or if one or more other loops are starving the RobotDrive loop.

Also, after redeploying the code without the autonomous mode the delay reamaied, so it was not really the one causing it. I understand that some loops on my code might be starving it, but i cant really find any.
Im attaching my code and the last log file if it might help.

Thank you so much!
Attached Files
File Type: rar CD.rar (357.0 KB, 8 views)
  #4   Spotlight this post!  
Unread 19-02-2014, 21:35
xXhunter47Xx's Avatar
xXhunter47Xx xXhunter47Xx is offline
Lord of Lazy
AKA: Austin $wagmaster1337
FRC #4738 (Patribots)
Team Role: College Student
 
Join Date: Jan 2014
Rookie Year: 2013
Location: San Diego
Posts: 305
xXhunter47Xx will become famous soon enough
Re: Autonomous starving teleop?

Quote:
Originally Posted by brunoUC View Post
Hello, Thank you for your quick reply! Before bagging our robot i was able to run some tests and there is some packet loss as well as the following error on the driver station:

ERROR <Code> -44061 occurred at "Left and Right Motors" in the VI path: Robot Main.vi
<time>03:01:28 02/19/2014
FRC: The loop that contains RobotDrive is not running fast enough. This error can occur if the loop contains too much code, or if one or more other loops are starving the RobotDrive loop.

Also, after redeploying the code without the autonomous mode the delay reamaied, so it was not really the one causing it. I understand that some loops on my code might be starving it, but i cant really find any.
Im attaching my code and the last log file if it might help.

Thank you so much!
have you inverted the motors by switching motor leads? If you're using jags and switch the motor leads to invert direction it starves the RD loop. What language are you using?
  #5   Spotlight this post!  
Unread 19-02-2014, 22:07
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,600
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: Autonomous starving teleop?

Quote:
Originally Posted by xXhunter47Xx View Post
have you inverted the motors by switching motor leads? If you're using jags and switch the motor leads to invert direction it starves the RD loop. What language are you using?
The software (and the Robot Drive loop) doesn't know anything about inverting motor leads, and inverting motor leads will not affect the software.
  #6   Spotlight this post!  
Unread 19-02-2014, 22:23
xXhunter47Xx's Avatar
xXhunter47Xx xXhunter47Xx is offline
Lord of Lazy
AKA: Austin $wagmaster1337
FRC #4738 (Patribots)
Team Role: College Student
 
Join Date: Jan 2014
Rookie Year: 2013
Location: San Diego
Posts: 305
xXhunter47Xx will become famous soon enough
Re: Autonomous starving teleop?

Quote:
Originally Posted by Joe Ross View Post
The software (and the Robot Drive loop) doesn't know anything about inverting motor leads, and inverting motor leads will not affect the software.
You say that... yet it has happened to us. We switched the leads to invert the motor direction and that was what was hurting the robot drive loop because it stopped glitching out once we rewired everything correctly

Last edited by xXhunter47Xx : 19-02-2014 at 23:26.
  #7   Spotlight this post!  
Unread 20-02-2014, 07:25
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,756
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: Autonomous starving teleop?

I looked through the charts, and the CPU is almost always pegged. During Teleop and during Disabled. That means that expensive code is probably in Periodic. That doesn't really make sense with the code I'm looking at. You only attached the dsLog file and not the dsEvent file, so what I don't know is how many errors were being thrown.

I don't have a cRIO at home, but luckily, your project uses simulation. I ran your code and I'm seeing that your periodic code is failing to open a solenoid and Motor refnum, but is then setting those anyway, and possibly at a pretty fast speed. Those sets are obviously failing, which would cause your robot to not operate properly, but even worse, the errors bog down the CPU so that your teleOp code has issues.

I think you will be able to find the issues pretty easily. It is most likely that the names in Begin and Periodic no longer match, or it is possible that some of the I/O was closed somewhere in the program. It may be easiest to open Periodic and set it to highlight. Turn on the light bulb at that top of the window. This slows it way down, and then you can see immediately when the error is sent to the DS Diagnostic tab.

Boa Sorte.
And if you fail to find the issues, let me know and I can help identify which of the refnums are causing problems.

Greg McKaskle
  #8   Spotlight this post!  
Unread 20-02-2014, 08:42
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Autonomous starving teleop?

I see Two DIO 3's are defined in Begin.

It looks like the problem is with Periodic Tasks sucking up all your CPU.
It's probably because one or more of your 20ms loops takes more than 20ms to execute regularly.
I suspect Engatiha e atira, because the bad DIOs get checked there every 20ms.

Greg has provided a nice tool that you'll find in your project window under Support Code called Elapsed Time.
You can drag & drop an instance of that into each of your loops (and feed it a unique name so you can tell which one it is) to see how fast they run in the Debug front panel of Elapsed Time.
Any of your loops that regularly take much (the loops will always be a few ms slower than the time you set) longer than the 20ms or whatever delay you gave them, will occupy your CPU 100%, because they never get a rest.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 20-02-2014 at 10:12.
  #9   Spotlight this post!  
Unread 20-02-2014, 12:28
brunoUC's Avatar
brunoUC brunoUC is offline
Registered User
AKA: Bruno Toso
FRC #1156 (Under Control)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Novo Hamburgo, RS, Brasil
Posts: 23
brunoUC is an unknown quantity at this point
Re: Autonomous starving teleop?

Hello, i have added the elapsed times vi to the periodic tasks loop and discovered that they were running at around 80-100ms, while the delay time on them was only 25-40ms. So i increased these delays to 100ms and most part of the errors stopped, but i was not able to locate the refnum errors that greg mentioned, how can i locate and fix them?

thank you so much for your help guys!
  #10   Spotlight this post!  
Unread 20-02-2014, 13:15
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Autonomous starving teleop?

You have two different devices called "Garra"
One is a solenoid and the other is a motor.
That's going to be causing trouble and driving up the loop time on one of your Periodic Task loops.

After you get rid of the DIO and Solenoid/Motor errors, go back and look at the loop times again.
They should drop back to a more normal range.

P.S.
See you again at the Long Island Regional!
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 20-02-2014 at 13:22.
  #11   Spotlight this post!  
Unread 22-02-2014, 19:47
brunoUC's Avatar
brunoUC brunoUC is offline
Registered User
AKA: Bruno Toso
FRC #1156 (Under Control)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Novo Hamburgo, RS, Brasil
Posts: 23
brunoUC is an unknown quantity at this point
Smile Re: Autonomous starving teleop?

Thank you so much! I was able to run some tests on our test robot and everything is running smoothly! The loops on periodic tasks are running at about 60ms. It is amazing how simple it was to solve such a problem!

Thank you so much again for your help! You guys are awesome!
See you at SPBLI regional!
  #12   Spotlight this post!  
Unread 24-02-2014, 21:20
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 756
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Autonomous starving teleop?

Quote:
Originally Posted by Mark McLeod View Post
You have two different devices called "Garra"
One is a solenoid and the other is a motor.
That's going to be causing trouble and driving up the loop time on one of your Periodic Task loops.
Oh, OH!
Code alert.

So you're saying that I can't use the same name for two different refnums, even if they are different types?

For some reason I assumed that since I need to use specific instances of the put and get refnums for different devices, the name pool for these different devices were unique... but sounds like not !!! Dumb me!!! I also called both the motor and solenoid for the Collector "Collector".

Yes, I'm doing this and yet they "appear" to work... I may be getting mass errors........ but the devices do work... How is that possible?

Phil.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
  #13   Spotlight this post!  
Unread 24-02-2014, 21:32
BBray_T1296's Avatar
BBray_T1296 BBray_T1296 is offline
I am Dave! Yognaut
AKA: Brian Bray
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Rockwall, TX
Posts: 947
BBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond reputeBBray_T1296 has a reputation beyond repute
Re: Autonomous starving teleop?

Quote:
Originally Posted by xXhunter47Xx View Post
You say that... yet it has happened to us. We switched the leads to invert the motor direction and that was what was hurting the robot drive loop because it stopped glitching out once we rewired everything correctly
The electrons don't care what color the insulation surrounding the wire is. Inside a brushed DC motor the electric "pathing" is identical, both "forward" and "backward". Wiring the motor in reverse is not harmful, and has no impact on the performance, as CIMs are designed to go CW (Red-Black/Black-Red) just as efficiently as CCW (Red-Red/Black-Black), but it is bad practice to use the former.

If the leads going into the Jags were wired in reverse, the magic blue smoke monster gods were not frowning on you, which is surprising, because they are not a cheerful bunch.

Perhaps by rewiring the robot you fixed a problem you did not know you were having (like a lose sidecar or D-Link wire)
__________________
If molecular reactions are deterministic, are all universes identical?

RIP David Shafer: you will be missed


  #14   Spotlight this post!  
Unread 24-02-2014, 21:38
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Autonomous starving teleop?

Quote:
Originally Posted by PhilBot View Post
So you're saying that I can't use the same name for two different refnums, even if they are different types?
You're right. They shouldn't conflict.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #15   Spotlight this post!  
Unread 25-02-2014, 06:36
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,756
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: Autonomous starving teleop?

The named refnum repositories are unique per i/O type. If you really do have a Collector that is a motor and another as a solenoid, that will not produce code errors. Communications errors with the rest of the team, perhaps. But it was designed to support what you are doing.

If you ask for the RobotDrive named Collector, that will produce an error because you didn't store a refnum of that type with that name.

Greg McKaskle
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 02:41.

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