CIM driving 2x faster than others

We just tested driving our bot for the first time since we switched to the new black jaguars. the problem is that one of the cims is driving twice the speed of the other three. we checked all the pwms and made sure that the power was hooked up right. Any Ideas?

Without seeing any code, may I suggest putting the “bad” CIM onto a jaguar that you know works, and put a “good” one on the jaguar that you think may be faulty? That will tell you if it’s the CIM or the Jaguar.

If it’s the jaguar, the next step is to use BDC-Comm to set voltage to two different jaguars, the good and the bad, to the same voltage, then use its output to see whether the speed is the same (roughly). If they’re not, it’s probably the jaguar itself. If it is, it’s probably something in the code and you should check your logic carefully.

Make sure the problem isn’t mechanical. Try spinning the gearboxes by hand (backdrive them) and see if the slow one is much harder to spin than the others.

here is our code is there anything wrong there?

#include "WPILib.h"
#include "Vision/AxisCameraParams.h"
#include "math.h"
#include "CustomMath/CustomMath.h"
#include "C:/WindRiver/workspace/2011_IceRobotics/Xbox360/Xbox360.h"


class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	//Joystick leftstick; // left joystick
	//Joystick rightstick; // right joystick 
	Joystick armstick;
	HSLImage image; // camera
	DigitalInput *left;			// digital inputs for line tracking sensors
	DigitalInput *middle;
	DigitalInput *right;
	Victor vicShoulder;
	Victor vicElbow;
	Victor vicWrist;
	Victor vicClaw;
	Xbox360 xbox;
	DigitalInput *sfsensor; //front sensor
	DigitalInput *sbsensor; //back sensor
	DigitalInput *efsensor; //front sensor
	DigitalInput *ebsensor; //back sensor
	DigitalInput *wfsensor; //front sensor
	DigitalInput *wbsensor; //back sensor
	Gyro gyro; 
	//ADXL345_I2C acc;
	//Encoder En;

	
public:
	RobotDemo(void):
		myRobot(1, 2, 3, 4),	// these must be initialized in the same order
		//leftstick(1),		// as they are declared above.
		//rightstick(2),    	// as they are declared above.
		armstick(3),
		vicShoulder(6),
		vicElbow(7),
		vicWrist(8),
		vicClaw(9),
		xbox(1),
		gyro(1,1)
		
		//acc(1),
		//En()
	{
		myRobot.SetExpiration(0.1);
		left = new DigitalInput(2);
		middle = new DigitalInput(1);
		right = new DigitalInput(3);
		sfsensor = new DigitalInput(6,1);
		sbsensor = new DigitalInput(6,2);
		efsensor = new DigitalInput(6,3);
		ebsensor = new DigitalInput(6,4);
		wfsensor = new DigitalInput(6,5);
		wbsensor = new DigitalInput(6,5);	
	
	}

	
	void Autonomous(void)
	{
		myRobot.SetSafetyEnabled(false);
		
		//gyro.Reset();
		//gyro.GetAngle();			// current heading (0 = target)
		AxisCamera &robocam = AxisCamera::GetInstance();
		robocam.WriteResolution((AxisCamera::Resolution_t)3);
		robocam.WriteBrightness(0);
		while(IsAutonomous()){
		
		// read digital inputs	
		unsigned short leftValue = left->Get() ? 4 : 0;	// read the line tracking sensors
		unsigned short middleValue = middle->Get() ? 2 : 0;
		unsigned short rightValue = right->Get() ? 1 : 0;
		
		
		//begin Line tracking
		switch(leftValue + middleValue + rightValue){
			//void MecanumDrive_Cartesian(float x, float rotation, float y, float gyroAngle = 0.0);
			case(0x0): // normal operation
			case(0x5):
			case(0x7):{
				//This and 0x0, 0x5, are all the messages recieved if there is no line found
				
				break;
			}
			case(0x1):	// straif right
			case(0x3):{
				//0x1, and 0x3 for when the robot sees the line to the right
				
				//Checks to see what the middle value is, and runs until the middle sensor returns true or sees the line
				while (middleValue != true){
					myRobot.ArcadeDrive(0.0, 0.50);
				}
				break;
			}
			case(0x2):{
				//This is the case for the middle
				
				while (middleValue == true){
					myRobot.ArcadeDrive(0.5, 0.0);
				}
				break;
			}
			case(0x4): // straif left
			case(0x6):{
				//This case statment if for when it sees the line on the left sensor
				while (middleValue != true){
					myRobot.ArcadeDrive(0.0, -0.5);
				}
				break;
			}
			default:{
				break;
			}
		}
		
		if (leftValue + middleValue + rightValue == 0x0 || 0x5 || 0x7){
			//The line has ended and this code is for the arm
			
		}
		}
		Wait(3.0);
	}

	
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		AxisCamera &robocam = AxisCamera::GetInstance();
		robocam.WriteResolution((AxisCamera::Resolution_t)3);
		robocam.WriteBrightness(0);
		gyro.Reset();
		Wait(3.0);
		
		while (IsOperatorControl())
		{
		// read digital inputs	
		unsigned short leftValue = left->Get() ? 4 : 0;	// read the line tracking sensors
		unsigned short middleValue = middle->Get() ? 2 : 0;
		unsigned short rightValue = right->Get() ? 1 : 0;
		
		//Look for line sensor inputs only when selected
		if (xbox.GetRightBumper()){
			switch(leftValue + middleValue + rightValue){
			case(0x0): // normal operation
			case(0x5):
			case(0x7):{ 
					//printf("no line found 
");
					//void MecanumDrive_Cartesian(float x, float rotation, float y, float gyroAngle = 0.0);
					if (!xbox.GetLeftBumper()){
						myRobot.MecanumDrive_Cartesian(-xbox.GetRightX(), -xbox.GetLeftX(), -xbox.GetLeftY(), 0); //Mecanum drive at full speed
					}
					else{
						myRobot.MecanumDrive_Cartesian(-xbox.GetLeftX(), -xbox.GetRightX(), -xbox.GetLeftY(), 0);//Mecanumdrive at half speed
					}
					break;
					}
			case(0x1):	// straif right
			case(0x3):{ 
					// printf("right leftstickX = %f, abs = %i
",leftstick.GetX(), abs((int)leftstick.GetX()));
					float leftvalue = (fabs(xbox.GetLeftX())/-2);
					//printf("right leftstickX = %f
", leftvalue);
					myRobot.MecanumDrive_Cartesian(leftvalue, 0, -xbox.GetLeftY(), 0);
					break;
					}
			case(0x2):{ // keep going
					//printf("middle 
");
					myRobot.MecanumDrive_Cartesian(0, 0, -xbox.GetLeftY(), 0);
					break;
					}
			case(0x4): // straif left
			case(0x6):{ 
					//printf("left 
");
					float rightvalue = (fabs(xbox.GetLeftX())/2);
					//printf("left leftstickX = %f
", rightvalue);
					myRobot.MecanumDrive_Cartesian(rightvalue, 0, -xbox.GetLeftY(), 0);
					//myRobot.MecanumDrive_Cartesian(-leftstick.GetX(), -rightstick.GetX(), -leftstick.GetY(), 0);
					break;
					}
			default:
					break;
			}
		}
	
		//void MecanumDrive_Cartesian(float x, float rotation, float y, float gyroAngle = 0.0);
			if (!xbox.GetLeftBumper()){
				myRobot.MecanumDrive_Cartesian(xbox.GetLeftX(), xbox.GetRightX(), -xbox.GetLeftY(), 0); //Mecanum drive at full speed
			}
			//																	forward/back
			else{
				myRobot.MecanumDrive_Cartesian(xbox.GetLeftX()/2, xbox.GetRightY()/2, xbox.GetLeftY()/2, 0);//Mecanumdrive at half speed
			
		}
		//Arm Code
				//sf=shoulder front sensor
				//sb=shoulder front sensor
				//ef=shoulder front sensor
				//eb=shoulder front sensor
				//wf=shoulder front sensor
				//wb=shoulder front sensor
				
				//Shoulder Control
				if(((!sfsensor->Get())||(armstick.GetY()<0)) || ((!sbsensor->Get())||(armstick.GetY()>0))) vicShoulder.Set(armstick.GetY()/2); //Shoulder Motor		
				
				//Elbow Control
				if(armstick.GetRawButton(2)){								
					if((!efsensor->Get() && !ebsensor->Get())||				//Not either sensor
							((efsensor->Get() && (armstick.GetY()<0))||		//on front sensor moveback only 
							((ebsensor->Get() && (armstick.GetY()>0)))))	//on back sensor
								vicElbow.Set(armstick.GetY()/2);
					}
				//Wrist Control
				if(armstick.GetRawButton(3)){								
					if((!wfsensor->Get() && !wbsensor->Get())||				//Not either sensor
							((wfsensor->Get() && (armstick.GetY()<0))||		//on front sensor moveback only 
							((wbsensor->Get() && (armstick.GetY()>0)))))	//on back sensor
								vicWrist.Set(armstick.GetY()/2);
					}
				//Claw Control
				if(armstick.GetTrigger()){
					vicClaw.Set(armstick.GetY()/2);
				}
				printf("gyro = %f
", gyro.GetAngle());
				Wait(0.005);// wait for a motor update time
		}
		
	}

};

START_ROBOT_CLASS(RobotDemo);

anyone???

Quick glance this looks suspect. For full speed you have ‘-’ in front of xbox.GetLeftY(). And it is positive in the half-speed version.

		if (!xbox.GetLeftBumper()){
				myRobot.MecanumDrive_Cartesian(xbox.GetLeftX(), xbox.GetRightX(), -xbox.GetLeftY(), 0); //Mecanum drive at full speed
			}
			//																	forward/back
			else{
				myRobot.MecanumDrive_Cartesian(xbox.GetLeftX()/2, xbox.GetRightY()/2, xbox.GetLeftY()/2, 0);//Mecanumdrive at half speed
	

the “-” just makes it so it dose not drive backwards and i do not think that would affect the speed of one single jaguar speed controller

Did you forget your machine keys while installing one? That could easily cause an issue while driving.

I’ll check tommaorw