Initialization issues with Talons.

This is our first year using C++. We’ve used LabView for the last several years, but our programming team finally made the switch for this season.

We’re having an extremely weird issue with our code. We are using a mecanum drive system, and have not had issues until we attempted to add a fifth controller for our manipulator. We are using the RobotDrive class to initialize our first four controllers (using myRobot(1, 2, 3, 4) for init).

I attempted to add a fifth controller using this:

Talon shooter;

shooter = new Talon(6);

Once I deploy the code and reboot, every time I enable the robot (in either Teleop or in Autonomous), all the motors spin in reverse for about a quarter of a second and then disable.

For sake of troubleshooting, I tried removing all drive code and then reinitialize all the controllers manually as Talons. Once I did this, I cannot get the motors to spin at all. When I click Enable, the controllers enable for a split second and then disable. During that split second, I cannot give any value to the controllers, either directly in the code or by joystick input.

Anyone have any ideas?

Here’s my full code:

#include "WPILib.h"
#include <math.h>

/**
 * This is a demo program showing the use of the RobotBase class.
 * The IterativeRobot class is the base of a robot application that will automatically call your
 * Periodic methods for each packet based on the mode.
 */ 
class RobotDemo : public IterativeRobot
{
	double joyX, joyY, joyZ;
	//RobotDrive myRobot; // robot drive system
	Jaguar  LF, LR, RF, RR, talonFive, shooter;
	Joystick stick; // only joystick
	Gyro fieldOrientation;

public:
	RobotDemo():
		//myRobot(1, 2, 3, 4),	// these must be initialized in the same order
		LF(1),
		LR(2),
		RF(3),
		RR(4),
		talonFive(5),
		shooter(6),
		stick(1),		// as they are declared above.
		fieldOrientation(1)
	{
		//myRobot.SetExpiration(0.1);
		//shooter.SetSafetyEnabled(false);
		//shooter.SetExpiration(0.1);
		this->SetPeriod(0); 	//Set update period to sync with robot control packets (20ms nominal)
	}
	
/**
 * Robot-wide initialization code should go here.
 * 
 * Use this method for default Robot-wide initialization which will
 * be called when the robot is first powered on.  It will be called exactly 1 time.
 */
void RobotDemo::RobotInit() {
}

/**
 * Initialization code for disabled mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters disabled mode. 
 */
void RobotDemo::DisabledInit() {
}

/**
 * Periodic code for disabled mode should go here.
 * 
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in disabled mode.
 */
void RobotDemo::DisabledPeriodic() {
}

/**
 * Initialization code for autonomous mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters autonomous mode.
 */
void RobotDemo::AutonomousInit() {
}

/**
 * Periodic code for autonomous mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in autonomous mode.
 */
void RobotDemo::AutonomousPeriodic() {
}

/**
 * Initialization code for teleop mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters teleop mode.
 */
void RobotDemo::TeleopInit() {
	fieldOrientation.Reset();
}

/**
 * Periodic code for teleop mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in teleop mode.
 */
void RobotDemo::TeleopPeriodic() {
	//myRobot.ArcadeDr1ive(stick); // drive with arcade style
	joyX = pow(stick.GetX(), 3);
	joyY = pow(stick.GetY(), 3);
	joyZ = pow(stick.GetRawAxis(3), 3);
	//myRobot.MecanumDrive_Cartesian(-joyX, -joyY, joyZ, fieldOrientation.GetAngle());
	
	//shooter.SetLeftRightMotorOutputs(pow(stick.GetRawAxis(4), 3), pow(stick.GetRawAxis(5), 3));
	LF.SetSpeed(pow(stick.GetRawAxis(5), 3));
	LR.SetSpeed(pow(stick.GetRawAxis(5), 3));
	RF.SetSpeed(pow(stick.GetRawAxis(5), 3));
	RR.SetSpeed(pow(stick.GetRawAxis(5), 3));
	talonFive.SetSpeed(pow(stick.GetRawAxis(5), 3));
	shooter.SetSpeed(pow(stick.GetRawAxis(5), 3));
}

/**
 * Initialization code for test mode should go here.
 * 
 * Use this method for initialization code which will be called each time
 * the robot enters test mode.
 */
void RobotDemo::TestInit() {
}

/**
 * Periodic code for test mode should go here.
 *
 * Use this method for code which will be called periodically at a regular
 * rate while the robot is in test mode.
 */
void RobotDemo::TestPeriodic() {
}

};

START_ROBOT_CLASS(RobotDemo);

Check your power to the Digital Sidecar.

The 5V LED and Battery LED are on, 6V is off. RSL is functioning normally.

If the 6v LED isn’t lit, there is definitely a problem. How many are lit if you remove the DB-37 cable?

Not near the robot at present (will be on Monday and I’ll answer your question). Why would that affect some code but not others?

The digital sidecar can receive leakage current through the DB-37 cable, which is enough for it to work in some cases, but not others. You should verify that the Digital Sidecar power is connected to a 20 amp breaker, and that all connections are good.

Sorry for taking so long to get back with you all, got caught up with other robot stuff.

The issue turned out to be a wiring issue with the Sidecar. It got wired to the regulated 5V out on the PDB… Oops.

Thank you all for your time and suggestions!

I can promise you that y’all weren’t the first team to do exactly that same thing this year. There is a reason I recognized the symptoms immediately. :wink:

lLad y’all got it fixed. Good luck.