Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Robot Drive (http://www.chiefdelphi.com/forums/showthread.php?t=101459)

ssirovica 29-01-2012 12:06

Robot Drive
 
Our team does not use the robot drive method. Instead we use a hand written drive method.

PHP Code:

public void drive(){
                
leftMotor1.set(leftStick.getY());
                
leftMotor2.set(leftStick.getY());
                
rightMotor1.set(-rightStick.getY());
                
rightMotor2.set(-rightStick.getY());


Do we lose any functionality with this hand written method?

shuhao 29-01-2012 16:55

Re: Robot Drive
 
Quote:

Originally Posted by ssirovica (Post 1115811)
Our team does not use the robot drive method. Instead we use a hand written drive method.

PHP Code:

public void drive(){
                
leftMotor1.set(leftStick.getY());
                
leftMotor2.set(leftStick.getY());
                
rightMotor1.set(-rightStick.getY());
                
rightMotor2.set(-rightStick.getY());


Do we lose any functionality with this hand written method?

You lose arcade drive. I took code that I want from RobotDrive.java and implemented low pass filter on it.

IisMathwizard 10-02-2012 07:22

Re: Robot Drive
 
Make sure though that you have the motors in the right places... also, you may already known this but the joysticks are really sensitivity so if you have an issue of minor movements of the driver cause the robot to fidget then it might be a good idea to add a sort of sensitivity method to output if the joysticks only passed acertain y value... i suggest using Math.abs(...);

eddie12390 10-02-2012 08:42

Re: Robot Drive
 
Quote:

Originally Posted by ssirovica (Post 1115811)
Our team does not use the robot drive method. Instead we use a hand written drive method.

PHP Code:

public void drive(){
                
leftMotor1.set(leftStick.getY());
                
leftMotor2.set(leftStick.getY());
                
rightMotor1.set(-rightStick.getY());
                
rightMotor2.set(-rightStick.getY());


Do we lose any functionality with this hand written method?

Not really. As long as you are fine with using both joysticks. It will also become a lot easier to fine tune.

gpetilli 10-02-2012 09:07

Re: Robot Drive
 
I think he intends to do tank drive with two joysticks.

I would however recommend saving stick.getY into a temporary variable first and then write it to the motors. Since this is a real time system, the value of the joystick may change between the two reads and then you will be writing different speeds to the front and back wheels. Probably not a huge issue, but may cause excess wear on the drive train.

Patrick Chiang 10-02-2012 15:46

Re: Robot Drive
 
Quote:

Originally Posted by gpetilli (Post 1123652)
Since this is a real time system, the value of the joystick may change between the two reads and then you will be writing different speeds to the front and back wheels. Probably not a huge issue, but may cause excess wear on the drive train.

Legitimate concern, but probably not a very big one. Your concern is about as critical as me worrying about having to allocate a 8 byte memory block for storing the double. ;) The loop will run through much much faster than you can humanly move the joystick, and possibly faster than the amount of time it takes to query the value from the joystick. Also, if they built the robot right, moving the two wheels at different speeds shouldn't be a big issue.

So no, no direct disadvantages of doing this manually. It's also a lot easier to fine tune as somebody said. It is kind of like re-inventing the wheel if you're not using any lower level jaguar functions that are inaccessible with the RobotDrive class, but that said, it's always a good idea to be familiar with your code, so whatever you think looks better will probably end up being better for you.

If you wanted arcade drive / meccanum drive, you can do some math and figure it out. Or you can go into the RobotDrive class and copy the math over.

TravSatEE 10-02-2012 23:07

Re: Robot Drive
 
ssirovica: You can always look at WPILIB RobotDrive.java to compare. One thing the RobotDrive tankDrive() does is to square the joystick input magnitude value to change the handling of the robot at smaller joystick movements. This isn't a significant code change, but it has some other benefits (joystick deadband, slightly implements a smoothing filter).

shuhao: How are you implementing a low pass filter? I am curious what you objective is?

gpetilli: That is a good observation about real time systems, but I don't think it applies here. Look at WPILIB IterativeRobot.java line 144. I believe this is where WPILIB object states are updated prior to the execution of teleopPeriodic().


All times are GMT -5. The time now is 09:56.

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