LabVIEW Help

Hello FRC Community:

We are a rookie team this year! I normally teach physics and chemistry and some math up to calculus. I tinker with stuff too. My district thought it would be wonderful if we had a robotics offering at my high school. So, guess who was elected?

I know some Python, but no Java, C++, or LabVIEW. I am going with LabVIEW this year solely because I thought I could get my head wrapped around it better than the alternatives. Now, I am in over my head (as usual).

Our robot is mostly built, but not programmed. We are using the Talon SRX CAN configuration for driving. I tried writing some basic LabVIEW code, but all my Talons do is blink orange. I have updated them and used the Tuner software to assign them individual IDs and names. They will even flash when I blink them from the program. Aside from that, nothing.

So, I am now getting closer to desperate. I do not want to let the kids down with a non-functioning robot. I am appealing to anyone for help. Can anyone send me please a screen shot of a simple tank drive block diagram from LabView that I can see.

Before anyone says it, yes I have looked on the FRC, NI, CTR, and Google sites. I have found some examples of partial code. I do not know even where to start, however. I need an A to Z model. I know that may be asking a lot, but I though I would ask.

Thank you in advance.

I’m not a programmer, but my team is a LabView team and so I’m familiar with some of the resources I most often point my kids towards. Have you checked team 358’s LabView page? Good stuff here to perhaps get you rolling: http://www.team358.org/files/programming/ControlSystem2015-2019/labview/index.php

1 Like

Curtis, where are you located? Carmel California?

Close. Castroville, CA

What kind of joysticks are you using (model)?

How many drive motors, e.g., 2 per side or 1 per side?

If the Talons are blinking after you Enable the robot from the Driver Station, then the code may not have opened them properly.

This sample assumes you are starting with the default Arcade Drive project with no other changes.
It is using two joysticks to drive with (driving with a game controller has some slight differences).
And you have to verify the position of the joysticks in the Driver Station USB tab.

Curtis, I’m sure you’ll get a lot of help on this thread but DM me if you’d like to try and schedule a TeamViewer session so you can share a screen and voice chat at the same time.

Trust me if you are getting the Talons to blink using Tuner then you are only 10 minutes away, with proper code, of getting that robot to drive.

All we get is orange blinking lights on the MCs.
What is wrong with our code?
We are using 4 motors (2 left/2 right) each with a Victor SPX from CTR and a Logitech Extreme 3D Pro joystick.

Here is a look at our Tuner devices. They will blink when selected. Do we need to do anything else to them?

No luck so far, just blinking orange LEDs on the MCs.

Do you need to do anything else to them to configure them?

At the risk of being thick…

Do we need to do something other than type in the code to LabVIEW, save, and run it? You mentioned that, “This sample assumes you are starting with the default Arcade Drive project with no other changes.” So, does that mean we need to download something else?

This code is very wrong. You have code to open and define motor controllers in the same vi as the code you are trying to use to drive the motor controllers.

Also this code is in some custom vi called Chris.vi
Inside of what vi is this code running?

Your code that opens the motors belongs in begin.vi and the code that drives the motors belongs in teleop.vi

OK, at the risk of being thick again…

How do you separate them? I mean the open motor boxes are connected to the controllers by the pink lines. I know that probably sounds very basic, but like I said I’m a physicist not a programmer. (Why cant I just use MatLab or Python?)

I think I understand about the placement of the code in the correct vi’s now. I was not aware that was how LabVIEW worked (basic ignorance on my part again). I thought the program could be written in a created file and then downloaded to the RoboRIO from it. Apparently, if I understand you correctly, LabVIEW designates specific file locations for specific code pieces. Is that correct? If so, how does it join them?

Thank you for the insight. My learning curve is a cliff.

I would love to get your direct help! Thank you!!

If you wanted to use Python to program your robot, the RobotPy project is available at https://robotpy.github.io/. I’ve personally never used it, I program C++ with my team, but I’ve heard good things about it if it’s a more familiar environment for you.

Here is a resource that might help to learn labview and learn about the robot framework…

1 Like

So, in all of the languages there is a basic framework to start from that does all the background tasks you need to get a complete running system.
While you can write your project from scratch, there is some basic communication to the Driver Station that has to be setup first. And there are field states (Disable, Autonomous, Teleop) that your code has to be capable of responding to.

That background framework is handed to you, so that you don’t have to understand everything all at once.
It also organizes your code structure in a common way making it easier for all of us to help each other.

To start from the default Arcade Drive program:

  1. Open LabVIEW and you should see this window if everything has been properly installed (Note: all that stuff under OPEN is just a list of the most recent files that I had open on my PC here at home):

  2. Choose FRC roboRIO Project under NEW and you will get this:
    2

  3. Enter your team number in the highlighted field and click FINISH to get your default Arcade Project. Your Team number will identify your robot to the competition field and to your Driver Station app running on your PC. There will be a lot of robots and the team number is how we tell them apart.
    3

Expand the Target and Team Code directories and you will see the vi’s that you should be placing your new code in.

This project is a complete user code as is and can be downloaded to run of your roboRIO.
That’s a good first test anyway.

Whenever you work on your robot project, always open the whole project so you get everything necessary to run.

Now, to complete the steps in beginning operation, compile and download your unchanged project to you roboRIO and test it.

A) At the very bottom of your project file list is “Build Specifications”.
Expand that to see the default build spec.
Right-click on that and choose “Build” to compile your program.

B) That will show a bunch of pop-ups as it compiles and checks your default program.
When it is done it will stop on this pop-up and just click Done.
4a

C) Then connect a USB cable to your roboRIO and you can download your compiled program.
Right-click on that build specification again to choose “Run as startup” to start the transfer.

That’s the process of getting your code onto the roboRIO permanently.

Now you can go back and edit Begin to add in your specific Talon code.
So, to help with this I’m going to modify my original suggestion slightly to make it easier for a beginner.
None of the code that follows conflicts with the default code that is already there, so just add these, don’t delete anything else.

Note: These pictures that follow are actually LabVIEW code.
Same them to your desktop, then drag the file onto a block diagram to add the code to your project. You can also enter this all by hand if you want practice.

  1. Open the Begin.vi project and drag/drop this image onto the block diagram:
    AddToBegin

  2. Open the Teleop.vi and drag/drop this image onto the block diagram:
    AddToTeleop

Do the Build and Run as startup process with this and I’m hopeful your Talons will stop blinking.



Have you used the required Driver Station app yet to connect to the robot?
The robot needs that to run.
For safety reasons the Driver Station and the roboRIO must be in communication for the robot to operate.
The Driver Station must ENABLE the robot for the robot to start.
The Driver Station must be given your team number to be able to find your robot.

2 Likes

Thank you again!
I feel we are getting closer. Another silly question, however, on the drive code, do we need to switch from PWM 0 to something else as we are using CAN?

Yes, normally you’d just comment out that section of code, because what I provided above replaces it.
However, the code and steps I provided above just sidestep that issue.
It will work, as is without any additional changes.
It will have the default logic to drive motors off PWM 0 & 1, and the extra code to also drive motors over CAN.
They can both be there. They won’t interfere with one another, and nothing will happen if you don’t plug anything into the PWM outputs. If you do plug something in then those will work, too.
In fact, we often setup multiple PWM outputs to support testing robot mechanisms during development-just plug the mechanism to test into the appropriate output and there’s no need for a programmer to always be around.

I purposely avoided having you delete or change anything for the first round of your getting used to LabVIEW. Mistakes can easily be made until you get accustomed to what everything is doing and why it is there.

The default code assumes motors controlled by PWM0 and PWM1, so out of the box it would work if you plugged your yellow/green wires directly into those PWM outputs on the roboRIO and disconnected them from each other and the rest of your CAN network.

It’d be best if you can get this example code driving your robot, before branching out.
Once you get a code project working, then I recommend you save a copy of the entire project folder, so you can always go back to it for reference if some of your additions or changes later break things.

Under Documents->LabVIEW Data you’ll find a folder named 2020 Robot Project and you can just copy that folder and save it to have a backup.

You rock!!!

We are up and running!!!

We can drive tank style wireless. This has been a HUGE motivator for my team and I to finally have a working bot. Now, we have to get our other motors integrated to work on the various buttons on the joystick. One step at a time. We owe you big time!

Thank you again!