Log in

View Full Version : PWM


ICE_Bear
01-02-2016, 18:16
How do you use PWM 2 and 3 for roboRIO?

GreyingJay
01-02-2016, 18:18
There's not enough information in your question to really be able to answer. What language are you talking about?

ICE_Bear
01-02-2016, 18:19
We are using Labview.

samfruth
01-02-2016, 18:21
Right click the 2 Motor vi in begin and replace it with the 4 motor vi. Now you should have the option for 4 pwm ports instead of two.

ICE_Bear
01-02-2016, 19:28
When we change 2 motor vi to 4 motor vi it makes the program not runnable. What did we do wrong?

Mark McLeod
01-02-2016, 19:36
If you do a direct replacement of Open 4 Motor for Open 2 Motor where the PWM constants have already been defined, then the PWMs can end up wired to the wrong spots (and there may not be enough of them, or too many).
This is also true if you use the speed controller pull-down selector to change from a PWM to a CAN type of control. You need to remove the old PWM constants and create->constant new inputs.

When you replace a vi with another, it's safest to also delete any input constants and recreate them, so they end up correctly wired to their new input spots.

ICE_Bear
09-02-2016, 18:42
What are the constants for the FRC roboRIO project?

Mark McLeod
09-02-2016, 23:05
Here's how to add a constant using the attached image as a reference.

Drag an Open 4 Motor into the Begin.vi block diagram
Put the cursor on the vi icon you just dropped and you'll see the input and output nodes highlighted (left of the attached image)
Put the cursor on one of the input node until the cursor becomes a wirespool (on the left of the vi icon) and right-click to get a pop-up menu (seen on the right of the attached image)
Navigate to Create->Constant and left-click
You'll get a new constant attached to the node that is the proper type for that particular kind of node. In this case a PWM constant.
The PWM constant by default starts as Invalid, so put the cursor on the new constant until the cursor becomes a hand, then left-click and choose the PWM it should be.

ICE_Bear
10-02-2016, 19:58
Where do you find open 4 motor?

Mark McLeod
10-02-2016, 20:14
It's in the Robot Drive palette:

Right-click on any white space and you'll get the palette popup
Put the cursor over the WPI Robotics Library at the bottom
The top left icon is a folder for RobotDrive, move the mouse over that
You'll see Drive Open 4 Motor
Left-click and drag it to the block diagram

ICE_Bear
11-02-2016, 17:46
Is there any thing else we need to do to get it working?

Mark McLeod
11-02-2016, 22:59
I'd suggest posting your Begin.vi and Teleop.vi here for us to check for you.
They are both located on you PC in the Documents folder under LabVIEW Data and then in your 2016 Robot Project folder.

You can post attachments using the Manage Attachments button on the Reply to Thread page.

ICE_Bear
12-02-2016, 18:23
A Victor SP is attached to PWM 0 that drives the rear left motor and PWM 1 is connected to rear right. A Victor 888 motor controller is connected to PWM 2, running front left and the PWM 3 is running front right.

Mark McLeod
12-02-2016, 19:46
There is a little anomaly in Begin.vi with both
- the constants for PWM 0 and PWM 1, and
- the Inverted flags

They still have the labels from previously being part of an Open 2 Motor.
I'd recommend that you delete those four constants and do a create constant for them again.

After you've gotten new constants there, turn on the label for each of them by hovering the cursor over them and right-clicking to get the popup menu and choosing Visible Items -> Label (You can drag the labels around to better places too if you would like.)
With the Open 4 Motor there are also two more Inverts located along the bottom edge of the Open 4 icon that you need to create constants (and labels) for.

An issue is that because you had constants left over from the 2 Motor, they reverse only one of the motors on the left side (I think the left rear). So the left side motors would be fighting each other.

So, make sure to Invert both Left side motors (make them T for true).
If when you test the robot you find that the front and back are reversed, then just reverse all the Inverts and make the Left side motors False and the right side motors True.

ICE_Bear
12-02-2016, 20:01
Thank you for all your help. our programming is going well now.