Running the Labview Example CAN Talon Code

I’m having trouble getting the example code to work for the encoder with CAN. I have an SRX wired up, with power to a motor with an E4P attached and connected to the SRX via ribbon cable (which has been modified and soldered onto the E4Ps connector).

Perhaps I’m misunderstanding the example, but when I run it and adjust the slider, nothing happens to the motor.

(Extra info: I assigned the Talons separate IDs using the web viewer. I set the one hooked up as the Master Talon. I set the slave to one of the talons that’s not hooked up. I didn’t update firmware now that I think of it :grimacing:. Could that be the issue?)



Is the firmware up to date? Reflash steps and close looping troubleshooting steps are in the Talon SRX Software Reference Manual.

Thank you. I’ll try that today.

So I updated the firmware. When I attempt to run the example, adjusting the speed slider doesn’t do anything. Should it? Or am I misunderstanding the example’s purpose?

I’m only running one SRX, set to ID 1, so I set the master in the code to 1, and the slave to 2 or 3, since I don’t have a second hooked up.

When I manually turn the motor, feedback does register.

Also, an aside, why would it be that three of the SRXs have their B/C CAL lights on and the others do not?

Did you use the Driver Station to enable the robot? None of the motor outputs will be active until you do that.

The lights should be telling you whether the speed controller is in Brake or Coast mode. You can verify that using the RoboRIO web dashboard.

The ones with B/C cal lights on are in brake mode. This will not stop them from running, so probably not the cause of your immediate issue. You can change the brake/coast status in the web dash, as mentioned above, or in code with the srx API.

I did not have the robot enabled at the time I ran the example code. I didn’t think that VIs run with Labview opened and when the robot was tethered were affected by the Driver Station…didn’t have any basis for that so I don’t know why I thought it.

I’ll try again tomorrow, with the robot enabled in the DS, and the code running in Labview.

I’ll check the brake/coast modes. Thank you!

Thank you! The motor is now running.

One issue. I can hear and see the motor running, and I can hear and see it changing speeds as I adjust the slider. But the ‘actual speed’ graph isn’t changing.

I haven’t begun to tune PID yet. P is set at 1, I and D at 0. There’s also an F here. It’s set at .01, but since I’m not sure what it is or how it affects things I’ve tried running this with F at 0, .01, and 1.

So hopefully that’s the relevant info. I just don’t seem to be able to see an actual speed.

Is there any way this could be an issue with the encoder? Could damage to it cause this? Or is this just something I’m missing?

I ask because the encoder wasn’t necessarily treated wonderfully during its install time…:grimacing: unfortunately so.

I’ve ordered some new ones that I’ll make sure to take special care of.

However, if this isn’t the encoder, what is this?



The “actual speed” does come from the encoder. You can verify the encoder’s operation using the RoboRIO web dashboard.

What kind of encoder are you using, and how is it wired?

I have an E4P hooked up to the Talon SRX via modified talon connector cable (see blurry attached pic). When I move the slider, the motor visibly and audibly speeds up, but the actual speed line on the graph does not move to meet the set motor speed line. I also have attached a picture of the self-test from the NI Web Viewer that I took while the motor was running.

The same thing happened when I tested the Versa Planetary Integrated Encoder on a gearbox. The motor changes speed, but the actual speed line does not move.

The web information suggests that the encoder itself, or the wiring to it, is not working. As you turn the shaft where the encoder is mounted, do you ever see the A input as anything other than 0, or the B input as anything other than 1? If one or both is stuck, the SRX position count won’t change.

Okay. When I first had trouble with this example, I used a multimeter to check the resistance of each wire, confirming that we fused the wires correctly. Also, when the encoder is plugged in, the LED lights up.

I suppose that the encoder is most likely damaged. The LED may light up anyway.

I’ll check the counts for A and B tomorrow.

So those Versa Planetary Integrated Encoders came in a few days ago. I hooked them up and tried them out using this same example (I opened the block diagram and made sure to change the encoder type to the correct one). I didn’t have to fuse any wires, since the SRX Cables plug directly into the Integrated Encoders.

As with the E4Ps, the speed can be heard and seen to change, but actual speed does not change on the graph. Also, the LED on the encoder is yellow, as the manual states it should be during normal operation. I don’t know why there would be an issue with these.

Thank you.

The E4Ts we’re planning on using on the final robot came in today. I mounted one on my test motor. This time I did see actual speed register. But the slider was hardly in control. As I adjusted it the motor oscillated quickly from the -5000s to the 5000s. I figured this might be an issue with PID tuning (P is 1, I is 0, D is 0, Feed Forward is .01), but adjusting P just made the issue happen later in my sliding. I tried values of P between .1 and 2.

Once the oscillation starts, and will not stop when I return the slider to 0. Any suggestions?



That sounds like your feedback is opposite of your control. Use the “invert sensor” option. (I don’t have LabVIEW available at the moment, so I don’t know exactly what it’s called in the example.)

If you don’t have much load on the motor or inertia in the system, you will find it to be very difficult to get it to stabilize. If you can limit the motor power’s rate of change, doing it will help a lot.

I recommend that LabVIEW teams look at the Speed Servo example covered in the Talon SRX Software Reference manual, which has a complete walk-through and example VIs for almost every sensor type. Its more comprehensive than the Speed Example that comes in with the LabVIEW installer.