Hello
we are trying to write a code on windriver /C++ for mecanum wheels but tell now we haven’t succeed to use the HolonomicDrive function and open declaration for it from MyRobot.cpp !!
any suggestion on how to find the declaration for the HolonomicDrive functionand how to use it?
we also tried to upload our prier code which written by EasyCPro 2008 into windriver
any suggestion or advices on how we can use our EsayCPro code in Windirver ,
[quote]
the code:
void OmniDrive ( void )
{
int LeftFront;
int RightFront;
int LeftRear;
int RightRear;
int spin_speed = 80;
int gray_area = 15;
int Y_indicator = 0;
int solonoid_move_up = 0;
int solonoid_move_down = 0;
int solonoid_gray_area = 70;
int left_greper_motor = 0;
int right_greper_motor = 0;
InitPressureSwitch ( 7 , 2 ) ;
// this function mixes the inputs to the motors
// and gives the motors PWM commands to drive
LeftRear = RightFront = RightRear = LeftFront =0 ;
//PrintToScreen ( "Xaxis = %d
" , (int)XAxis ) ;
//PrintToScreen ( "Yaxis = %d
" , (int)YAxis ) ;
if ( YAxis > gray_area )
{
Y_indicator = 1;
}
else
{
}
if ( (gray_area * -1) < XAxis && XAxis < gray_area )
{
XAxis =0;
}
if ( (gray_area * -1) < YAxis && YAxis < gray_area )
{
YAxis =0;
}
if ( XAxis ==0 || (XTrig && YAxis==0) ) // X or Y move (90 degrees)
{
//PrintToScreen ( "Triger=%d%d
" , (int)XTrig ) ;
if ( XAxis > gray_area&& XTrig )
{
degree_90_fix = - DEGREE_90_FIX;
}
else if ( XAxis < - gray_area&& XTrig )
{
degree_90_fix = DEGREE_90_FIX;
}
else
{
degree_90_fix = 0;
}
LeftRear =YAxis -XAxis ;
LeftFront =YAxis + XAxis + degree_90_fix ;
RightRear =YAxis + XAxis ;
RightFront =YAxis -XAxis + degree_90_fix ;
}
else if ( RTrig && YAxis==0 )
{
LeftFront = LeftRear = XAxis ;
RightFront = RightRear = -XAxis ;
}
else if ( XAxis > gray_area ) // Right Turn
{
LeftFront = LeftRear = Y_indicator * XAxis + YAxis ;
RightFront = RightRear = ((127 - XAxis ) /(float) 127.0) *
YAxis ;
//LeftRear = LeftFront = YAxis + ( YAxis *.75 * Y_indicator )
;
//RightRear = RightFront = YAxis - ( YAxis *0.25 * Y_indicator
) ;
PrintToScreen("Right Turn: XaXIS =%d , Yaxis=%d, leftrear=%
d,leftfront=%d,rightrear=%d,rightfront=%d
-----------Percent= %f----
",XAxis ,YAxis , LeftRear , LeftFront , RightRear , RightFront , (float)
RightFront/(float)LeftFront );
}
else if ( XAxis < (-1 * gray_area) ) // Left Turn
{
RightFront = RightRear = -XAxis* Y_indicator + YAxis ;
LeftRear = LeftFront = ((127 + XAxis ) /(float) 127.0) * YAxis
;
//LeftRear = LeftFront = YAxis - ( YAxis *0.25 * Y_indicator )
;
//RightRear = RightFront = YAxis + ( YAxis *0.75 * Y_indicator
) ;
//PrintToScreen("Left Turn: Xaxis = %d, Yaxis=%d,leftrear=%
d,leftfront=%d,rightrear=%d,rightfront=%d
----------------turn percent =
%f-----------
",XAxis ,YAxis , LeftRear , LeftFront , RightRear ,
RightFront ,(float) LeftRear/(float)RightRear);
}
// The following nominalizes the values for the speed
if ( LeftFront < MAX_SPEED_B )
{
LeftFront = MAX_SPEED_B ;
}
if ( LeftFront > MAX_SPEED_F )
{
LeftFront = MAX_SPEED_F ;
}
if ( RightFront < MAX_SPEED_B )
{
RightFront = MAX_SPEED_B ;
}
if ( RightFront > MAX_SPEED_F )
{
RightFront = MAX_SPEED_F ;
}
if ( RightRear < MAX_SPEED_B )
{
RightRear = MAX_SPEED_B ;
}
if ( RightRear > MAX_SPEED_F )
{
RightRear = MAX_SPEED_F ;
}
if ( LeftRear < MAX_SPEED_B )
{
LeftRear = MAX_SPEED_B ;
}
if ( LeftRear > MAX_SPEED_F )
{
LeftRear = MAX_SPEED_F ;
}
// Now we add 6 back to the speed
// The speed values are stored in an array from 0 - 13
// with 7 as neutral
// We used 0 as neutral before to allow for seemless addition and
subtraction
// Set the motors and add back 127 for 0-255
// If you need to invert a motor replace with"255-(LeftFront+127)"
SetPWM ( Left_Rear_PWM , (LeftRear+127) ) ; // Output to Motor
SetPWM ( Left_Front_PWM , LeftFront+127 ) ; // Output to Motor
SetPWM ( Right_Rear_PWM , (255-RightRear+127) ) ; // Output to Motor
SetPWM ( Rigth_Front_PWM , (255-RightFront+127) ) ; // Output to
Motor
if ( solonoid_Yaxis > solonoid_gray_area )
{
solonoid_move_up = 1 ;
solonoid_move_down = -1 ;
}
else if ( solonoid_Yaxis < (-1) * solonoid_gray_area )
{
solonoid_move_up= -1 ;
solonoid_move_down = 1 ;
}
else
{
solonoid_move_up = 0 ;
solonoid_move_down = 0 ;
}
SetRelay ( 1 , solonoid_move_up , solonoid_move_down ) ;
if ( Solonoid_push )
{
SetRelay ( 3 , 1 , 0 ) ;
Wait ( 400 ) ;
SetRelay ( 3 , 0 , 1 ) ;
Wait ( 400 ) ;
SetRelay ( 3 , 0 , 0 ) ;
}
if ( greper_inital_open_trig && inital_done )
{
inital_done = 0 ;
left_greper_motor = 1 ;
right_greper_motor = 1 ;
}
else if ( greper_open_trig )
{
printf("----------in OPEN trig-----------
");
left_greper_motor = 70 ;
right_greper_motor = 70 ;
}
else if ( grepre_close_trig )
{
printf("----------in CLOSE trig-----------
");
left_greper_motor = 200 ;
right_greper_motor = 200 ;
}
else
{
printf("----------in ELSE trig-----------
");
left_greper_motor = 127 ;
right_greper_motor = 127 ;
}
SetPWM ( LEFT_GREPER_PWM , left_greper_motor ) ; // Output to Motor
SetPWM ( RIGHT_GREPER_PWM , right_greper_motor ) ; // Output to
Motor
}
Team 1946[/quote]