|
|
|
| I may be mere steel but my heart melts when you're around. |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
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! |
|
#17
|
|||||
|
|||||
|
Re: General LabVIEW questions from a VERY new user
"Set Motor Output" is what you are missing.
For example: ![]() Last edited by Mark McLeod : 15-01-2013 at 23:09. |
|
#18
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
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) |
|
#19
|
|||
|
|||
|
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 |
|
#20
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
![]() 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 Last edited by ctccromer : 17-01-2013 at 17:50. |
|
#21
|
|||
|
|||
|
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 |
|
#22
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
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) |
|
#23
|
|||
|
|||
|
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 |
|
#24
|
||||
|
||||
|
Re: General LabVIEW questions from a VERY new user
Quote:
|
|
#25
|
||||
|
||||
|
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! |
|
#26
|
|||
|
|||
|
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 |
|
#27
|
||||
|
||||
|
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 |
|
#28
|
|||
|
|||
|
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 |
|
#29
|
||||
|
||||
|
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 |
|
#30
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|