Go to Post A Strong FRC Team Should... have a clear vision and an understanding of how to achieve it within their means. - jwfoss [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 27-02-2012, 16:13
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: What's the best way to test?

In your zipped code, you've wired the throttle to your ball accumulator.

From what I've learned through the various errors I've stumbled upon, when the throttle is fully rotated forward (towards the +), it's interpreted as a -1. When it's fully rotated downward (towards the -), it's interpreted as a 1. There's no marking or physical click for 0.

So, depending on the physical setup of your ball collection system, setting the throttle to full forward might turn your collection motor in the opposite direction you want it to go.

If you want to stick with the throttle, just negate the output of the axis. This tool is under Programming>>Operations.

I've coded our collection motor to intake a ball (set the ball collection motor to -1) when button 2 is pressed and held down. The ball is spit out (collection motor to 1) when button 3 is pressed and held down. This might be better for your application.
Reply With Quote
  #2   Spotlight this post!  
Unread 27-02-2012, 20:14
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: What's the best way to test?

Like everyone else said, drivetrain shouldn't be hard at all. It's all done for you really, you just have to place the VIs in there.

The Accumulation code makes sense, but won't work they way you think it will. You've created a rising edge (on button press) code trigger with the feedback node and the greater than > block. What this means is that the code will execute exactly one time when you press it down, and won't execute it again until you release and press that button again. Good job from this point.

Inside the case structure you have a T/F from another feedback node. So you'll press it once, and the motor will stop (from value 0), and then you press it again, it will go full 'forward' (from value 1) once the NOT block inverts your boolean F to T. So here's another good job from me.

The problem is that you are not constantly feeding the motor with a value. For safety purposes, motors are not allowed to continue their set value unless it is fed a value every so many milliseconds (I think it's like every 100ms). If you look at the given autonomous code, you'll see that they use a while loop instead of the simpler sequence structure. This is why this is done.

You can simply add another feedback node, with the motor control value in it, then add the motor to the outside of the case structure, as shown in the picture attached.

Click image for larger version

Name:	LabVIEW.png
Views:	25
Size:	29.0 KB
ID:	12130

Here's how I would do it, because case structures clutter up the work area, plus it hides half of the code that can execute.

Click image for larger version

Name:	My LabVIEW.png
Views:	19
Size:	6.0 KB
ID:	12131
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #3   Spotlight this post!  
Unread 27-02-2012, 20:20
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: What's the best way to test?

Quote:
Originally Posted by RyanN View Post
Like everyone else said, drivetrain shouldn't be hard at all. It's all done for you really, you just have to place the VIs in there.

The Accumulation code makes sense, but won't work they way you think it will. You've created a rising edge (on button press) code trigger with the feedback node and the greater than > block. What this means is that the code will execute exactly one time when you press it down, and won't execute it again until you release and press that button again. Good job from this point.

Inside the case structure you have a T/F from another feedback node. So you'll press it once, and the motor will stop (from value 0), and then you press it again, it will go full 'forward' (from value 1) once the NOT block inverts your boolean F to T. So here's another good job from me.

The problem is that you are not constantly feeding the motor with a value. For safety purposes, motors are not allowed to continue their set value unless it is fed a value every so many milliseconds (I think it's like every 100ms). If you look at the given autonomous code, you'll see that they use a while loop instead of the simpler sequence structure. This is why this is done.

You can simply add another feedback node, with the motor control value in it, then add the motor to the outside of the case structure, as shown in the picture attached.

Attachment 12130

Here's how I would do it, because case structures clutter up the work area, plus it hides half of the code that can execute.

Attachment 12131
In the Disabled.vi, you still have code for the Left and Right Motors... you may want to keep that there and name your drive that, or rename it later. This will cause errors to pop up if you disable your robot, since the reference doesn't exist.

You should also add all of the other motors to Disabled.vi, and set their value to 0 to prevent watchdog problems from coming up.

Compressor:
I don't see any compressor code, but I see that you are using pneumatics. In order to legally use pneumatics, you need to have the electronics and programming to charge up your storage tanks before the match, regardless of whether or not you have a compressor on your robot.

Periodic Tasks.vi:
Reference to "Left and Right Motors" and "Joystick 1" here. Delete the while loops while you're at if you you don't plan on using them. Also, your compressor code should go in Periodic Tasks.

Also, regarding your original question. If you don't have the hardware in front of you to try your code on, you can always test logic off the robot using just a plain old VI, implementing your logic, and having inputs and outputs.

Logic Simulator.vi
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 27-02-2012 at 20:32.
Reply With Quote
  #4   Spotlight this post!  
Unread 27-02-2012, 21:08
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: What's the best way to test?

Quote:
Originally Posted by RyanN View Post
The problem is that you are not constantly feeding the motor with a value. For safety purposes, motors are not allowed to continue their set value unless it is fed a value every so many milliseconds (I think it's like every 100ms).
By default, only the Drive motors have the safeties enabled. Unless you have explicitly activated the motor safety for other motors, it is perfectly reasonable to set them once and expect them to continue as commanded indefinitely.
Reply With Quote
  #5   Spotlight this post!  
Unread 27-02-2012, 21:20
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: What's the best way to test?

Quote:
Originally Posted by RyanN View Post
The Accumulation code makes sense, but won't work they way you think it will. You've created a rising edge (on button press) code trigger with the feedback node and the greater than > block. What this means is that the code will execute exactly one time when you press it down, and won't execute it again until you release and press that button again. Good job from this point.

Inside the case structure you have a T/F from another feedback node. So you'll press it once, and the motor will stop (from value 0), and then you press it again, it will go full 'forward' (from value 1) once the NOT block inverts your boolean F to T. So here's another good job from me.

The problem is that you are not constantly feeding the motor with a value. For safety purposes, motors are not allowed to continue their set value unless it is fed a value every so many milliseconds (I think it's like every 100ms). If you look at the given autonomous code, you'll see that they use a while loop instead of the simpler sequence structure. This is why this is done.

You can simply add another feedback node, with the motor control value in it, then add the motor to the outside of the case structure, as shown in the picture attached.

Attachment 12130

Here's how I would do it, because case structures clutter up the work area, plus it hides half of the code that can execute.

Attachment 12131
Ignore my shoddy explanation, here's a picture of the code I'm trying to describe.
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	22
Size:	34.9 KB
ID:	12134  
Reply With Quote
  #6   Spotlight this post!  
Unread 27-02-2012, 22: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: What's the best way to test?

Quote:
Originally Posted by DominickC View Post
Ignore my shoddy explanation, here's a picture of the code I'm trying to describe.
The way his code is written is like a pushbutton switch. You press it once, and the motor turns on, you press it again, and the motor turns off. He has the right logic. Your code will work, but it requires an extra button, and it requires the driver to hold the button down to keep the motors running.


Quote:
Originally Posted by Alan Anderson View Post
By default, only the Drive motors have the safeties enabled. Unless you have explicitly activated the motor safety for other motors, it is perfectly reasonable to set them once and expect them to continue as commanded indefinitely.
Cool, that's news to me! So his accumulation code will work perfectly fine as is.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
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:11.

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