Go to Post Having someone with as much mainstream appeal as will.i.am is a great strategy to draw large amounts of attention to a program that has been relatively hidden to the masses. - Karthik [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 13-02-2011, 21:58
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: 494
tomy has a spectacular aura abouttomy has a spectacular aura about
Unhappy CIM motor fun

yesterday we test our driving with a xbox 360 controller. it worked fine except for one thing. One of the motors is moving, what we think, twice the speed of the others. We have changed the pwms and double check the connection to the jaguars. Could it be the code????
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2011, 22:07
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: 494
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM motor fun

For reference here is our Telop code

Code:
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		en1.Reset();
		gyro.Reset();
		AxisCamera &robocam = AxisCamera::GetInstance();
		robocam.WriteResolution((AxisCamera::Resolution_t)3);
		robocam.WriteBrightness(0);
		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  right bumber is pressed
		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.GetLeftX(), xbox.GetRightY(), -xbox.GetLeftY(), 0); //Mecanum drive at full speed
					}
					else{
						myRobot.MecanumDrive_Cartesian(xbox.GetLeftX()/2, xbox.GetRightY()/2, -xbox.GetLeftY()/2, 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.GetLeftX(), 0);
					break;
					}
			case(0x2):{ // keep going
					//printf("middle \n");
					myRobot.MecanumDrive_Cartesian(0, 0, -xbox.GetLeftX(), 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.GetLeftX(), 0);
					break;
					}
			default:
					break;
			}
		}
		else {
			//This is how the robot will drive if the right bumper is not pressed 
			//void MecanumDrive_Cartesian(float x, float rotation, float y, float gyroAngle = 0.0);
			if (!xbox.GetLeftBumper()){
				myRobot.MecanumDrive_Cartesian(-xbox.GetLeftX(), -xbox.GetRightY(), -xbox.GetLeftY(), 0); //Mecanum drive at full speed
			}
			else{
				myRobot.MecanumDrive_Cartesian(-xbox.GetLeftX()/2, -xbox.GetRightY()/2, -xbox.GetLeftY()/2, 0);//Mecanumdrive at half speed
			}			
		}
Reply With Quote
  #3   Spotlight this post!  
Unread 14-02-2011, 15:28
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: 494
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM motor fun

Anyone know what the problem is cause we cant figure it out and its getting frustrating...
Reply With Quote
  #4   Spotlight this post!  
Unread 14-02-2011, 21:20
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: CIM motor fun

You did not describe too much detail on what the problem was. For example, under what condition when the problem occurred (i.e. which button did you push or what were the joystick positions, basically which code path it took)? Which motor is moving twice the speed as the others? What happens if you move the joysticks? I don't quite understand your code. While it is teleop code, you are reading the light sensors to follow the line but yet you are also reading the joysticks too? Are you doing some sort of assisted drive? If you want somebody to comment, you need to give more details on what you are trying to do and what are the symptoms.
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 14-02-2011, 21:22
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: CIM motor fun

Not an expert by any means, but hopefully someone will come along that can help more. In the meantime, have you tried calibrating the jaguars? They should be pre-calibrated, but it's worth a shot if you have nothing else to try.
Reply With Quote
  #6   Spotlight this post!  
Unread 14-02-2011, 23:28
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: 494
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM motor fun

We got it
Reply With Quote
  #7   Spotlight this post!  
Unread 17-02-2011, 02:09
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: CIM motor fun

Just curious. What was the problem and solution?
Reply With Quote
  #8   Spotlight this post!  
Unread 17-02-2011, 07:00
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: 494
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: CIM motor fun

We had to recalivrate them
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 17:49.

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