Talons losing communications/Robot not driving straight

Hey everyone,

My team has been trying to get our robot to drive our robot straight but there seems to be an issue with talons. A few(random ones) lose communications while driving. As a result, the robot drives at an angle, and never straight.

I have updated the talons to the latest firmware(4.1) and configured them to the right ids.
The robot runs on 3 mini cims fyi.

Although the issue is there when driving forwards and backwards, we noticed that it’s more laggy when driving forwards.

Does anyone know what the problem is?
Heres my drivetrain and joystick command code:

public DriveTrain() {
leftTalon1 = new TalonSRX(RobotMap.leftTalon1);
leftTalon2 = new TalonSRX(RobotMap.leftTalon2);
leftTalon3 = new TalonSRX(RobotMap.leftTalon3);
rightTalon1 = new TalonSRX(RobotMap.rightTalon1);
rightTalon2 = new TalonSRX(RobotMap.rightTalon2);
rightTalon3 = new TalonSRX(RobotMap.rightTalon3);


public void initDefaultCommand() {
	// Set the default command for a subsystem here.
	// setDefaultCommand(new MySpecialCommand());
	setDefaultCommand(new JoystickCommand());

public void drive(ControlMode mode, double left, double right) {
	leftTalon1.set(mode, left);
	leftTalon2.set(mode, left);
	leftTalon3.set(mode, left);
	rightTalon1.set(mode, right);
	rightTalon2.set(mode, right);
	rightTalon3.set(mode, right);

//joystick code:

protected void execute() {

	double turn = -1 * OI.joystick2.getRawAxis(0);
	turn = Math.abs(turn) < .05 ? 0 : turn;
	System.out.println("turn: " + turn);

	double throttle = OI.joystick3.getRawAxis(2) - OI.joystick3.getRawAxis(3);
	//throttle = -1 * OI.joystick.getRawAxis(1);
	throttle = Math.abs(throttle) < .1 ? 0 : throttle;
	drive.drive(ControlMode.PercentOutput, sig(throttle - cubeRoot(turn)), sig(throttle + cubeRoot(turn)));
	SmartDashboard.putNumber("left throttle", sig(throttle - cubeRoot(turn)));
	SmartDashboard.putNumber("right throttle", sig(throttle + cubeRoot(turn)));

public double cubeRoot(double val) {
	if (val >= 0) {
		return Math.pow(val, 3 / 2d);
	} else {
		return -Math.pow(-val, 3 / 2d);

public double sig(double val) {
	return 2 / (1 + Math.pow(Math.E, -7 * Math.pow(val, 3))) - 1;

I would definitely start with simplifying the Talon usage.

Set one as the master, and the other two as followers on each side.

Here’s what we do in our DriveTrain() constructor:

// Instantiate the Talons, make sure they start with a clean configuration, then 
		// configure our DriveTrain objects
		left_motor_master = new TalonSRX(RobotMap.LEFT_TALON_MASTER);
		left_motor_slave = new TalonSRX(RobotMap.LEFT_TALON_FOLLOWER);
		right_motor_master = new TalonSRX(RobotMap.RIGHT_TALON_MASTER);
		right_motor_slave = new TalonSRX(RobotMap.RIGHT_TALON_FOLLOWER);


		left_motor_master.configOpenloopRamp(0.15, 0);
		right_motor_master.configOpenloopRamp(0.15, 0);
		left_motor_slave.configOpenloopRamp(0.15, 0);
		right_motor_slave.configOpenloopRamp(0.15, 0);

		// left_motor_master.configClosedloopRamp(0.1);
		// right_motor_master.configClosedloopRamp(0.1);
		// left_motor_slave.configClosedloopRamp(0.1);
		// right_motor_slave.configClosedloopRamp(0.1);

		// Using the Phoenix Tuner we observed the left side motors need to be inverted
		// in order to be in phase
		// Set the followers to follow the inversion setting of their masters

		// Reverse the right side encoder to be in phase with the motors

Full code available on our Github.

Once you have everything all configured and in phase with any sensors, you should be able to see which Talons aren’t able to follow along by observing the LEDs on the Talons as you drive them.

Once you set the Talons as followers to a master, then you just need to call the motor controller set() method on one of them. Simplifies what could be going wrong.

My code used to have follower and slave talons. I still had the same problem. I wanted to remove ambiguity and make each talon independent.

What could be other reasons for this? Something else we found was that, if the joystick was set to it’s max or min value, the motors don’t run.

I would first test each motor individually to see if they need to be inverted or not. You may have some motors wired with their polarities reversed. Secondly, I would test your drive with just your raw joystick inputs first before adding in the math/second joystick axis throttle to see if your math is causing it to fail at Max values (You could also shove the math into an Excel spreadsheet to see if the calculation fails as well).

Yea I used the most basic code for driving(by setting manual speed values).

Something we found through testing in iterative robot is that the motors only run when the speed is at 1. At this speed, the can bus voltage is at least 16. At any other speed, the voltage is around 4

4.1 is definitely not the latest Talon SRX firmware.

what is the latest firmware? and where can I find it?

Latest firmware should be 4.15

1 Like

Thanks for the help – for anyone with similar problems, make sure you have all of the latest 2019 software requirements listed on this site