Go to Post If you don't KNOW something as fact, please do not state it as fact. - dlavery [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 17-01-2012, 21:53
neal's Avatar
neal neal is offline
Neal
FRC #1777 (Viking Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: United States
Posts: 56
neal is an unknown quantity at this point
Using Jaguar() instead of RobotDrive()

I was wondering if there's any difference using just RobotDrive(1,2,3,4) (what we currently do) and making Jaguar(1) for motor then use that instead.

This is how our code is right now.

Your feedback's are appreciated. Let me know if there's anything better I could do (in the whole project).

Last edited by neal : 17-01-2012 at 21:56. Reason: Added the link for current code
Reply With Quote
  #2   Spotlight this post!  
Unread 17-01-2012, 22:34
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,079
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Using Jaguar() instead of RobotDrive()

Jaguar is used to control individual Jaguars. Robot Drive uses the Jaguar class to make a basic drive system to get you started.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #3   Spotlight this post!  
Unread 17-01-2012, 22:58
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Using Jaguar() instead of RobotDrive()

well if you used 4 separate Jaguar objects the only difference is having to make the driving methods yourself, or making an alternative setup for driving the Jaguars, with RobotDrive the methods are already there.

I make the 4 Jaguar objects and then use those for the robot Drive as shown.

Code:
Jaguar leftFront = new Jaguar(3);
Jaguar leftBack = new Jaguar(4);
Jaguar rightFront = new Jaguar(1);
Jaguar rightBack = new Jaguar(2);
RobotDrive robotDrive = new RobotDrive(leftFront, leftBack, rightFront, rightBack);
This way if I needed to I could set Jaguars individually and get the individual speeds for the dashboard and stuff as well as use the RobotDrive for handling mass changes and regular driving.

Code for a DriveTrain I wrote for testing:
Code:
package edu.wpi.first.wpilibj.test;


import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.RobotDrive;

/**
 *
 * @author Gus Michel
 */
public class DriveTrain {
    private int LEFT_FRONT_JAG_PORT = 1;
    private int LEFT_BACK_JAG_PORT = 2;
    private int RIGHT_FRONT_JAG_PORT = 3;
    private int RIGHT_BACK_JAG_PORT = 4;
    private static DriveTrain instance = null;
    private Jaguar leftFront;
    private Jaguar leftBack;
    private Jaguar rightFront;
    private Jaguar rightBack;
    private RobotDrive robotDrive;
    
    private DriveTrain() {
        leftFront = new Jaguar(LEFT_FRONT_JAG_PORT);
        leftBack = new Jaguar(LEFT_BACK_JAG_PORT);
        rightFront = new Jaguar(RIGHT_FRONT_JAG_PORT);
        rightBack = new Jaguar(RIGHT_BACK_JAG_PORT);
        robotDrive = new RobotDrive(leftFront, leftBack, rightFront, rightBack);
    }
    
    public static DriveTrain getInstance() {
        if(instance == null) {
            instance = new DriveTrain();
        }
        return instance;
    }
    
    public void drive(double throttle, double turn) {
        robotDrive.drive(throttle, turn);
    }
    
    public void arcadeDrive(double throttle, double turn) {
        robotDrive.arcadeDrive(throttle, turn);
    }
    
    public void tankDrive(double left, double right) {
        robotDrive.tankDrive(left, right);
    }
    
    public double getLeftFrontSpeed() {
        return leftFront.getSpeed();
    }
    
    public double getLeftBackSpeed() {
        return leftBack.getSpeed();
    }
    
    public double getRightFrontSpeed() {
        return rightFront.getSpeed();
    }
    
    public double getRightBackSpeed() {
        return rightBack.getSpeed();
    }
    
    public void stop() {
        robotDrive.drive(0,0);
    }
}
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 11:11.

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