Breakaway from the madness and go through the tunnel of love with me!
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
  #16   Spotlight this post!  
Unread 15-01-2013, 22:57
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by Greg McKaskle View Post
One thing I notice is that you don't necessarily need to enable the safety for spinner motors. If you believe that your code needs to update the motors in order to be safe and in control, then leave the safety on and consider the rate at which you believe you need to update them. Otherwise turn the safety off.

I think the next thing for you to do is to retrieve the motors of the shooter by name, and connect the axis value to the value of both motor refnums.

Greg Mckaskle
The safety thing makes sense, thanks!

As for the motors.. I feel like I'm missing the vi to bridge the gap between the axis values and the motor controllers' RefNumRegistry vi's. Which vi(s) do I need to use here?
Added another picture for clarity

Thanks for the help!
Attached Thumbnails
Click image for larger version

Name:	a.jpg
Views:	36
Size:	16.1 KB
ID:	13522  
__________________
Team 3753 BulahBots
Reply With Quote
  #17   Spotlight this post!  
Unread 15-01-2013, 23:05
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,961
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: General LabVIEW questions from a VERY new user

"Set Motor Output" is what you are missing.

For example:

__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 15-01-2013 at 23:09.
Reply With Quote
  #18   Spotlight this post!  
Unread 16-01-2013, 07:56
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by Mark McLeod View Post
"Set Motor Output" is what you are missing.

For example:

Thanks! And since I have two separate motor controllers, I assume I need two separate Set Motor Output vi's? I tried plugging both motor controller RefNumRegistry vi's into each side of ONE Set Motor Output but the right side wouldn't connect

Just want to make sure I'm not messing anything up by having it with 2 (pic attached

Also in the picture, does wiring the right-most Set Motor Output's "Output" value to the other one's output value (as shown) give the same value as if I had wired the right-most Set Motor Output's "Output" value to the wire itself (before it plugs into the other vi)? (2nd pic attached since I'm bad at explaining)
Attached Thumbnails
Click image for larger version

Name:	vi to wire.jpg
Views:	39
Size:	26.4 KB
ID:	13524  Click image for larger version

Name:	vi to vi.jpg
Views:	30
Size:	26.9 KB
ID:	13525  
__________________
Team 3753 BulahBots
Reply With Quote
  #19   Spotlight this post!  
Unread 16-01-2013, 08:25
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,780
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: General LabVIEW questions from a VERY new user

Do the two attached images of diagrams work the same? Well, maybe.

The output terminal was added this year to simplify publishing to the SmartDashboard. If you have set the motor to invert or to have a scaling functions, the right-side value will not be the same as the left. But many times it will be.

I'd do it like the left image. Split the wire and connect to both motors.

Greg McKaskle
Reply With Quote
  #20   Spotlight this post!  
Unread 17-01-2013, 17:34
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by Greg McKaskle View Post
Do the two attached images of diagrams work the same? Well, maybe.

The output terminal was added this year to simplify publishing to the SmartDashboard. If you have set the motor to invert or to have a scaling functions, the right-side value will not be the same as the left. But many times it will be.

I'd do it like the left image. Split the wire and connect to both motors.

Greg McKaskle
Worked wonderfully, thank you
We drove our robot for the first time yesterday! It was glorious.

It also showed me that the controls are not sensitive enough at low levels and too at mid levels. So rather than just plugging in the axis values to the Drive Station plugins, I now want to do something like this:

If (axisValue < 0.4)
___axisValue*=1.5;
else if (axisValue > 0.4 && axisValue < 0.75)
___axisValue*=0.8;
(else, no change to the value)

I know (roughly) how to use the simple arithmetic and t/f vi's, but I couldn't quite figure out how to wire the input through so many if-then-else-if type scenarios successfully

EDIT: Added a pic of my attempt
Attached Thumbnails
Click image for larger version

Name:	aaa.jpg
Views:	32
Size:	12.8 KB
ID:	13549  

Last edited by ctccromer : 17-01-2013 at 17:50.
Reply With Quote
  #21   Spotlight this post!  
Unread 17-01-2013, 20:57
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,780
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: General LabVIEW questions from a VERY new user

Rather than the stepwise adjustment, you may want to consider using square root. The attached image shows the plot from -1 to 1 and the code that preserves the sign of the square root of the input number.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	35
Size:	88.3 KB
ID:	13551  
Reply With Quote
  #22   Spotlight this post!  
Unread 18-01-2013, 07:52
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by Greg McKaskle View Post
Rather than the stepwise adjustment, you may want to consider using square root. The attached image shows the plot from -1 to 1 and the code that preserves the sign of the square root of the input number.

Greg McKaskle
Thats a really smart idea that I hadn't thought of.. I'll definitely try it out at our next build day!

Just in case though, so I can have more to play around with, would someone mind explaining to me how to fix the pic above? I know the orange wires are double/numeric values and the green wires are boolean values, I just don't know how to set up an if-then-else-if sequence

EDIT: Also, another question.. Whenever I deploy code OR build the code, I get this pop-up every single time. I don't really understand what it means, but I just click okay and it deploys/builds perfectly fine. Should I just leave it alone or should I do something to stop it from popping up? (attached pic)
Attached Thumbnails
Click image for larger version

Name:	popup.jpg
Views:	29
Size:	68.3 KB
ID:	13560  
Reply With Quote
  #23   Spotlight this post!  
Unread 18-01-2013, 08:25
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,780
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: General LabVIEW questions from a VERY new user

The red X with the arrows pointing in away indicates no source on the wire. You have the wire going between two data consumer with no data source. If you hover over the X or use the context help window it will give a similar explanation.

To fix one of the cases, the code for 1.5X joystick is always wired to the motor, but you really want it wired to the <0.4 selector. And the multiply has a 1.5, but it doesn't have the joystick value wired to the other input. Branch the wire at the <0.4 and hook that up to the multilply as well.

The deploy dialog is an overly alarming dialog. You are doing it correctly, confirming that you intend to stop the program already running and start the new one you are deploying. You may want to consider using the Run button on RobotMain. This will do a debugging deploy and allow you to breakpoint, probe, highlight, look at panels, and get a much better understanding of how your code executes. Build and Run as Startup are only needed when you are finished debugging and writing code.

Greg McKaskle
Reply With Quote
  #24   Spotlight this post!  
Unread 18-01-2013, 08:31
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: General LabVIEW questions from a VERY new user

Quote:
Originally Posted by ctccromer View Post
EDIT: Also, another question.. Whenever I deploy code OR build the code, I get this pop-up every single time. I don't really understand what it means, but I just click okay and it deploys/builds perfectly fine. Should I just leave it alone or should I do something to stop it from popping up? (attached pic)
What this is doing is trying to override the current code loaded on the cRio. Any time you build and run as startup to the robot, this dialog should pop up any time you are trying to redeploy to the robot. It is completely fine to just hit ok
__________________
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

Reply With Quote
  #25   Spotlight this post!  
Unread 21-01-2013, 11:58
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

So I'm trying to modify our drive system. I tried just plugging the output into a sqr-root vi and that into the drive system vi, but as soon as I enabled the driver station, the wheels immediately turn. I'm pretty sure it's vecause it's trying to take the sqr root of 0, so I'm trying to code it so that it'll work for everything, however I'm still confused how to do if-then-else statements in LabVIEW

I attached a picture of my attempt to make it work for positive and negative numbers (but still have not set it to "if == 0, go straight to drive system vi")

Also I've heard something about case structures for if-then-elses, not the "select" vi, but I'm not sure which to use how to use either one..

Thanks for the help!
Attached Thumbnails
Click image for larger version

Name:	a.jpg
Views:	27
Size:	9.4 KB
ID:	13601  
Reply With Quote
  #26   Spotlight this post!  
Unread 21-01-2013, 13:07
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,780
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: General LabVIEW questions from a VERY new user

Taking the sqrt of zero shouldn't really cause an issue. You may find it useful to probe the wire you are sending to the motor. And if you are not comfortable with it, you can copy and paste the code to another VI that runs on the host and plot it as I did a few posts above. For the task you are looking at, the Sign and Absolute value functions are pretty handy.

Greg McKaskle
Reply With Quote
  #27   Spotlight this post!  
Unread 21-01-2013, 14:18
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Instead of setting the motor speed to a certain percentage of full speed, is there a way to set the (CIM) motor to a certain RPM?



Also, I want to make it so that when button 5 is pushed pushed down, the axis 2 and 4 inputs (going into the arcade drive vi to move the robot's drive train) are multiplied by 0.25
In other words.. when Left Bump is held down, the robot moves and turns at 1/4 normal speed

In order to do this, do I need to set a simple boolean to Button 5 and then check the VI over at the axis inputs for the Arcade Drive VI, do I check button 5 directly, or what? I guess this is yet another if-then-else scenario I need to add to the axis inputs.. And they still confuse me

So for them, do I need to do Case Structures or Select VI's? And is there a tutorial for simply making a ton of if-then-else-if statements chained together? All the tutorials I find are introductions to labview, not about anything specifically like what I'm looking for
Reply With Quote
  #28   Spotlight this post!  
Unread 21-01-2013, 19:03
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,780
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: General LabVIEW questions from a VERY new user

The motor controllers you are dealing with are not aware of the type of motor and have little ability to measure how fast it is turning. It is possible to use CAN and a Jaguar motor controller, connect a motor and an encoder or other rotation sensor, and then you can get the Jaguar to do the speed control to get to motor to a given RPM set point. You can also do this in the cRIO, but at a somewhat slower speed. You still need an encoder and you need to use a control block such as PID or implement a simple bang-bang controller.

Selects and Case Structures are very similar. The biggest difference is that using a Select, all code is actually executed and the selected answer is propagated downstream. With a Case, only one of the Case statement diagrams is executed.

If you find yourself nesting too many expressions -- in any language -- there is often a more concise way to code it so that it is more readable. But this is a learning experience, so do it in whatever way lets you express what you want as code. Experiment with alternative ways of writing equivalent code, and before long you will develop your preferred coding style for this sort of thing.

Greg McKaskle
Reply With Quote
  #29   Spotlight this post!  
Unread 22-01-2013, 00:35
ctccromer's Avatar
ctccromer ctccromer is offline
Animus
AKA: Tucker Campbell
FRC #3753 (Bulah Bots)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Baton Rouge, Louisiana
Posts: 190
ctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to allctccromer is a name known to all
Re: General LabVIEW questions from a VERY new user

Thanks yet again

I'll forward the RPM stuff to our coach. The reason we were thinking about it is to keep the same RPM rather than a percentage of the motor speed (which would change as the battery dies)

As for the case and select vi's, I think I understand what you mean. And for the situation I mentioned about slower movement, I should just be able to use a case structure. Would you happen to have a picture of an example Select Vi?



We had a huge issue today. Spent a good half hour to an hour trying to figure it out and still never got anywhere, AND apparently last year's programmer never could figure it out either. We have a window motor (for our shooter) that I programmed simply:
Button x: if true, set motor output to 0.4 / if false, set motor output to 0
Button y: if true, set motor output to -0.4 / if false, set motor output to 0

I used case structures for both and copy/pasted the first one made and just added the (-) sign. However the issue is that only one of the two Case Structures will work! Say (ex) initially, Case A is +0.4 and Case B is -0.4. Case A will move the motor but Case B won't do anything at all. Then I switched the signs and Case A will move the motor the other way, but Case B still wont do anything. Switching buttons didnt make a difference. If I delete Case A, THEN Case B works, since there's no other Case in its way.
I tried it both with one and with two RefNumRegistry Get vi's but that didnt make a difference either.

Pics of the cases attached. The FALSE sides are identical to the TRUE sides, except the number is 0 instead of +/-0.4
Attached Thumbnails
Click image for larger version

Name:	1.jpg
Views:	32
Size:	32.1 KB
ID:	13614  Click image for larger version

Name:	2.jpg
Views:	23
Size:	34.9 KB
ID:	13615  
Reply With Quote
  #30   Spotlight this post!  
Unread 22-01-2013, 07:49
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,780
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: General LabVIEW questions from a VERY new user

Triple click the Boolean wire coming from the Button. Delete it and rewire it. I suspect that you have one wire that just looks like it comes from 11 and another that comes from 12.

I again encourage you to have fewer icons to set the motor output. If you know that you will set it, just not sure what value, only make the value selection conditional. Code as you have written it has a tendency to evolve to the point where it is accidentally setting the same motor to 2, 3, or 5 different speeds during a single teleop frame. The winning speed is who went last, and it seems possessed.

I attached an image, definitely feels like I've drawn it before, that demonstrates what I mean. Note that in the case both buttons are pressed, you have to declare what to do. I chose to sum the speeds and the motor will not run. That may be a bad idea, but you have to decide what to do in that case.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	26
Size:	34.3 KB
ID:	13617  
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 04:16.

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