Go to Post Safety captains be watchful. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-02-2011, 18:34
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-02-2011, 18:55
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is offline
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
Re: CIM driving 2x faster than others

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.
__________________


GSR Dean's List Finalist 2011
Reply With Quote
  #3   Spotlight this post!  
Unread 12-02-2011, 19:09
Chris is me's Avatar
Chris is me Chris is me is online now
no bag, vex only, final destination
AKA: Pinecone
FRC #0228 (GUS Robotics); FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Glastonbury, CT
Posts: 7,712
Chris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond repute
Send a message via AIM to Chris is me
Re: CIM driving 2x faster than others

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.
__________________
Mentor / Drive Coach: 228 (2016-?)
...2016 Waterbury SFs (with 3314, 3719), RIDE #2 Seed / Winners (with 1058, 6153), Carver QFs (with 503, 359, 4607)
Mentor / Consultant Person: 2170 (2017-?)
---
College Mentor: 2791 (2010-2015)
...2015 TVR Motorola Quality, FLR GM Industrial Design
...2014 FLR Motorola Quality / SFs (with 341, 4930)
...2013 BAE Motorola Quality, WPI Regional #1 Seed / Delphi Excellence in Engineering / Finalists (with 20, 3182)
...2012 BAE Imagery / Finalists (with 1519, 885), CT Xerox Creativity / SFs (with 2168, 118)
Student: 1714 (2009) - 2009 Minnesota 10,000 Lakes Regional Winners (with 2826, 2470)
2791 Build Season Photo Gallery - Look here for mechanism photos My Robotics Blog (Updated April 11 2014)
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2011, 19:15
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM driving 2x faster than others

here is our code is there anything wrong there?

Code:
#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 \n");
					//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\n",leftstick.GetX(), abs((int)leftstick.GetX()));
					float leftvalue = (fabs(xbox.GetLeftX())/-2);
					//printf("right leftstickX = %f\n", leftvalue);
					myRobot.MecanumDrive_Cartesian(leftvalue, 0, -xbox.GetLeftY(), 0);
					break;
					}
			case(0x2):{ // keep going
					//printf("middle \n");
					myRobot.MecanumDrive_Cartesian(0, 0, -xbox.GetLeftY(), 0);
					break;
					}
			case(0x4): // straif left
			case(0x6):{ 
					//printf("left \n");
					float rightvalue = (fabs(xbox.GetLeftX())/2);
					//printf("left leftstickX = %f\n", 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\n", gyro.GetAngle());
				Wait(0.005);// wait for a motor update time
		}
		
	}

};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2011, 22:01
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM driving 2x faster than others

anyone?????
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2011, 22:13
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: CIM driving 2x faster than others

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

Code:
		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
Reply With Quote
  #7   Spotlight this post!  
Unread 12-02-2011, 22:16
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM driving 2x faster than others

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
Reply With Quote
  #8   Spotlight this post!  
Unread 12-02-2011, 23:59
theprgramerdude theprgramerdude is offline
WPI Freshman
AKA: Alex
FRC #2503 (Warrior Robotics)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Brainerd, Minnesota
Posts: 347
theprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud oftheprgramerdude has much to be proud of
Re: CIM driving 2x faster than others

Did you forget your machine keys while installing one? That could easily cause an issue while driving.
__________________
Attending: MN Duluth Regional
Reply With Quote
  #9   Spotlight this post!  
Unread 13-02-2011, 10:24
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM driving 2x faster than others

I'll check tommaorw
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi