Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Breaker Switches and Buttons to Motors (http://www.chiefdelphi.com/forums/showthread.php?t=112357)

sthreet 30-01-2013 10:43

Breaker Switches and Buttons to Motors
 
How do I wire the true/false of a joystick button into an if square thingy? And how do I make it so in one case it doesn't connect the wired but in another it does?

Also how do i change a button (green) to a motor value (orange) ...???

Thanks. And don't see the title "breaker switches" and post something about the compressor, i can't understand that in the compressor...

Greg McKaskle 30-01-2013 11:27

Re: Breaker Switches and Buttons to Motors
 
A case structure enforces you to produce data for all cases. If it didn't, and someone tried to use the data, it would be an uninitialized variable. You can move the motor update block into the structure itself and only call it in one frame, or you can output the same value that you sent the last iteration.

For changing a Boolean into a number, the typical approach is to use a case structure or a select block to choose between two numbers.

Greg McKaskle

sthreet 30-01-2013 12:31

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by Greg McKaskle (Post 1224480)
A case structure enforces you to produce data for all cases. If it didn't, and someone tried to use the data, it would be an uninitialized variable. You can move the motor update block into the structure itself and only call it in one frame, or you can output the same value that you sent the last iteration.

Do you basically mean "put the whole thing, joystick things and all inside of the if statement?
Also do you mean that just wiring my Boolean (in this case something that should be connected to breaker switches) up to the side of the diagram makes it determine what the if returns as?
Quote:

Originally Posted by Greg McKaskle (Post 1224480)
For changing a Boolean into a number, the typical approach is to use a case structure or a select block to choose between two numbers.

Greg McKaskle

I'll try that, same section as ifs?

Thanks.

sthreet 30-01-2013 16:25

Re: Breaker Switches and Buttons to Motors
 
How do I set up a single motor?

Alan Anderson 30-01-2013 21:14

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1224701)
How do I set up a single motor?

(I'll answer the question I think you're asking. If what I'm saying doesn't make sense, try asking again using different workds.)

The functions for working with individual motors are two more levels deep in the function palette: WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl. Look at the "Motor Control.lvproj" example to see how the Motor functions are used.

sthreet 30-01-2013 22:34

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by Alan Anderson (Post 1224894)
(I'll answer the question I think you're asking. If what I'm saying doesn't make sense, try asking again using different workds.)

The functions for working with individual motors are two more levels deep in the function palette: WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl. Look at the "Motor Control.lvproj" example to see how the Motor functions are used.

So you are saying that motorcontrol initializes and controls a single motor with its y input as the forward and x input as backward? Not to ask stupid questions but why does it have no pwm thingy? Also i hooked up a single motor that i initialized as two motors (made both pwms the same) and tried it, didn't work... Do i have to change some pwms inside of it then?

Alan Anderson 30-01-2013 23:25

Re: Breaker Switches and Buttons to Motors
 
I didn't say anything like that. What did you see that made you think that's what I meant?


Do you understand what "WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl" is referring to? Do you know how to find the FRC examples like "Motor Control.lvproj"?


Your terminology is very vague and informal, and it's making it difficult for me to understand how best to help you. Perhaps you should take advantage of some of the tutorials at http://frcmastery.com/ so we can communicate more effectively.

sthreet 31-01-2013 12:42

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by Alan Anderson (Post 1225008)
Do you understand what "WPI Robotics Library >> RobotDrive >> Advanced >> MotorControl" is referring to? Do you know how to find the FRC examples like "Motor Control.lvproj"?


Your terminology is very vague and informal, and it's making it difficult for me to understand how best to help you. Perhaps you should take advantage of some of the tutorials at http://frcmastery.com/ so we can communicate more effectively.

No, i probably don't; i'll check it out later when i get to the computer; probably mixed it up with something else...

Sorry about that, will check that link and try being more specific.

EDIT: Sorry, was mixing up drive and motorcontrol...

sthreet 31-01-2013 19:03

Re: Breaker Switches and Buttons to Motors
 
UPDATE: We have a bug:

I've narrowed it down to the following:

A DIO get refnum is wired into the get for DIO In which is wired into a case structure, in the false part of the case structure a get refnum for the motor i am using is connected to a set output (which the input of the set out and the motor stuff should be working because it was working before i put it in a case structure. Another setup of what is show above is their except for a different DIO.

I'm pretty sure the error is with the way i did the DIO... Buttons operate case structure fine and worked before i put motor in the case structure, breaker switches hooked up and tried with them on and off, didn't work...

EDIT: I deleted the wires from the DIO in get and wired false things to that, one direction works find now but the other (each case statement is a direction) goes in spurts and at like half speed...

Alan Anderson 31-01-2013 22:48

Re: Breaker Switches and Buttons to Motors
 
What do/did you have wired to the DIO pins?

The "one way works haltingly at half speed" symptom points to a common programming mistake. You're trying to run the motor one direction with the first case block, and the other direction with the second case block, right? The problem is probably that both blocks are turning off the motor in their False case. You have two places setting the motor speed, and one of them "wins". Imagine you're trying to run the motor forward. The "turn it off when not requesting backward" case turns it off, but the "turn it on when requesting forward" immediately turns it on and it works as you expect. But when you try to run the motor backward, the "turn it on when requesting backward" case turns it on, but the "turn it off when not requesting forward" immediately turns it off and it only gets a little twitch of motion.


Do you want to use two joystick buttons to control a motor's forward/reverse motion? There are examples of how to do exactly that posted on the Chief Delphi forums; do a forum search for "button motor" and you'll find lots of helpful advice.

sthreet 01-02-2013 10:27

Re: Breaker Switches and Buttons to Motors
 
What i'm saying is that my joystick buttons worked fine using a case structure and constant numbers to control them, now that i split the motor up into two other case structures that have the input of the DIO (both in the false position) they still rely on pushing a button, but one works weirdly, and considering i kept the code the same with different names (to reference different things) I wonder why this is... One is one, other is negative one and if i press both buttons they cancel out and do nothing...

I'll see if i can look at DIO pins, not 100% certain what that is but i should be able to figure it out, either with google or my teacher/mentor/whatever you call him might know.

EDIT: I suppose if I can't figure it out today i'll take some pictures of what the code is and put that up.

Alan Anderson 01-02-2013 11:52

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1225821)
EDIT: I suppose if I can't figure it out today i'll take some pictures of what the code is and put that up.

That would be very helpful. For example, you've been referring to DIO inputs, but I'm pretty sure that's not what you mean. Seeing what you're actually doing will be good.

sthreet 04-02-2013 15:40

Re: Breaker Switches and Buttons to Motors
 
5 Attachment(s)
Sorry, was lazy over the weekend, will get it in when i get home today.

EDIT: Also where do I find the things for the logitech gamepad F310?

sthreet 04-02-2013 19:07

Re: Breaker Switches and Buttons to Motors
 
5 Attachment(s)
Here's some, i'll edit the others into my previous posts.

sthreet 04-02-2013 19:09

Re: Breaker Switches and Buttons to Motors
 
4 Attachment(s)
Edit doesn't seem to be their for the one before you posted...

Alan Anderson 04-02-2013 22:00

Re: Breaker Switches and Buttons to Motors
 
I am unable to follow your code from the pictures. The wires are going in strange directions, are occasionally obscured by other things in the block diagram, and some go completely off the screen. There's only a partial view of what's in the Case blocks. You'll have to attach the actual VIs before I can try to figure out what they're doing. Even knowing what they're doing isn't going to help much if I don't know what you want them to do instead. Can you give a simple explanation of what you're trying to accomplish?

And I'll repeat my earlier question: What do you have wired to the DIO pins? Specifically, what are the "Break1" and "Break2" inputs reading?

Quote:

Originally Posted by sthreet (Post 1227420)
...where do I find the things for the logitech gamepad F310?

I don't understand the question. Please try not to use the word "thing" without additional explanation.

sthreet 05-02-2013 01:45

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by Alan Anderson (Post 1227653)
I am unable to follow your code from the pictures. The wires are going in strange directions, are occasionally obscured by other things in the block diagram, and some go completely off the screen. There's only a partial view of what's in the Case blocks. You'll have to attach the actual VIs before I can try to figure out what they're doing. Even knowing what they're doing isn't going to help much if I don't know what you want them to do instead. Can you give a simple explanation of what you're trying to accomplish?

And I'll repeat my earlier question: What do you have wired to the DIO pins? Specifically, what are the "Break1" and "Break2" inputs reading?



I don't understand the question. Please try not to use the word "thing" without additional explanation.

Hmm... i'll try a USB drive, we were having problems with internet on that computer for some reason i'm not sure of...

Hmm... now that i understand what you mean by DIO pins better i can check that; so pins are the little box thingies?

The open and close and get for the controller... The VI's... (sorry for use of pronouns)

Alan Anderson 05-02-2013 07:54

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1227810)
Hmm... now that i understand what you mean by DIO pins better i can check that; so pins are the little box thingies?

No. Pins are metal pointy things that you physically attach wires to in order to bring signals and power to electrical components. The DIO pins are a long block of pointy metal bits sticking up near one edge of the Digital Sidecar. They come in sets of three, with +5 volts on the center pin, power return (-) on one of the side pins, and a signal (SIG) on the other side pin.

Your code is reading two of them. What is physically connected to those DIO pins on the Digital Sidecar? What are they supposed to make the robot do?

Quote:

The open and close and get for the controller... The VI's... (sorry for use of pronouns)
Gamepads are HID inputs. They are treated just like joysticks by the Driver Station. Use the same VIs that you'd use for a joystick.

sthreet 05-02-2013 16:15

Re: Breaker Switches and Buttons to Motors
 
Wired into the Digital I/O into signal and negative.

Alan Anderson 05-02-2013 16:33

Re: Breaker Switches and Buttons to Motors
 
I'm not able to give useful advice based on half an answer. May I have enough information to understand your goals, please?

What device do you have connected to the DIO pins?

What do you want that device to do? What do you want the robot to do based on that device?



Pretend everything is working the way you want it to and describe in detail what I would see if I were watching it.

sthreet 05-02-2013 18:23

Re: Breaker Switches and Buttons to Motors
 
4 Attachment(s)
Sorry, will try to get code on usb drive right now, we are attempting to get the breaker switches to disable a motor when pushed.

The buttons we push should activate the motor but when we push the limit switch the motor should not move in one direction.

The Breaker switch is wired to the DIO of the Crio.

Not 100% sure what you are asking...

EDIT: How do i get part of the code into a USB/flash drive?
EDIT: Nevermind, google helped me this time.
EDIT: Ya, uploaded them.

Greg McKaskle 05-02-2013 20:43

Re: Breaker Switches and Buttons to Motors
 
1 Attachment(s)
In the attached code, it would not update the motor unless the digital switch was open. I think what you really intended was update it all the time, but to the correct value based on switch and joystick. The attached code requires for the switch to be FALSE and the joystick to be TRUE. It is missing the Get Refs and such but has the logic basics in place.

Also, the little broom icon at the top of the LV diagram is the cleanup button. If your diagram has overlapping nodes and wires going in many directions, you may want to try the button. You can always undo if you don't like it.

Greg McKaskle

sthreet 05-02-2013 22:26

Re: Breaker Switches and Buttons to Motors
 
I'm not sure I understand what you said but i'll try the symbols I haven't seen anywhere but labview and see if it works, thanks I guess.

Greg McKaskle 06-02-2013 07:45

Re: Breaker Switches and Buttons to Motors
 
If you can't find them, please ask. Hint, if they take in two Boolean wires and return a Boolean, they are typically logic such as AND or OR. Engineers often use these symbols instead of the words.

Greg McKaskle

sthreet 07-02-2013 15:59

Re: Breaker Switches and Buttons to Motors
 
I like || and &&...

EDIT: Can't find the ?tf thingy...

EDIT: Any example of one-button controlled air cylinder?

Alan Anderson 07-02-2013 16:46

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1229478)
EDIT: Can't find the ?tf thingy...

I think you're looking for the Select function. It's in the Boolean palette, with the rest of the Boolean functions.

[edit]Actually, as you found, it's in the Comparison palette. My mistake.[/edit]

sthreet 08-02-2013 15:52

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by Alan Anderson (Post 1229511)
I think you're looking for the Select function. It's in the Boolean palette, with the rest of the Boolean functions.

I don't know why I didn't find it before but its under the comparison section palette...

EDIT: How to get blue '1'?
EDIT: Found blue '1'...

EDIT: Code doesn't work to run the motor with breaker switches but when i start it up unless i look at the empty error list it says something is null...

sthreet 11-02-2013 10:43

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1230034)
Code doesn't work to run the motor with breaker switches but when i start it up unless i look at the empty error list it says something is null...

Common reasons for things being null? Do i need to copy the exact error? (Will at lunch today... if no reply by then)
EDIT: Error not showing up anymore, but code still doesn't work....

sthreet 11-02-2013 22:49

Re: Breaker Switches and Buttons to Motors
 
1 Attachment(s)
Ok, I can't figure out how to get servos to work, copied and pasted the code from the example (was running out of options...), used a basic set angle, set position... Nothing...

Also the attached code isn't working as intended (trying to get motor run when breaker switches aren't pushed) and the motor never runs unless i switch around the blue one and the orange zero... When I do that it always runs...

Mark McLeod 11-02-2013 23:08

Re: Breaker Switches and Buttons to Motors
 
Servos require a jumper on the Digital Sidecar, beside the PWM that the servo is attached to.
That jumper feeds the servo it's power.

Your posted code is setting the same motor (Motorsingle 1) in two different places at the same time.
That's never good.
You need to combine or choose between the competing Buttons and decide on an order of who goes first.

Alan Anderson 12-02-2013 10:05

Re: Breaker Switches and Buttons to Motors
 
I'm still not sure what a "breaker switch" is in your description. I would normally understand it as the robot's main power switch, but that's obviously not what you're talking about. You mentioned limit switches once, so I'll assume that's what you mean.

Mark has already pointed out that you can't have two separate Motor Set functions next to each other and expect things to work, so I'll let that go for now.

With the logic in your code, the "break" input will prevent the button press from being recognized when it is True. That means you have to have a switch closed from SIG to (-) on the DIO pins in order for the button to make the motor run. How are your switches wired? There are typically three terminals on a limit switch; which terminal are you connecting to each pin on the Digital Sidecar?

sthreet 12-02-2013 10:10

Re: Breaker Switches and Buttons to Motors
 
To guy from other page: Ok, i'll try to figure out how to do that, i would use another and maybe?
Quote:

Originally Posted by Alan Anderson (Post 1232092)
I'm still not sure what a "breaker switch" is in your description. I would normally understand it as the robot's main power switch, but that's obviously not what you're talking about. You mentioned limit switches once, so I'll assume that's what you mean.

Sorry about that, limit switches, don't know why i got that they are breaker switches...
Quote:

Originally Posted by Alan Anderson (Post 1232092)
Mark has already pointed out that you can't have two separate Motor Set functions next to each other and expect things to work, so I'll let that go for now.

Ok, will try something at lunch today.
Quote:

Originally Posted by Alan Anderson (Post 1232092)
With the logic in your code, the "break" input will prevent the button press from being recognized when it is True. That means you have to have a switch closed from SIG to (-) on the DIO pins in order for the button to make the motor run. How are your switches wired? There are typically three terminals on a limit switch; which terminal are you connecting to each pin on the Digital Sidecar?

I just remember two but i will check... Thought i posed somewhere else earlier...

EDIT:
Quote:

Originally Posted by sthreet (Post 1228226)
Wired into the Digital I/O into signal and negative.

Will check again though... Not sure what you mean by three terminals... But should I get rid of the not also?

Mark McLeod 12-02-2013 10:33

Re: Breaker Switches and Buttons to Motors
 
Quote:

Originally Posted by sthreet (Post 1232095)
Not sure what you mean by three terminals...

A typical limit switch has three terminals seen here:



One is marked COM and the ground wire goes there.
Then you have a choice of two terminals for the signal wire that essentially give opposite answers.
  • NC is Normally Closed and completes the circuit only while the limit switch is not depressed
  • NO is Normally Open and completes the circuit only when the limit switch is depressed. The opposite of NC.
There are reasons to choose one over the other. For instance, we like Normally Closed if the switch is acting as a fail safe (if the switch fails, it's still safe). So, say the switch gets broken, then the mechanism is disabled by default, because NC acts like it's being depressed if it gets ripped off the robot.

Quote:

Originally Posted by sthreet (Post 1232095)
But should I get rid of the not also?

Use of the -not- will depend on which terminal NC vs NO you wired up.

sthreet 12-02-2013 16:59

Re: Breaker Switches and Buttons to Motors
 
Thanks for the diagram, helped a lot, we had both the ones on the left wired and I didn't even know the bottom was able to be wired...
Anyway, any way to explain how I can combine them and get a three-way button thingy? or should I just make one if the other button is false...???

EDIT: ABOUT SERVOES:
1) Should the attached code run them assuming they are connected to the pwm/digital sidecar correctly?
2) How do they connect to the digital sidecar? They are wired into pwm and only have one set of wires/socket...


All times are GMT -5. The time now is 01:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi