Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   "Split Arcade" Drive with Xbox 360 Controller? (http://www.chiefdelphi.com/forums/showthread.php?t=154301)

JoeyDaPanda 26-01-2017 19:37

"Split Arcade" Drive with Xbox 360 Controller?
 
Hey there, rookie team 6324 here. We have a pretty big dilemma, and we're hoping you guys can help us out some. We are inexperienced in programming and need guidance.

Like the title says, we would like to have the left joystick of an Xbox 360 controller control throttle and the right thumbstick of the controller control turning. We have no clue how to achieve this. Currently the right trigger controls the left side wheels/motors, and the Y axis of the left thumbstick controls the right side.

Thanks!

Poseidon5817 26-01-2017 19:59

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Code:

robot_drive.arcadeDrive(xboxController.getY(Hand.kLeft), xboxController.getX(Hand.kRight));


This is assuming you've already made a RobotDrive object and an XboxController object, and that you are using Java.

ben47955 26-01-2017 20:09

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
I don't recommand to a team inexperienced in programming to try two type of drive. Focus on one and do well ( pratice your driver too).

But, if you really want to do this, I recommand to uses a toggle button for switch mode. It will be more simple to programming and robot will don't go in all ways.

Poseidon5817 26-01-2017 21:02

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Quote:

Originally Posted by ben47955 (Post 1636866)
I don't recommand to a team inexperienced in programming to try two type of drive. Focus on one and do well ( pratice your driver too).

But, if you really want to do this, I recommand to uses a toggle button for switch mode. It will be more simple to programming and robot will don't go in all ways.

I don't think that they wanted to do two types of drive, I think they wanted to figure out how to do the one they wanted. That being said, I don't think arcade drive is too complicated for any team to understand. It's one of the easier things to implement, especially since it's so well documented.

Xavbro 26-01-2017 21:03

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
The type of drive you're asking for is very simple and we used it last year as a rookie team.

What you want to do is take one axis of the the controller and set it to straight and set the other axis of the controller to rotate.

***Java Code***
straight = (Robot.oi.xbox.getRawAxis(1));
rotate = (Robot.oi.xbox.getRawAxis(4));

We used an Xbox controller as well last year and found that the axis we wanted to use were 1 and 4. You'll have to double check with you team to see which ones you want to use.

After you've done that, you can tune the values for deadzones and such as needed. You would then use those values to apply to the drive motors as such:

leftMotor1.set((rotate + straight));
leftMotor2.set((rotate + straight));
rightMotor1.set(rotate - straight));
rightMotor2.set((rotate - straight));

(Of course if you're using more motors, you would add them. We only used 4.)

You might have to change the signs around to get the right direction and such but that's the code we used last year and it worked great.

If you have any questions, feel free to PM me. Hope this helps! :)

messer5740 26-01-2017 21:41

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Also, be mindful of the Xbox controller Axes. You can find them in the driver station USB panel.

bobbysq 26-01-2017 21:57

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Quote:

Originally Posted by Xavbro (Post 1636898)
After you've done that, you can tune the values for deadzones and such as needed. You would then use those values to apply to the drive motors as such:

leftMotor1.set((rotate + straight));
leftMotor2.set((rotate + straight));
rightMotor1.set(rotate - straight));
rightMotor2.set((rotate - straight));

Or you could just use WPILib's own RobotDrive->ArcadeDrive function.

JoeyDaPanda 28-01-2017 08:54

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Quote:

Originally Posted by messer5740 (Post 1636912)
Also, be mindful of the Xbox controller Axes. You can find them in the driver station USB panel.

Yup, been telling the other guys working on this with my that since day one that the axes we want are 1 and 4 but they dont listen haha

messer5740 28-01-2017 09:02

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Quote:

Originally Posted by JoeyDaPanda (Post 1637379)
Yup, been telling the other guys working on this with my that since day one that the axes we want are 1 and 4 but they dont listen haha

We had the same issue of programming our linear strafing, and had a heck of a time too, but once we figured it out it was all good

Robo Hamsters 28-01-2017 09:37

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
The first thing we really need to know is what language are you guys using?

JoeyDaPanda 28-01-2017 09:44

Re: "Split Arcade" Drive with Xbox 360 Controller?
 
Java definitely


All times are GMT -5. The time now is 07:12.

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