Go to Post Is it bad when are you just sitting at home wishing KICKOFF was here. - JulieB [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 16-02-2013, 10:38
andres20perez andres20perez is offline
Registered User
FRC #0545
 
Join Date: Sep 2010
Location: Levittown
Posts: 12
andres20perez is an unknown quantity at this point
Joystick Delay

There is a delay between the joystick controls and the motors. When we move the joystick is takes about 3 seconds for the motors to respond. We have seen delays like this in the past but this year they are much worse. There isn't much of a delay between the joystick and the speed controller lights because they react almost instantaneously. Are there any teams experiencing this issue and how can we solve this problem?
  #2   Spotlight this post!  
Unread 16-02-2013, 11:31
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,751
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: Joystick Delay

I'd first try turning down the camera rate and size. Also check to see that the DS CPU is not loaded down by another program and check the cRIO CPU usage. Both are shown on the Charts tab.

Please let us know what you find.

Greg McKaskle
  #3   Spotlight this post!  
Unread 18-02-2013, 15:05
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
Re: Joystick Delay

Check your functions to make sure you don't have any delays in your functions without a conditional statement. I had a similar issue in that a shoot function was called in the same loop to check if i hit a certain button and would fire a frisbee. Turns out i had used Timer.delay(.5) before even checking if i hit the button that would fire the frisbee, causing a .5 second lag. simple things like this can sometimes slip by.
  #4   Spotlight this post!  
Unread 18-02-2013, 16:48
Secretspy97 Secretspy97 is offline
Registered User
FRC #1126
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2009
Location: New York
Posts: 25
Secretspy97 is an unknown quantity at this point
Re: Joystick Delay

try adding a wait of 10 milliseconds to each class/VI.
__________________
WHAT TIME IS IT?
1126
  #5   Spotlight this post!  
Unread 19-02-2013, 05:28
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,751
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: Joystick Delay

When used like that, wait statements are like duct tape for programmers.

You may want to understand why those delays were needed, which ones were really needed. Also, with no comments, someone will happen upon that and wonder why it is there. "Why did someone put duct tape right there, and what will happen if I remove it?"

Greg McKaskle
  #6   Spotlight this post!  
Unread 21-02-2013, 20:09
andres20perez andres20perez is offline
Registered User
FRC #0545
 
Join Date: Sep 2010
Location: Levittown
Posts: 12
andres20perez is an unknown quantity at this point
Re: Joystick Delay

We've reduced the delay to less than a second. We cleaned up code and got rid of functions we didn't think we needed.
The cRIO CPU usage is around 70%
Is it normal to have a small delay like that or should we fix up our code further.
  #7   Spotlight this post!  
Unread 21-02-2013, 20:14
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,751
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: Joystick Delay

The delay should be far less than a second.

Greg McKaskle
  #8   Spotlight this post!  
Unread 21-02-2013, 22:01
BitTwiddler's Avatar
BitTwiddler BitTwiddler is offline
electronics/programming mentor
AKA: Mr Tanguay
FRC #1726 (N.E.R.D.S.)
Team Role: Mentor
 
Join Date: Oct 2008
Rookie Year: 2006
Location: Sierra Vista, AZ
Posts: 243
BitTwiddler is on a distinguished road
Re: Joystick Delay

Are there large time delays in teleop.vi? If so, move those tasks down into the periodic tasks.vi where they belong. Teleop needs to run as fast as it can to keep up with the data packets coming from the Driver Station. Use Global variables to pass values between teleop and periodic tasks.
  #9   Spotlight this post!  
Unread 21-02-2013, 22:18
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Joystick Delay

My advice is to ALWAYS write the code without any waits other than while-throttling waits.

Basically, your code design should always assume that any function call must return as fast as possible. This includes thinking about code efficienty, excessive function calls, calculating the same thing multiple times, Wait statements, Wait On Interrupt, waiting for events to return, etc. should all be done through state-machines and not actually blocking.

Our code currently runs in a 10ms RT look with very deterministic timing (average jitter is 10us or so) with no missed periods at under 50% CPU load. The speed limit is the radio packets which are sent at 50hz (we should get new HMI data every other loop, but we still can process new sensor data every 10ms).
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #10   Spotlight this post!  
Unread 21-02-2013, 22:24
stingray27's Avatar
stingray27 stingray27 is offline
Registered User
AKA: Michael Ray
FRC #0027 (Team RUSH)
Team Role: Alumni
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Clarkston, MI
Posts: 209
stingray27 is a name known to allstingray27 is a name known to allstingray27 is a name known to allstingray27 is a name known to allstingray27 is a name known to allstingray27 is a name known to all
Re: Joystick Delay

Make sure you don't have any open motor or sensor refnums. We have noticed that when we open a motor port that doesn't actually exist hardware wise, our code slows down TREMENDOUSLY and also triggers some watchdog issues. This has been a problem until we started using disable diagrams (Labview) to toggle working/unworking code when switching between the competition robot and practice robot
__________________
Michael Ray
Team RUSH 27

Driving Record: 93-64-0 Best Finish: Finalist (x4 FiM Districts)
Coaching Record: 16-7-0 Best Finish: Winner (Kettering Invitationa)l

  #11   Spotlight this post!  
Unread 21-02-2013, 23:42
bhsrobotics1671's Avatar
bhsrobotics1671 bhsrobotics1671 is offline
Andrew Nabors
AKA: Andrew Nabors
FRC #1671 (Buchanan Bird Brains)
Team Role: Coach
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Clovis, CA
Posts: 283
bhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to beholdbhsrobotics1671 is a splendid one to behold
Re: Joystick Delay

If you are using CAN, make sure that you are not referencing any CAN IDs that do not exist on the CAN network. You will receive time-out errors and while the code is timing-out, you will receive lag in the controls.

Happens to us almost every year when we go to test new code before we have all of the components wired up or program for jaguars that we never end up using.
__________________
Buchanan Bird Brains - FRC Team 1671
2015 FIRST World Champions
118, 1678, 1671, 5012
  #12   Spotlight this post!  
Unread 22-02-2013, 00:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Joystick Delay

Quote:
Originally Posted by apalrd View Post
My advice is to ALWAYS write the code without any waits other than while-throttling waits.
What is a "while-throttling wait"? I Googled it and got zero hits.


  #13   Spotlight this post!  
Unread 22-02-2013, 04:02
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,751
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: Joystick Delay

I interpreted Andrew's terminology to refer to the wait that limits the desired speed of the loop/task. For example, if a loop contains an unconditional wait of 100ms in parallel with other code, you've guaranteed that it will never run over 10Hz regardless of what is placed in it. As mentioned in other papers, this is nit a great way to express that you want it to run at exactly 10Hz, but it is often used for that as well.

Greg McKaskle
  #14   Spotlight this post!  
Unread 21-02-2013, 21:59
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: Joystick Delay

Quote:
Originally Posted by andres20perez View Post
The cRIO CPU usage is around 70%
But what is the Driver Station computer's CPU usage?

A couple of years ago we had annoying control lag for a little while, until we found and fixed an unthrottled loop in our custom Dashboard program.
  #15   Spotlight this post!  
Unread 22-02-2013, 00:28
mesamb1's Avatar
mesamb1 mesamb1 is offline
Registered User
AKA: Sam Bacon
FRC #1466 (Webb Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Knoxville
Posts: 93
mesamb1 is just really nicemesamb1 is just really nicemesamb1 is just really nicemesamb1 is just really nice
Re: Joystick Delay

Quote:
Originally Posted by andres20perez View Post
There isn't much of a delay between the joystick and the speed controller lights because they react almost instantaneously
Something I havent read yet, could it be an electrical or mechanical issue? If your speed controllers are reacting almost instantaneously, I would be inclined to check on the electrical/mechanical side. If the lag is in the code, the lights on the speed controllers should be delayed.
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:17.

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