Go to Post Parallax is evil. - RoboChair [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-01-2012, 12:06
ssirovica's Avatar
ssirovica ssirovica is offline
Programming Captain
AKA: Sasha Sirovica
FRC #1458 (Red Ties)
Team Role: Programmer
 
Join Date: Sep 2011
Rookie Year: 2010
Location: Alamo
Posts: 26
ssirovica is an unknown quantity at this point
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?
__________________
Computers run on smoke. When you let the smoke out the computer stops working.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2012, 16:55
shuhao shuhao is offline
Registered User
FRC #4069 (Lo-Ellen Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Sudbury
Posts: 138
shuhao is an unknown quantity at this point
Re: Robot Drive

Quote:
Originally Posted by ssirovica View Post
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2012, 07:22
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
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(...);
__________________

jRIO 2013 Project
Reply With Quote
  #4   Spotlight this post!  
Unread 10-02-2012, 08:42
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Robot Drive

Quote:
Originally Posted by ssirovica View Post
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.

Last edited by eddie12390 : 10-02-2012 at 11:35.
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2012, 09:07
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 10-02-2012, 15:46
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: Robot Drive

Quote:
Originally Posted by gpetilli View Post
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 10-02-2012, 23:07
TravSatEE's Avatar
TravSatEE TravSatEE is offline
Spacecraft Engineer and more
FRC #2035 (Robo Rockin' Bots)
Team Role: Engineer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Monterey, CA
Posts: 26
TravSatEE is infamous around these partsTravSatEE is infamous around these parts
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().
Reply With Quote
Reply


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


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

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