FRC Fanatic
30-11-2016, 20:48
Hello, so i'm trying to understand how to program pneumatics in python in the off-season. I've read the Robotpy documentation and the Pacgoat pneumatic documentation on github and i want to make sure that the issue is not code side, because the kFoward is functional but not the kReverse
here is a quick rundown of the pneumatic setup
double solenoid on Vex Manifold is running to 1 piston which we just want to control.
here is the code as follows
#!/usr/mybin/env python3
import math
import wpilib
from RobotMap import RobotMap
from networktables import NetworkTable
from wpilib.doublesolenoid import DoubleSolenoid
class MyRobot(wpilib.IterativeRobot):
def robotInit(self):
self.xb = wpilib.Joystick(2)
self.Compressor = wpilib.Compressor(0)
self.Compressor.setClosedLoopControl(True)
self.enabled = self.Compressor.enabled()
self.PSV = self.Compressor.getPressureSwitchValue()
self.DS = wpilib.DoubleSolenoid(1,2)
self.Compressor.start()
def teleopPeriodic(self):
elif(self.xb.getRawButton(2)):
self.DS.set(DoubleSolenoid.Value.kForward)
elif(self.xb.getRawButton(4)):
self.DS.set(DoubleSolenoid.Value.kReverse)
is there any glaring issues? i'm new to pneumatic programming and any assistance would be great, thank you.
here is a quick rundown of the pneumatic setup
double solenoid on Vex Manifold is running to 1 piston which we just want to control.
here is the code as follows
#!/usr/mybin/env python3
import math
import wpilib
from RobotMap import RobotMap
from networktables import NetworkTable
from wpilib.doublesolenoid import DoubleSolenoid
class MyRobot(wpilib.IterativeRobot):
def robotInit(self):
self.xb = wpilib.Joystick(2)
self.Compressor = wpilib.Compressor(0)
self.Compressor.setClosedLoopControl(True)
self.enabled = self.Compressor.enabled()
self.PSV = self.Compressor.getPressureSwitchValue()
self.DS = wpilib.DoubleSolenoid(1,2)
self.Compressor.start()
def teleopPeriodic(self):
elif(self.xb.getRawButton(2)):
self.DS.set(DoubleSolenoid.Value.kForward)
elif(self.xb.getRawButton(4)):
self.DS.set(DoubleSolenoid.Value.kReverse)
is there any glaring issues? i'm new to pneumatic programming and any assistance would be great, thank you.