Go to Post There are few times I sleep so soundly as I do after an FRC build season and regional. - JamesCH95 [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 14-01-2012, 20:59
jo3_sum jo3_sum is offline
Registered User
no team
 
Join Date: Jan 2010
Rookie Year: 2010
Location: California
Posts: 6
jo3_sum is an unknown quantity at this point
Java Motor Control Troubles

My team is having trouble using java. We can't set a regular/not-CAN Jaguar motor controller's speed. It says it can't find the module and port. Are there any simple examples where we can test only 1 motor controller with a joystick? Most of the samples want multiple devices. We are still doing baby steps.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-01-2012, 22:31
BradAMiller BradAMiller is online now
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Make sure that you are using module number 1 for the first digital module regardless of what slot it's in. Also, if you upload your code we can take a look.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2012, 23:06
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: Java Motor Control Troubles

Quote:
Originally Posted by jo3_sum View Post
My team is having trouble using java. We can't set a regular/not-CAN Jaguar motor controller's speed. It says it can't find the module and port. Are there any simple examples where we can test only 1 motor controller with a joystick? Most of the samples want multiple devices. We are still doing baby steps.
Here ill get you going on a simple code.

first thing under your public class put
Code:
Joystick joystick1;
Victor motor1;
Under that line put:
Code:
public void robotInit {

joystick1 = new Joystick(1);

motor1 = new Victor(1) // the one can be replaced with any PWM port on sidecar.
NOTE: You will have to import the Victor class and Joystick class. you can do this by adding this above your public class:

Code:
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Joystick;
After that just simply put this in your operator control

Code:
while(isOperatorControl) {

motor1.set(joystick1.getY()); // gets the val from joystick and converts to pwm

}
Yes i do know that you are using Jaguars not Victors but the coding for the two on pwm is practically the same and should get you going good. I suggest your team looks in to using CAN it has so many nice features.
Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 20:42
jo3_sum jo3_sum is offline
Registered User
no team
 
Join Date: Jan 2010
Rookie Year: 2010
Location: California
Posts: 6
jo3_sum is an unknown quantity at this point
Re: Java Motor Control Troubles

Sorry, about being vague in the first post. I was in rush.
It turns out we forgot to move the modules from last year's slots after re-imaging.
Then, we used motor_controller = new MotorController(int slot, int channel) instead of motor_controller = new MotorController( int channel).

The motor moves, now.
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 22:21.

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