Talon SRX not following other Talon SRX

talonsrx

#1

Hi,
We’ve been encountering problems with having some Talon SRxs follow others: the master talons are getting the command and sending out the signal to the motors (with the masters displaying green) but the slaves are just staying with the yellow light. Were using

left2.follow(left1);

To configure some talons as followers of others. Attached is the file with the full code (look at testPeriodic()). We confirmed that the talons are being configured properly and are still encountering the problem. All help is appreciated.

Robot.java (4.9 KB)


#2

Few more things to add:

The software for the talons is the latest (4.15) and SpeedControllers.getTalonSRX () just calls

new WPI_TalonSRX(port)

Thanks, 4338


#3

Can you post your SpeedControllers object?
How did you check your talons are configured properly, did you use Tuner?


#4

Here: SpeedControllers.java (2.7 KB)

Instead of only setting the values for the masters, I commented out the following commands and set all of them to 1.0. When I did that, all of the talons had blinking green lights (i.e. they’re all capable of receiving commands from the roborio).


#5

I’m not entirely sure why it isn’t working however I feel like it could be to do with mixing phoenix objects with WPI (not that this should be a problem but for the purpose of troubleshooting…).

Try instead of telling the left2 to follow left1 with left2.follow(left1), use left2.set(ControlMode.Follower, left1.getDeviceID) instead. Try this for left2, 3, and right2, 3.

I would also try inverting your left1 and left2 talons before telling the others to follow inverted the inverted state.

Edit:
Updated follow with .getDeviceID


#6

Thanks for the suggestions! I’ll try them out in about an hour when I’ll have access to the robot and post here the results.


#7

I tried changing the place in which I set the inverted state, still didn’t work (master was green slaves yellow).

I tried changing to what you suggested with set(follower, id), still didn’t work (master was green slaves yellow).

I tried changing to TalonSRX from WPI_TalonSRX: The first time I ran the code after doing this, the left slaves were following the left side but the right slaves were not following right. All runs after that, and we were back to master was green slaves yellow… Any clue why this is happening?


#8

Hm, try opening the Phoenix Tuner and confirming that the Talons are actually in follow mode.


#9

Did you check that all your device ids are unique and refer to the correct motor controllers?


#10

Just some advice:
If you’re going to have this paradigm where you have factory classes (or singletons) that return instantiated objects, you should just return them fully instantiated instead of leave it on the onus of the caller to get an instantiated object, and then also fully configure it.

You are not really saving yourself any code by forcing SpeedControllers to return an object if you have to do it all the time.


#11

Also, enable your robot and open the Phoenix Tuner, see if your configuration is working the way you think it is.

We have a 4 Cim drive train, here is a link to our DriveTrain that configures our Talons in follower mode.

Hopefully it helps.


#12

Yes, they are unique.

I tried that, but I couldn’t find where in the config tab it defined whether or not it was a follower… I attached the JSON files here:
drive_left_master.json (5.8 KB)
drive_left_master.json (5.8 KB)
drive_left_master.json (5.8 KB)
drive_left_master.json (5.8 KB)
drive_left_master.json (5.8 KB)
drive_left_master.json (5.8 KB)

I also went into the plot tab, where I saw the master output change when I enabled but the slave output remained the same…

Any ideas?


#13

Just realized it didn’t upload the files correctly, here they are in a zip:
Talon Configs.zip (11.6 KB)


#14

I believe the output of the self-test tells you what’s state it’s in. I can confirm for you tomorrow when I’m back in with a Robot, but I think in the same section that tells you what output mode your in (and the stats related to things like closed-loop) it tells you if you are in follower mode. Somewhere near the voltage percentage is what I have imagined in my head.


#15

Other Ideas, as a temporary troubleshooting step you could try changing the return type from WPI_TalonSRX to TalonSRX proper to see if you get the follower changes you expect.

This requires you change the .set() call to be .set(ControlMode, double) but that’s a fairly simple test you could try.


#16

Already tried that and weird stuff happened in the first time, all other times it didn’t work the same… (See:


#17

Some good news: I just changed something and it worked!

Honestly, I have no clue why it’s even related, but I saw that the master talons were showing an error of no sensor connected so I plugged in a Mag Encoder (which we’ll use anyways) and now it works:)

Thank you very much for everyone that tried to help me on this thread,
Good luck!

EDIT: This was not related, see next two posts.


#18

With my luck, the problem is back… It worked perfectly for about 2 hours of driving, but then it suddenly stopped following without any change in the code… Any ideas?


#19

After going back and forth between my code from 3hrs before and the code with it not working (using git), I figured out the ultimate problem for why it wasn’t working for me: I was using test mode instead of teleop… Had nothing to do with the Talon Config, just that if you use test mode it seems to interrupt the talon following. I tested this at least 5 times with that being the only change and I saw this difference in all tests. Out of curiosity, does anyone have an idea for why they’re related?


#20

No clue why, but that is a crazy nugget to find. Thanks for the research.

They do have an FRC Locked setting that happens when they detect there are frc objects being used, maybe that is one of their artifacts of that type of lockage.