Go to Post I could say something technical but I think I will allow myself a moment to pause in the awesomeness... Sweet. - anna~marie [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 19-02-2013, 08:47
AquaMorph's Avatar
AquaMorph AquaMorph is offline
Alumnus of 2059
AKA: Christian Colglazier
FRC #2642 (Pitt Pirates)
Team Role: Mentor
 
Join Date: Jun 2010
Rookie Year: 2008
Location: Cary
Posts: 78
AquaMorph is on a distinguished road
Running Loop in Parallel

I am working on a program that will set the angle of a shooter. The program is attached below. The program works but when active it everything else in teleop stops running until the loops finish. I know this is because it has to run the entire loop before it can continue on doing other things. After doing some research I think I need to move this vi to Periodic Tasks. Will this allow me to run this program and drive at the same time? Also can I use joystick buttons in Periodic Tasks the same way I would in Teleop?
Attached Thumbnails
Click image for larger version

Name:	LabVIEW Loop.PNG
Views:	47
Size:	24.7 KB
ID:	14107  
__________________
FRC Drive: Play Store FRC Manager: Play Store
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2013, 09:08
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Running Loop in Parallel

Correct! You do not want to have any loops that might take longer then 20ms to run inside your Teleop VI.

Move that function to Periodic inside it own continuous running while loop (wire a false to the conditional terminal). Put the get joystick (Enable) inside the outer loop. Put a short delay in the false case or "Disable" state to keep it from grabbing all the CPU time.

I think you will want to put the get "Disable Limit" inside the "Move Down for 1/2 second" loop so that it is updated each time around that loop.

Post back your changes.
__________________
Omar

Last edited by Omar : 19-02-2013 at 09:11.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2013, 09:19
AquaMorph's Avatar
AquaMorph AquaMorph is offline
Alumnus of 2059
AKA: Christian Colglazier
FRC #2642 (Pitt Pirates)
Team Role: Mentor
 
Join Date: Jun 2010
Rookie Year: 2008
Location: Cary
Posts: 78
AquaMorph is on a distinguished road
Re: Running Loop in Parallel

Quote:
Originally Posted by Omar View Post
Correct! You do not want to have any loops that might take longer then 20ms to run inside your Teleop VI.

Move that function to Periodic inside it own continuous running while loop (wire a false to the conditional terminal). Put the get joystick (Enable) inside the outer loop. Put a short delay in the false case or "Disable" state to keep it from grabbing all the CPU time.

I think you will want to put the get "Disable Limit" inside the "Move Down for 1/2 second" loop so that it is updated each time around that loop.

Post back your changes.
I updated the code.
Attached Thumbnails
Click image for larger version

Name:	LabVIEW Periodic Tasks Loop.PNG
Views:	21
Size:	6.0 KB
ID:	14109  Click image for larger version

Name:	LabVIEW Set Angle.PNG
Views:	21
Size:	24.3 KB
ID:	14110  
__________________
FRC Drive: Play Store FRC Manager: Play Store
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2013, 10:00
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: Running Loop in Parallel

Quote:
Originally Posted by AquaMorph View Post
Will this allow me to run this program and drive at the same time?
Yes, but that's not the only way to do it.

The other way is to use a state machine instead. Here are some threads you might find useful:

http://www.chiefdelphi.com/forums/sh...36&postcount=2

http://www.chiefdelphi.com/forums/sh...04&postcount=3

http://www.chiefdelphi.com/forums/sh...68&postcount=4


Reply With Quote
  #5   Spotlight this post!  
Unread 19-02-2013, 10:40
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Running Loop in Parallel

Agree about the state machine!

But so for your code, I not sure you have it quite right.

Is the code with the two while loops "Move Down until limit switch" and "Angle" inside the "Set Angle Preset 1" subVI?

Do you expect the "Disable Limit" Boolean input to change while looping around the "Move Down until limit switch" loop? If so that will not work because "Disable Limit" will only have the value passed in when the subVI was called and not any new value from the joystick. To update from the joystick as it loops, you will need to put a Joystick Get inside the "Move Down until limit switch"

I'm not too sure just how this angle setting is to work. It seems you have a 'home' position (Top Angle Limit) that you move to start and then iterate around a 10+ms loop a number of times read from the Dashboard until you HOPE to be at the angle you desire.
__________________
Omar
Reply With Quote
  #6   Spotlight this post!  
Unread 19-02-2013, 10:52
AquaMorph's Avatar
AquaMorph AquaMorph is offline
Alumnus of 2059
AKA: Christian Colglazier
FRC #2642 (Pitt Pirates)
Team Role: Mentor
 
Join Date: Jun 2010
Rookie Year: 2008
Location: Cary
Posts: 78
AquaMorph is on a distinguished road
Re: Running Loop in Parallel

Quote:
Originally Posted by Omar View Post
Agree about the state machine!

But so for your code, I not sure you have it quite right.

Is the code with the two while loops "Move Down until limit switch" and "Angle" inside the "Set Angle Preset 1" subVI?

Do you expect the "Disable Limit" Boolean input to change while looping around the "Move Down until limit switch" loop? If so that will not work because "Disable Limit" will only have the value passed in when the subVI was called and not any new value from the joystick. To update from the joystick as it loops, you will need to put a Joystick Get inside the "Move Down until limit switch"

I'm not too sure just how this angle setting is to work. It seems you have a 'home' position (Top Angle Limit) that you move to start and then iterate around a 10+ms loop a number of times read from the Dashboard until you HOPE to be at the angle you desire.
You are correct on how the angle adjustment is going to work. It goes up until it hits the limit switch then goes down for a set amount of time. I am hoping to replace the time function with a gyro but I have been unable to get a good reading from the gyro.

I am currently not too worried about the "Disable Limit" not working but I may change it if need be but I believe it worked in its current state.
__________________
FRC Drive: Play Store FRC Manager: Play Store
Reply With Quote
  #7   Spotlight this post!  
Unread 19-02-2013, 11:08
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Running Loop in Parallel

Quote:
Originally Posted by AquaMorph View Post
I am hoping to replace the time function with a gyro but I have been unable to get a good reading from the gyro.
Have you looked into using a potentiometer? The gyro will drift over time and will be effected by bumps and bangs as you move around the field.
__________________
Omar
Reply With Quote
  #8   Spotlight this post!  
Unread 19-02-2013, 11:59
AquaMorph's Avatar
AquaMorph AquaMorph is offline
Alumnus of 2059
AKA: Christian Colglazier
FRC #2642 (Pitt Pirates)
Team Role: Mentor
 
Join Date: Jun 2010
Rookie Year: 2008
Location: Cary
Posts: 78
AquaMorph is on a distinguished road
Re: Running Loop in Parallel

Quote:
Originally Posted by Omar View Post
Have you looked into using a potentiometer? The gyro will drift over time and will be effected by bumps and bangs as you move around the field.
That just got brought up in this topic http://www.chiefdelphi.com/forums/sh...23#post1236323 I am going to look into it.
__________________
FRC Drive: Play Store FRC Manager: Play Store
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:55.

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