Go to Post A big bowl of popcorn and FIRST. It doesn't get much better than that. - Warren Boudreau [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 28-01-2012, 22:04
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
Programming with CAN Jaguars

We have decided to switch over from PWM control of the Jaguars on our robot to CAN. Unfortunately I have know idea how to program with CAN Jaguars in Java.

Can you please provide some basic sample code with initialization, and a set method?

Thanks,
Sasha

P.S. When we first began with this declaration:
PHP Code:
CANJaguar motor = new CANJaguar(1); 
Net beans was giving us an error saying we needed a try catch statement.
__________________
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, 01:09
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: Programming with CAN Jaguars

id be happy to


Code:
CANJaguar motor1, motor2, motor3, motor4;
RobotDrive myrobot;
Joystick left, right;
public void robotInit() {

try {
            motor1 = new CANJaguar(1); // ID number of jaguar
            motor2 = new CANJaguar(2);
            motor3 = new CANJaguar(3);
            motor4 = new CANJaguar(4);

        } catch (CANTimeoutException ex) {
            ex.printStackTrace();
        }

myrobot = new RobotDrive(motor1,motor2,motor3,motor4);

left = new JoyStick(1);
right = new JoyStick(2);
}

public void autonomous() {
}

public void operatorControl() {
while(isOperatorControl()) {

myrobot.tankDrive(left.getY(), right.getY());
}
P.S you need the try catch incase it cant find the jaguar id it throws an error
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2012, 12:17
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: Programming with CAN Jaguars

Keep in mind that it is strongly suggested not to use ID = 1 (and I think the max ID is 16 but would have to look it up). You could number your motors 2,3,4,5 for example. The ID numbers need to be set in the jaguars using the BDC-Comm software on a PC with a serial port connected to the input side of a black jaguar.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2012, 14:00
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 189
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
Re: Programming with CAN Jaguars

Quote:
Originally Posted by gpetilli View Post
Keep in mind that it is strongly suggested not to use ID = 1 (and I think the max ID is 16 but would have to look it up). You could number your motors 2,3,4,5 for example. The ID numbers need to be set in the jaguars using the BDC-Comm software on a PC with a serial port connected to the input side of a black jaguar.
Yes, it is not recommended that you use 1 because it is the default ID.

The maximum ID number is 63.

-David
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 10:39.

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