Go to Post As usual this was the programmers fault. - Swampdude [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

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 01-28-2010, 05:01 AM
pafwl pafwl is offline
Franciose
AKA: Frank Larkin
FRC #0272 (Cyber Crusaders)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 1998
Location: Lansdale, Pennsylvania
Posts: 108
pafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud ofpafwl has much to be proud of
Re: MECANUM WHEELS PROGRAMING

We do not use the code from WPI. I and my students have written our own. We did this so they understand how it works. When carbbing the opposite corners move in the same way. When turning the sides move together.


You the function below once for each wheel to get the wheels power. It works very well and is easly understood. It assumes that forward is 1.0, back is -1.0, crab left is 1.0, right is -1.0, turn to left is 1.0 and right is -1.0.

The joystick values are assigned when we read in the DS values. They may need to be reversed via negation. We also may need to negate again when we assign the values to motors. (left vs right side)

Right now the rotation seems backwards and may be the result of us switching front to back but for now it works great.

We do it this way so we can use the same code in autonomous. We just pass in the values we want in the auto code and it all works great.


Code:
float LC2010::GetMecanumPower( int i_wheel, float f_direction, float f_power, float f_turn ) 
{
	float retValue = 0.0;

	switch( i_wheel )						// Apply Forward and side motion
	{
		case LC2010::kMecanumLeftFront:
		case LC2010::kMecanumRightRear:
			retValue =  f_power - f_direction;
			break;

		case LC2010::kMecanumLeftRear:
		case LC2010::kMecanumRightFront:
			retValue =  f_power + f_direction;
			break;
		
		default:
			printf("GetGetMacannumMotorValue: Bad Wheel passed....\r");
			break;
	}

	switch( i_wheel )						// Apply the rotation
	{
		case LC2010::kMecanumLeftFront:
		case LC2010::kMecanumLeftRear:
			retValue += f_turn;				// retValue - f_turn;
			break;

		case LC2010::kMecanumRightFront:
		case LC2010::kMecanumRightRear:
			retValue -= f_turn;				//retValue + f_turn;
			break;
	
		default:
			printf("GetMacannumPower: Bad Wheel passed....\r");
			break;
	}


	if( retValue < -1.0) 								// condition before recasting to unsigned char
		retValue = -1.0;

	if( retValue > 1.0 ) 
		retValue = 1.0; 

	return retValue; 
};
Reply With Quote
 


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
Mecanum Wheels? Maxpower57 Kit & Additional Hardware 17 03-17-2008 04:50 PM
Mecanum Wheels Calvin_1631 Motors 7 02-09-2007 01:29 PM
4 encoders + mecanum wheels programing Smoking_Gun Programming 4 01-18-2007 11:43 PM
Friction coefficients for Omni wheels and Mecanum wheels from AndyMark Andy Baker Technical Discussion 11 12-16-2006 07:40 PM
Mecanum Wheels TheFerret Technical Discussion 8 01-16-2006 09:23 AM


All times are GMT -5. The time now is 10:55 AM.

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