Go to Post And then I learned how to use the lathe...long story short, I ditched my plans to become a music major and became an engineering student. - Karibou [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

 
 
 
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #11   Spotlight this post!  
Unread 20-01-2012, 19:08
Kodiak's Avatar
Kodiak Kodiak is offline
Registered User
AKA: Boston
FRC #3325 (Chaos Order)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Texas
Posts: 13
Kodiak is an unknown quantity at this point
Re: CANJaguar

Quote:
Originally Posted by kingkurry View Post
How do we know if we have regular jaguars or CAN jaguars? Also, if we use jaguars does this mean we actually need to declare 4 jaguar instances to drive the robot? Can we do something like

Code:
public void robotInit() {
RobotDrive robot = new RobotDrive(1,2,3,4);
Joystick left = new Joystick(1);
Joystick right = new Joystick(2);

}
public void teleopPeriodic() {
robot.tankDrive(left.getThrottle(),(-1*right.getThrottle())); 

}
or do we need to actually need to create jaguar instances and use them to drive the robot. If so, how would we do this?
All jaguars both gray and black can use CAN, it is a diffrent way of sending information to them, instead of using the PWM cables you use a phone like cable. Both get the job done, just more accuracy and additional information about the controller while its running comes with the CAN.

And what I did with the jaguar is create an instance for each jaguar outside of any of the Init's. Then on the RobotInit(), I initialized them along with the drive train.

Code:
public class Team3325 extends IterativeRobot {

    CANJaguar leftCANJaguarTop;
    CANJaguar leftCANJaguarBottom;
    CANJaguar rightCANJaguarTop;
    CANJaguar rightCANJaguarBottom;
    Joystick inputJoystick;
    int leftCanTop = 1;
    int leftCanBot = 2;
    int rightCanTop = 3;
    int rightCanBot = 4;
    RobotDrive mechanumDrive;

    public void robotInit() {

        try {

            leftCANJaguarTop = new CANJaguar(leftCanTop);
            leftCANJaguarBottom = new CANJaguar(leftCanBot);
            rightCANJaguarBottom = new CANJaguar(rightCanBot);
            rightCANJaguarTop = new CANJaguar(rightCanTop);

            inputJoystick = new Joystick(1);

            mechanumDrive = new RobotDrive(leftCANJaguarTop, leftCANJaguarBottom, rightCANJaguarTop, rightCANJaguarBottom);

        } catch (Exception e) {

            System.out.println(e);
        }
    }

    public void teleopPeriodic() {

        try {

            mechanumDrive.mecanumDrive_Cartesian(inputJoystick.getX(), inputJoystick.getY(), inputJoystick.getThrottle(), 0.0); //TODO <-- Fix Gyro to proper Param.


        } catch (Exception e) {

            System.out.println(e);
        }
    }
}
The code is a little dirty, but it works for testing purposes and can hopefully help you. In your case, if you didn't use CAN, you would have to replace CANJaguar with Jaguar and fix a few of the params respectively.

Last edited by Kodiak : 20-01-2012 at 19:13.
Reply With Quote
 


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:18.

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