Go to Post I want to see the [game] animation robot with the plunger to pick up balls and the boots that spin to kick them. Could you do that please. It would be very awesome. :D - the man [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 22-02-2012, 01:42
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Interesting cRIO delays

So while testing on bag&tag day I noticed some odd behavior coming from our robot.

First I will explain our setup. We have 2 separate axle shafts connected to encoders which I feed into 4 DMA channels which then return the rates of those shafts. I used modified versions of the example code for DMA encoders to accomplish this. I have these rates fed into PID functions to control the rate of the motors. This code is in its own loop in periodic tasks and is running as a 10ms loop. (Problem?)

I noticed that immediately after deploying the code, the delay between spinning the wheel and the encoder response was in-observable. However, as the testing continued the delay began to grow until it was at about a second after a few minutes of testing. When I stopped and redeployed the code, I would get temporary relif, but after a few minutes, the delay returned. I also noted that as the evening progressed the delay became larger and larger.

Additionally, at some point in the evening several motors including some on the drivetrain and shooter wheels began to twitch (turn on momentarily (<.5sec) and then stop.

Some of our mentors believe that the problem might be the ribbon cable that we were using to connect the DIO modules to the DS...

Does anyone have any explanations/workarounds for these problems.
Reply With Quote
  #2   Spotlight this post!  
Unread 22-02-2012, 07:13
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: Interesting cRIO delays

Does this happen because your control loop isn't keeping up with the DMA rate? If you are consuming a 100Hz stream with a 10ms delay, you are approximately keeping up, but each little delay in the FPGA producer adds a little bit of extra data to the buffer that the consumer doesn't get to. This would probably improve enough if you will switch from a regular loop to a Timed Loop. The timed loop runs on a different scheduler and at an elevated priority. The other solution is to run the consumer loop until the buffer is empty, take the latest data from the buffer, etc.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 22-02-2012, 08:52
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Interesting cRIO delays

It is possible.

1) How do I implement a timed loop?

2) How do I know 100Hz?

3) Would this make my teleop controls laggy?

-Patrick
Reply With Quote
  #4   Spotlight this post!  
Unread 22-02-2012, 13:05
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,579
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: Interesting cRIO delays

Why do you care about encoder rate in the past?
Reply With Quote
  #5   Spotlight this post!  
Unread 22-02-2012, 14:20
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Interesting cRIO delays

I don't? I am measuring the current encoder rate.
Reply With Quote
  #6   Spotlight this post!  
Unread 22-02-2012, 14:22
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,579
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: Interesting cRIO delays

The only reason I can think of to use DMA is if you care about past measurements. If you only care about the most recent measurement, you can just use the rate output from the encoder get.
Reply With Quote
  #7   Spotlight this post!  
Unread 22-02-2012, 14:23
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: Interesting cRIO delays

Quote:
Originally Posted by baronep View Post
I don't? I am measuring the current encoder rate.
DMA is typically used when you want to guarantee that you see all the values that have been generated. If you only care about the most recent value, you don't need to bother with DMA.
Reply With Quote
  #8   Spotlight this post!  
Unread 22-02-2012, 14:30
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Interesting cRIO delays

The problem that we ran into with the regular code is that we were not seeing all of the data. Our encoders have 256 pulses per rotation and at ~1000 rpm the cRio was losing pulses. Therefore we figured that DMA would be a good choice to not lose any pulses (which would screw up rate). We are just having a delay problem which may or may not be related to the DMA. Anyone have any explanation for the twitchy robot?
Reply With Quote
  #9   Spotlight this post!  
Unread 22-02-2012, 17:17
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: Interesting cRIO delays

The encoder should be good for close to 40,000 per second, far more than you describe. Additionally, the DMA cannot go faster than the decoding, so it will not help to speed up encoders.

Greg Mckaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 22-02-2012, 17:38
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Interesting cRIO delays

Is there a downside to using the DMA though?

Robot twitching?
Reply With Quote
  #11   Spotlight this post!  
Unread 22-02-2012, 21:12
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Interesting cRIO delays

Do you have any other threads sharing time with or stealing time from your encoder thread? We don't use NI on the robot. We use C++ and would just raise the relative priority (by lowering the priority number) of the encoder thread/task to make sure it runs when needed. Is there a way to do that in LabView? Greg?

HTH
__________________
Fast, cheap or working - pick any two!
Reply With Quote
  #12   Spotlight this post!  
Unread 22-02-2012, 21:19
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,579
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: Interesting cRIO delays

Quote:
Originally Posted by baronep View Post
Is there a downside to using the DMA though?
You'll spend a lot more time processing data, without any improvement to your problem.
Reply With Quote
  #13   Spotlight this post!  
Unread 22-02-2012, 21:37
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Interesting cRIO delays

Alright, it just seemed that our encoder data was much cleaner with DMA than without, but I am willing to give the other way a try. How does one elevate the thread priority of the encoder code?
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:07.

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