Tank Mode help?

I’m trying to code a tank drive and I am very new to it so I am now using the “Example files” from the help menu but I don’t know how to modify them to make them work. Here is my Begin so far:

Here is my Teleop:

Can anyone tell me what I am doing wrong? I get the Talons to light up solid orange but they won’t do anything from there.

I am relatively new to coding but one thing I notice is that you do not have a control mode set for the talons. Also, replace open 2 motors on teleop with RefNum Get. Here are some pictures of my code.

Also, this has been a life saver for me
http://www.team358.org/files/programming/ControlSystem2015-2019/labview/index.php

I currently have all of the Device Numbers set to 0 because I don’t have the electrical done so I don’t know the device numbers yet.

If you are using the default LV project structure, then your Teleop is not compatible with that structure.

Your Teleop is a stand-alone LabVIEW program that defines two Talons as running over PWM (not CAN).

You have Talons on CAN defined in the Begin you showed.

1 Like

Definitely all of Mark’s comments are right. That basically it is mainly the code within the loop of the picture labeled Teleop.vi that should actually be in there. Re-opening motors you opened in Begin.vi and the loop I think will cause the teleop.vi not to finish in the 20ms time.

It may be worth trying to reduce your problem a bit for troubleshooting. Maybe try to get the drive motors all working. Start fresh with a new robot project, to get the correct Teleop.vi also. And if needed, take the other controllers offline (pull circuit breakers). If it points to CAN problems, bypass some until you figure out where the problem is. Once you identify the problem, you can copy code over from your current project.

I am not so familiar with opening multiple Drive VIs, and have usually opened the other motor controllers in Begin.vi with the third party CTR VIs. Because I didn’t need the drive references, since I was using it like AvKauf’s code. But I don’t have any reason to think you can’t.

1 Like

Try running the TeleOp code you have (without any other code in TeleOp by putting disable structures around any other code) but with the following change.
Replace the Open Drive Motors VI in TeleOp with the Open 4 Drive Motors VI you have in Begin with the VIs that are already wired to the left side of it (i.e. copy and paste from Begin).

When you run TeleOp, click the run arrow in the TeleOp VI (not Robot Main), this will run TeleOp without first running Begin. I don’t normally tell people to run TeleOp this way so do it this way just this once. Make sure the electrical part of your drive system works and then worry about breaking things up into Begin, TeleOp and Finish.

I tried this to the same avail:

I am also having this trouble in Driver station now:

ERROR -8003 Phoenix Motor Controller 7 Get Percent Output CAN frame not received/too-stale. Phoenix Motor Controller 7 Get Percent Output

For the picture you just posted the top part looks fine for 2 joystick true tank style drive.

I am not really a fan of just running Teleop like that and find it confuses just as often as it helps.

Did you see anything when you ran this code? Did any of the lights on the talons change?

That error generally indicates a problem connecting to at least one of the Talons that you have set up. I would make sure that you have all of the device IDs and everything right by checking them using Phoenix Tuner.

That’s not what I meant. This is what I mean. Put it in TeleOp.

Like I said I don’t normally recommend running TeleOp like this either but the last TeleOp screenshot that BugBots posted (in the first post of this thread) will definitely not work since it is trying to control via PWM. But if it is run by itself (i.e. without Robot Main) and the PWM is changed to CAN as I have described, the code should work and BogBots can make sure the electrical is right.

Yea i know very little but enough to know that thats a problem. they have to be numbered for them to know if they should do anything.

Oh. I just saw BogBots post in another thread. Congratulations!

As a quick mention, the begin VI is where you open your references (as you’ve shown). In the Teleop VI, you shouldn’t be using any of the open motors calls. Instead, you’ll want to use the get reference calls and use the same name you created in Begin.vi.

Realistically, you should be able to open up the default project and modify the Begin.vi to use your motors. Once that’s done, you’d need to update the axis values in Teleop. With those two modifications, I’d expect the robot to drive.