Go to Post Competitions are won or lost far away from witnesses, ... In those long hours, is where we find inspiration in ourselves. For what inspires is not another's feats, but realize we have the power in ourselves to achieve that feat. - Mark Sheridan [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 26-03-2012, 21:04
Jay1986's Avatar
Jay1986 Jay1986 is offline
Programmer and Driver
AKA: Jay Urban
FRC #1986 (Team Titanium)
Team Role: Alumni
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Lees Summit
Posts: 67
Jay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the roughJay1986 is a jewel in the rough
Re: Check My Autonomous Code

First of all, make sure you reset your encoders before using them. So make a sequence before you move back to reset them to 0 and then you can see accurate results. Also your bridge arm code doesnt look correct, but I dont know how yours runs so I cant be for sure. The array part that you are using is something that I havent used before so I have no help for that.
__________________

2013 Oklahoma Regional (Regional Winner, Gracious Professionalism, [and judges voted me star of the day])
2013 KC Regional (Regional Winner, Woodie Flowers, Industrial Design)
2013 Hub City Regional (Regional Winner, Entrepreneurship, Quality, Dean's List)
Reply With Quote
  #2   Spotlight this post!  
Unread 26-03-2012, 21:08
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

Quote:
Originally Posted by Jay1986 View Post
First of all, make sure you reset your encoders before using them. So make a sequence before you move back to reset them to 0 and then you can see accurate results. Also your bridge arm code doesnt look correct, but I dont know how yours runs so I cant be for sure. The array part that you are using is something that I havent used before so I have no help for that.
I'll have to add that for the encoders.
The arm code looks pretty confusing because it involves a limit switch to stop it when it hits its lowest point. That is why there is an array part and logic code in there. It has worked in teleop before.

Thanks
Reply With Quote
  #3   Spotlight this post!  
Unread 26-03-2012, 23:55
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Check My Autonomous Code

In your attached code, you have two while loops.

The one on the top has some useless logic in there with the < 0 thing since you're giving it values of 0.3 and 0, the value will never be less than 0. I think you're trying to code in protection so the motor never goes in reverse, right? Or is your logic backwards and you want to use the AND to enable the motor output? I'm not sure what's going on here. You might want to think it out on paper. Also, you should GET your references outside of the while loop to reduce CPU load.

The one on the bottom definitely won't work the way you think it will.
I think you want your robot to move forward 5 feet, stop, and lower the bridge arm, right? Look where your while loop is located. It will execute the sequence diagram with every loop. So you'll be telling your drive motors to move, then stop, move then stop... Another issue is where your bridge switch GET method is located, outside of the while loop. The switch will only be read once, then that's it. Your motor output will never be controlled. And again, some useless logic. Is 1 < 0? No, you know that, so why have that in your program. Since you're using an AND, and you have a constant FALSE being pushed in it, it will always be false, which will cause your bridge arm motor to be on the full time.

Also, good job using the Select on the second sequence. Why not use it for the motor values in the first sequence?

Don't forget to add a small Wait timer to each while loop. Not having this will cause the CPU to spike out to 100% and hog all resources.

One last additional thing. You should re-enable the safety config for your drive motors once you're done with autonomous. Really, it's not needed. As long as you update your motors every 100ms, you'll be fine.

And as Jay1986 said, make sure to reset your encoders before using them.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 26-03-2012 at 23:59.
Reply With Quote
  #4   Spotlight this post!  
Unread 27-03-2012, 18:38
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

I changed some stuff and tried to fix what you suggested though somethings i was unsure of. Let me know how this one looks. Could you possibly comment in the physical code what I need to change?
In regards to the code on the top, that is for the kinect. Don't worry about that because it works PERFECTLY! I'm just worried with that part in regards to the digital inputs on the driver station and how I attached that array to a case structure outside.
Attached Files
File Type: vi Autonomous Independent.vi (43.9 KB, 9 views)
Reply With Quote
  #5   Spotlight this post!  
Unread 27-03-2012, 22:52
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Check My Autonomous Code

I didn't really edit any of your code. You had a floating number and boolean that I deleted, and I move a few elements around to better document it.
Attached Files
File Type: vi Autonomous Independent.vi (45.7 KB, 5 views)
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #6   Spotlight this post!  
Unread 27-03-2012, 22:58
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

Quote:
Originally Posted by RyanN View Post
I didn't really edit any of your code. You had a floating number and boolean that I deleted, and I move a few elements around to better document it.
You think the bottom code will work now? How about the virtual digital inputs?
Reply With Quote
  #7   Spotlight this post!  
Unread 27-03-2012, 23:09
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Check My Autonomous Code

Quote:
Originally Posted by jhellr13 View Post
You think the bottom code will work now? How about the virtual digital inputs?
No, the bottom code won't work. Check out the comments I left in the code.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #8   Spotlight this post!  
Unread 27-03-2012, 23:14
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

Quote:
Originally Posted by RyanN View Post
No, the bottom code won't work. Check out the comments I left in the code.
Just fixed some of the things you commented. I appreciate the comments you had with my logic on somethings, but I kept them the way they were because I am confident that logic works. I added timers and a while loop at the end, though I'm not too sure on that while loop. I didn't change much in the part with the arm because I couldn't quite understand your comment.

To give you more insight of how the arm works, I'll describe it to the best of my ability. It starts straight up, then rotates down to I guess to be something like a 115 degree angle or whatever needed to tilt the bridge on our robot. At that lowest point, there is a limit switch to make the output 0. I am trying to make this autonomous work where when it moves to that sequence, the arm will rotate down at 1, then hit 0 when limit switch is hit. I'm definite the logic is correct as it is also used in my teleop.
Reply With Quote
  #9   Spotlight this post!  
Unread 27-03-2012, 23:35
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Check My Autonomous Code

Quote:
Originally Posted by jhellr13 View Post
Just fixed some of the things you commented. I appreciate the comments you had with my logic on somethings, but I kept them the way they were because I am confident that logic works. I added timers and a while loop at the end, though I'm not too sure on that while loop. I didn't change much in the part with the arm because I couldn't quite understand your comment.

To give you more insight of how the arm works, I'll describe it to the best of my ability. It starts straight up, then rotates down to I guess to be something like a 115 degree angle or whatever needed to tilt the bridge on our robot. At that lowest point, there is a limit switch to make the output 0. I am trying to make this autonomous work where when it moves to that sequence, the arm will rotate down at 1, then hit 0 when limit switch is hit. I'm definite the logic is correct as it is also used in my teleop.
Can you post your new code so I can take a look? My comment about the logic is that you have some stuff in there that doesn't do anything, and then some of it that doesn't do anything will cause your motor to keep running indefinitely.

Let me step you through your own logic.

We're looking at this code right here:
Click image for larger version

Name:	Before Cleanup.PNG
Views:	34
Size:	4.1 KB
ID:	12440

Let's clean it up to view everything a little better:
Click image for larger version

Name:	After Cleanup.PNG
Views:	30
Size:	6.5 KB
ID:	12441

Now let's minimize the code, removing code that does nothing.
Step 1:
Click image for larger version

Name:	Minimization 1.PNG
Views:	27
Size:	2.5 KB
ID:	12442

Step 2:
Click image for larger version

Name:	Minimization 2.PNG
Views:	26
Size:	2.7 KB
ID:	12443

Step 3:
Click image for larger version

Name:	Minimization 3.PNG
Views:	19
Size:	1.7 KB
ID:	12444

Please let me know if you do or do not understand this. The reason it all cancels out to a False is because you're using an AND gate, meaning both input X AND input Y must be True in order for the Output to be True.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #10   Spotlight this post!  
Unread 28-03-2012, 06:25
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

Quote:
Originally Posted by RyanN View Post
Can you post your new code so I can take a look? My comment about the logic is that you have some stuff in there that doesn't do anything, and then some of it that doesn't do anything will cause your motor to keep running indefinitely.

Let me step you through your own logic.

We're looking at this code right here:
Attachment 12440

Let's clean it up to view everything a little better:
Attachment 12441

Now let's minimize the code, removing code that does nothing.
Step 1:
Attachment 12442

Step 2:
Attachment 12443

Step 3:
Attachment 12444

Please let me know if you do or do not understand this. The reason it all cancels out to a False is because you're using an AND gate, meaning both input X AND input Y must be True in order for the Output to be True.
Alright. I'll change that stuff later in the day. Sort of in a rush right now, but I attached my new code from last night.
Attached Files
File Type: zip Autonomous.zip (34.7 KB, 8 views)
Reply With Quote
  #11   Spotlight this post!  
Unread 28-03-2012, 15:02
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Check My Autonomous Code

Quote:
Originally Posted by jhellr13 View Post
Alright. I'll change that stuff later in the day. Sort of in a rush right now, but I attached my new code from last night.
Keep me informed. I'm wanting to get it working for you.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #12   Spotlight this post!  
Unread 28-03-2012, 15:35
jhellr13 jhellr13 is offline
Registered User
FRC #4272
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: US
Posts: 187
jhellr13 is an unknown quantity at this point
Re: Check My Autonomous Code

Quote:
Originally Posted by RyanN View Post
Keep me informed. I'm wanting to get it working for you.
I just looked over the code again. I left the logic you were talking about the same as I feel safer keeping it the way I've always done limit switches since I know it works. I'm not doubting your suggestions, I would just like to keep it the way it is.

The new code is in my previous response in the zip attachment.
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 10:54.

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