Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Mecanum Spin (http://www.chiefdelphi.com/forums/showthread.php?t=83848)

Bart 03-03-2010 22:19

Mecanum Spin
 
Hey, I'm currently trying to figure out how to change the magnitude of the holonomic drive system. I tried the obvious approach (Changing the first float) however, with out current code, nothing seemed to change at all. Could someone look it over and tell me what they think? We basically want the spin of the robot to be dependent on the value returned by the joystick throttle:

Code:

//Stop Button
                if(!joyStick->GetRawButton(3))
                {
                        //Turn left
                        if(joyStick->GetRawButton(4))
                                joanRobo->HolonomicDrive(joyStick->GetThrottle(), 0.0, -180.0);
                       
                        //Turn right
                        else if (joyStick->GetRawButton(5))
                                joanRobo->HolonomicDrive(joyStick->GetThrottle(), 0.0, 180.0);
                       
                        //Regular holonomic movement
                        else
                                joanRobo->HolonomicDrive(joyStick->GetMagnitude(), joyStick->GetDirectionDegrees(), 0.0);
                }
                else
                        //Stop all movement
                        joanRobo->HolonomicDrive(0.0, 0.0, 0.0);


mikets 04-03-2010 00:08

Re: Mecanum Spin
 
Quote:

Originally Posted by Bart (Post 931207)
Hey, I'm currently trying to figure out how to change the magnitude of the holonomic drive system. I tried the obvious approach (Changing the first float) however, with out current code, nothing seemed to change at all. Could someone look it over and tell me what they think? We basically want the spin of the robot to be dependent on the value returned by the joystick throttle:

I am not sure which part of your code you said not working. Mecanum drive requires 3 joystick axes. According to your code, you are using one joystick. If that's the case, make sure your joystick has 3 axes. Since you are using the GetMagnitude(), it is computing the magnitude by doing sqrt(x*x + y*y), and the direction is computed by atan2(x, -y). So you should make sure that the Y axis of your joystick is controlling the forward/backward movement, the X axis is controlling your sideway movement. Then for the turn, make sure you are using the correct joystick axis for it. At first, we were reading the twist axis for the turn, but it was wrong. This is because our Microsoft Side Winder joystick maps twist to the Z-axis, not twist or throttle. So make sure you reads the correct axis.

Bart 04-03-2010 23:08

Re: Mecanum Spin
 
Well we're using the standard kop joystick, and our controller is indeed moving the robot properly, what we attempted doing is have it spin using to of the top buttons, and regulate the speed of the spin using the throttle on the joystick.

mikets 04-03-2010 23:52

Re: Mecanum Spin
 
If you want to regulate the spin by the throttle, you should probably doing something like this:
Code:

if (joyStick->GetRawButton(4))
    joanRobo->HolonomicDrive(0.0, 0.0, -joyStick->GetThrottle());
//Turn right
else if (joyStick->GetRawButton(5))
    joanRobo->HolonomicDrive(0.0, 0.0, joyStick->GetThrottle());
//Regular holonomic movement
else
    joanRobo->HolonomicDrive(joyStick->GetMagnitude(), joyStick->GetDirectionDegrees(), 0.0);



All times are GMT -5. The time now is 13:32.

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