Programming

I’ve been trying to get the robot to work for a month as I am the sole programmer on my team. I can get the motors to run but only through the the test software. I have tried simple programs from other forums to put into labview but they are configured for the use of PWM, we are using CAN. I have tried using the third party pieces in the labview software that is specific to the motor controllers that we us (Victor SPX) but nothing has worked. I am open to try using WPILIB but I don’t know where to beign with it and I don’t know how to use C++. I would also be open to configuring our robot into PWM but I can’t seem to find anything out there showing how to do it correctly. Any help would be great.

You’ll find a lot of helpful snippets here:

http://www.team358.org/files/programming/ControlSystem2015-2019/labview/index.php#CANDrive

CAN control is trickier than PWM. You need do download the appropriate library, and then set the ID of each speed controller.

What would the wiring look like for PWM? I’ve tried things based off of pictures from other teems but the motor controllers blink red instead of the yellow they already blink from the CAN. I have changed the ID of each controller in the configuration software already but I’m not sure where to go from there.


it explains how to do it in the Victor SPX users guide and there is other info about the controller.

You’ll want to take a look at the User Guide for the Victor SPX here:

If you go the PWM route only one of the yellow-green pairs from each motor controller are used, and it plugs into the PWM ports on the Rio. (Only if you use CAN are the Victors daisy-chained one to the other.) From the guide, the green wire is plugged into ground, the yellow is the signal.

Here’s a photo of a Victor SPX wired via PWM if it helps.
Only the female end of the yellow/green control wire is used. The male pigtail just gets coiled and tied up out of the way.
There are also black/red/white PWM extension wires that came in your KOP, so the Victor can be further away.

If you already have the CAN wired, all of the Victors with a CAN ID, and you’re just trying to figure out how to get the code working, you should avoid making a swap to PWM.

I say this for two reasons:

  1. It’s more work to change the hardware setup than the software
  2. You’ll be better off long-term by understanding how to get the CAN working.

CTRE has LabVIEW examples linked on their site. I’d take a look at those paying special attention to the Begin.vi. In that VI, they’ll open a few motors and wire their pink wire into an “Existing Motors” VI. From there, the pink wire from Existing Motors should act like the rest of the example code you’ll find built into the project. We just need to help you understand how to get those motor references open.