Victor SPX IDs are all 0 and won't fire in code

Hey ya’ll. So right now I am attempting to get my Victor SPXs to fires off of buttons on my Joystick. Right now we are running Mecanum off of one holonomic Joystick(Logitech) and we would like to fire all three of our SPXs from different buttons. Right now we only have two coded though. However they wont fire in our code but when we test them in Phoenix, they fire but its all three at the same time. We also noticed that all 3 of our SPXs share the same ID of 0 in Phoenix. Anyway I’ve attached some screenshots of what this all looks for us right now. We just wanna get these controllers firing. Thanks guys.

Use the Phoenix Tuner “CAN Devices” tab to assign unique CAN IDs to each of your motor controllers.
See where it says “Change the ID”

The firmware on the motor controller is also out-of-date and should be updated to version 4.15

1 Like

Alright I just did that and I still cant fire them. However that seemed to help. I think its something in my labview code, I could use some help.

Your begin code has all 4 motors using PMW instead of CAN. You need assign the CAN ID number to each of the motors instead of the PWM channels.

1 Like

Maybe you’ve already done this, but you also need to put the newly assigned CAN ID’s into your labview code so the roboRIO broadcasts the CAN message to the proper controller.

FYI the type of device also factors in to the message destination. You can have your PDP, PCM, and one of the SRX’s on ID 0 without issue. It’s when you have multiple of the same type of device with the same ID that you have issues.

In general best practice is to actually not use device ID 0 since it’s the default one a factory reset device picks on the bus - start your actual devices at 1 and go up - that way when you put a new device on the bus it starts at an available address.

So this is what were looking like right now, any suggestions

All three of your CAN devices have been given identical Ref names in Begin.vi.

Quick explanation before I answer: Blue wires represent integers (i.e. whole numbers). Orange wires represent double precision wires (that can have digits to the right of the decimal like 3.531). E-nums are basically drop-down menus and they are represented by blue; E-nums have names for each possible value but internally an E-num is represented by an integer which is why they are blue.

In TeleOp open context help (by clicking the yellow question mark in the upper right or by pressing ctrl + H) and hover over the CAN Motor Set VI. Notice it has 2 inputs which are called “Control Mode” (this is an E-num) and “Output” (i.e. the output motor speed). You have a blue wire going from an add function to the “Control Mode” terminal. You need to delete that wire and right click the Control Mode terminal, right-click → Create → Constant and set it to PercentOutput. To control the Motor with the buttons, delete the orange wire going to the “Output” terminal and wire the add function to “Output”.

This:

If you’re wanting to control all 3 motors with the same value, you can setup Begin like this:
Begin

@BCR-Jim I think SafaFraga means to be using PWM for the drive system and CAN for everything else. So that looks right.

Ok, so they are all firing at once now, I think I know how to assign all that stuff now so thats good… But now I need to know how to adjust the speed/percent output for our motor. Its firing way too fast for us. When I test it in the Phoenix Tuner I’ve determined that we need to have it fire at about percent output level 2. Preferably it would be great to go slow on one input and fast on the other. We are in-taking a ball and need it to mistake slowly and fire quickly. Any help would be great.

Here is how I would do it. I use controls because that way you can play with the motor speeds from the front panel while the code is running (assuming you are running the code from Robot Main). When you have the speeds set where you want them, you have to right-click each of the numeric controls on the front panel and select Data Operations → Make Current Value Default otherwise, when you close the program and re-open it or just Build and Run as Startup, the motor speeds will be lost.

Motor%20with%20Adjustable%20Speeds

I haven’t gotten to use Phoenix Tuner yet so I don’t know what “percent output level 2” means. Is that 2%? If that’s the case you might consider gearing down the mechanism.

Alright so it works but it only runs in one direction. I need it to preferably fire in both directions. This is what it looks like for me right now:

Never mind, I figured it out, thanks though.

1 Like