Go to Post Hehe, now I know how it feels to be mocked by legends. - Corey Balint [more]
Home
Go Back   Chief Delphi > Other > VEX
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 05-11-2006, 15:12
Nathan's Avatar
Nathan Nathan is offline
Registered User
FRC #1501 (Team T.H.R.U.S.T.)
Team Role: Alumni
 
Join Date: Sep 2006
Rookie Year: 2007
Location: United States
Posts: 149
Nathan has a spectacular aura aboutNathan has a spectacular aura aboutNathan has a spectacular aura about
Vex SquareBot- movement programming problem

Hi, I'm programming the Vex SquareBot in MPLAB IDE, and am having some problems programming the movement since one of the motors on the SquareBot is inverted. I tried this code:

Code:
void normal_operation()
{
	int R_Joy_Up    = 127;		// These hold the joystick values.
	int L_Joy_Up    = 127;		// Only R_Joy_Up & L_Joy_Up are used in tank mode.
	int R_Joy_Down  = 127;		// This probably isn't really needed, to be cleaned up after project completed.
	int L_Joy_Down  = 127;
	int R_Joy_Right = 127;
	int L_Joy_Right = 127;
	int R_Joy_Left  = 127;
	int L_Joy_Left  = 127;
	
	int temp;
	
	while(autonomous != 255)
	{
		R_Joy_Up = GetRxInput( 1,2 );
		L_Joy_Up = GetRxInput( 1,3 );
		
		if(L_Joy_Up > NEUTRAL)
		{
			temp = L_Joy_Up - 127;
			L_Joy_Up = NEUTRAL - temp;
		}
		else if(L_Joy_Up < NEUTRAL)
		{
			temp = L_Joy_Up - 127;
			L_Joy_Up = NEUTRAL - temp;
			if(L_Joy_Up <= 0)
			{
				L_Joy_Up = 253;
			}
		}

		autonomous = GetRxInput(1,5);
		drive ( R_Joy_Up, L_Joy_Up );
		PrintToScreen ( "L_Joy_Up: %d\n" , (int)L_Joy_Up );
		Wait(1);
	}
My code works fine, until I move the left joystick on the vex controller all the way to the bottom. The the motor suddenly reverses direction

Does anyone have any suggestions? I really appreciate the help

Thanks,
Nathan
Reply With Quote
  #2   Spotlight this post!  
Unread 05-11-2006, 17:00
10scott10 10scott10 is offline
Registered User
None #1148
 
Join Date: Feb 2006
Location: los angeles
Posts: 8
10scott10 is an unknown quantity at this point
Re: Vex SquareBot- movement programming problem

what is happening is that you are probably going below 0. when that happens it loops back to 255.
just put in an if statement to catch that before it changes speed. the same problem could cause it to go 255 to 0. so put in a if statement to catch that also
Reply With Quote
  #3   Spotlight this post!  
Unread 05-11-2006, 17:19
Nathan's Avatar
Nathan Nathan is offline
Registered User
FRC #1501 (Team T.H.R.U.S.T.)
Team Role: Alumni
 
Join Date: Sep 2006
Rookie Year: 2007
Location: United States
Posts: 149
Nathan has a spectacular aura aboutNathan has a spectacular aura aboutNathan has a spectacular aura about
Re: Vex SquareBot- movement programming problem

Yep, your right! I found this out about an hour after I posted for help. I still don't understand why the value went below 0 though?

Thanks for your help,
Nathan
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed with coding simultaneous movement (EasyC/VEX) bodaciousllama Programming 7 14-08-2006 17:35
pic: Virtual Squarebot petek Extra Discussion 22 09-05-2006 16:01
C programming problem... wasabi824 Programming 5 08-02-2004 01:04
multi-bank programming problem GregC Programming 3 14-02-2003 16:13
programming problem gthakore Programming 16 20-04-2002 12:21


All times are GMT -5. The time now is 04:00.

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