Go to Post ... you know you are a nerd when you want safety glasses for your birthday! :P - Ashley Christine [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 17-02-2016, 09:27
VrewDaive VrewDaive is offline
Registered User
FRC #4284
 
Join Date: Sep 2015
Location: Cincinnati
Posts: 21
VrewDaive is an unknown quantity at this point
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
Reply With Quote
  #2   Spotlight this post!  
Unread 17-02-2016, 12:26
RayG RayG is offline
Registered User
FRC #1796 (RoboTigers)
Team Role: Alumni
 
Join Date: Feb 2016
Rookie Year: 2012
Location: New York
Posts: 2
RayG is an unknown quantity at this point
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 17-02-2016, 13:57
VrewDaive VrewDaive is offline
Registered User
FRC #4284
 
Join Date: Sep 2015
Location: Cincinnati
Posts: 21
VrewDaive is an unknown quantity at this point
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??
Reply With Quote
  #4   Spotlight this post!  
Unread 17-02-2016, 14:09
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,171
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: pneumatics help, noob programmer.

Quote:
Originally Posted by VrewDaive View Post
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)..
Reply With Quote
  #5   Spotlight this post!  
Unread 17-02-2016, 14:10
cantdecide cantdecide is offline
Registered User
FRC #5773 (YAFL Mechatronics)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Turkey
Posts: 31
cantdecide is an unknown quantity at this point
Re: pneumatics help, noob programmer.

Quote:
Originally Posted by VrewDaive View Post
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:
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:28.

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