|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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);
}
}
Thanks ![]() |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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??
|
|
#4
|
|||
|
|||
|
Re: pneumatics help, noob programmer.
Quote:
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).. |
|
#5
|
|||
|
|||
|
Re: pneumatics help, noob programmer.
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|