Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   pneumatics help, noob programmer. (http://www.chiefdelphi.com/forums/showthread.php?t=144021)

VrewDaive 02-17-2016 09:27 AM

pneumatics help, noob programmer.
 
Hey everyone! this is our first year using really any kind of pneumatics, our team has all of the hardware, (PCM, Compressor, DoubleSolenoids etc) what we would like is the basic understanding of the coding side of things, i understand that you need to write the PCM in CAN, im really unsure of what that entails. here is the code right now




Code:

    /**
            * This function is run when the robot is first started up and should be
            * used for any initialization code.
            *
            */  RobotDrive myDrive, frontCatcher, backCatcher, windowDrive;
                    Joystick moveStick;
                    Relay Relay1, Relay2;
                    //ADXRS450_Gyro scotbot;
                    //Solenoid S;
                    Compressor C;
                    DoubleSolenoid DS;
       
                   
            public void robotInit() {
                    Talon TalLF = new Talon(0);
                    Talon TalLR = new Talon(1);
                    Talon TalRF = new Talon(2);
                    Talon TalRR = new Talon(3);
                    Jaguar Window1 = new Jaguar(4);
                    Jaguar Window2 = new Jaguar(5);
           
                    //Talon TalCatcher = new Talon(4);
                    //Talon TalCatcher1 = new Talon(5);
            //Talon TalCatcher2 =  new Talon(6);
                    myDrive =  new RobotDrive(TalLF,TalLR,TalRF,TalRR);
                //frontCatcher = new RobotDrive(TalCatcher,TalCatcher1);
            //backCatcher = new RobotDrive(TalCatcher1, TalCatcher2);
                    windowDrive = new RobotDrive(Window1, Window2);
                    moveStick = new Joystick(0);
                   
                    //scotbot = new ADXRS450_Gyro();
                    DoubleSolenoid DS = new DoubleSolenoid(0, 1);
                    Compressor C = new Compressor(0);
                    Relay1 = new Relay(0);
                Relay2 = new Relay(1);
            }
       
            /**
            * This function is called periodically during autonomous
            */
            public void autonomousPeriodic() {
                            myDrive.mecanumDrive_Cartesian(1, 1, 1, 0);
                            // catcherDrive.drive(1, 0);
            }
            /**
            * This function is called periodically during operator control
            */
            public void teleopPeriodic() {
                    C.setClosedLoopControl(false);
                   
                   
              myDrive.mecanumDrive_Cartesian(moveStick.getRawAxis(0), moveStick.getRawAxis(1), -moveStick.getRawAxis(5), 0);
             
              if(moveStick.getRawButton(3))
                    {
                      windowDrive.drive(1,1);                                   
                    }
              else
                      if (moveStick.getRawButton(2))
                      {
                              windowDrive.drive(-1,1);
                      }

            }

but every time we enable the teleop it shorts out and exits very quickly.

Thanks :)

RayG 02-17-2016 12:26 PM

Re: pneumatics help, noob programmer.
 
On the new control system, the PCM has built-in closed loop control of the compressor, no code is necessary to turn it on
Quote:

C.setClosedLoopControl(false);
will disable closed loop control and the compressor will not turn on.

VrewDaive 02-17-2016 01:57 PM

Re: pneumatics help, noob programmer.
 
So how do you communicate with the PCM? do you simly connect the can wires to it and the robo rio and your good to go? or do you have to put something in the code??

rich2202 02-17-2016 02:09 PM

Re: pneumatics help, noob programmer.
 
Quote:

Originally Posted by VrewDaive (Post 1541768)
So how do you communicate with the PCM? do you simly connect the can wires to it and the robo rio and your good to go? or do you have to put something in the code??

In general, you have to:
1) Create the pneumatics object (similar to how you create the talon, joystick, etc)
2) Enable the object

At that point, the library will automatically keep the system pressurized.

You would then control the solenoids.

You can disable, and the re-enable the compressor in order to turn it off when you don't need it, or want to minimize current draw (prevent brownout, or make more power available for the motors)..

cantdecide 02-17-2016 02:10 PM

Re: pneumatics help, noob programmer.
 
Quote:

Originally Posted by VrewDaive (Post 1541768)
So how do you communicate with the PCM? do you simly connect the can wires to it and the robo rio and your good to go? or do you have to put something in the code??

Electrically, you have to wire up the PCM between the PDP and the roboRIO since it doesn't have an internal termination resistor. It goes:


All times are GMT -5. The time now is 08:03 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi