Go to Post Got Valentine's day present from wife before leaving for work. Non-contact IR thermometer, two unscuffed pairs of safety glasses for competitions, bag of York peppermint patties. She understands me. - Greg Young [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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 07-02-2013, 13:19
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,577
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Positional Motor Control using CANJaguar

Hello all!

I've returned once again to the glorious lands of CD to get some help with a puzzling problem I'm having.
This year our shooter will be mounted on a pivot point and will be attached to a CAM...(http://en.wikipedia.org/wiki/Cam)
I need to be able to rotate this CAM a specific distance/#ofdegrees from a set base position. I will need to be able to push a button and have the CAM rotate to the desired position and stay there until the button is released. Once released I would like the CAM to return to the home position. Or position 0.
I would imagine this would be simple to do....but I have been having some issues with my test-bed not functioning as expected.

Whenever the button is pushed the motor does travel the short distance expected, but when the button is released the motor does not return to 0.
Also, my getDistance(); method is not returning the distance of 5. It returns a value of about 2.35 when the motor stops. I tried using some of the other encoderDrive, PIDexample programs that use connection to the Jaguar through PWM and had zero success getting them to work at all.

At this juncture....I'm stumped by such a simple problem.

Code:
    public void robotInit() {
        TEST_Speed = 0;
        try{
           PIDTEST = new CANJaguar(3);
           PIDTEST.changeControlMode(CANJaguar.ControlMode.kPosition);
           PIDTEST.setPositionReference(CANJaguar.PositionReference.kQuadEncoder);   
           PIDTEST.configMaxOutputVoltage(100);
           PIDTEST.configEncoderCodesPerRev(80);
           PIDTEST.setPID(2.0, 0.0, 0.0);           
           PIDTEST.enableControl();
        }
        catch (Exception e){}
               

    }


Public void CAM_Control(){

       if(joy1.getRawButton(7)){
       try {
             TEST_Distance = PIDTEST.getPosition();
             PIDTEST.setX(5);

            } catch(Exception e) {}
       }
       else{
          try {
               TEST_Tistance = PIDTEST.getPosition();
                PIDTEST.setX(0);
 
               } catch(Exception e) { }
       }


}
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
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:25.

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