Hey I’m starting to do pneumatics only I dont know how to start. How would you start to do something simple like turn the compressor on. We are using Windriver by the way. The compressor is connected to Digital sidecar relay 8 also.
Have you looked at the compressor class?
How do we use this compressor class?
Compressor *compressor;
Contructor() {
...
compressor = new Compressor(PRESSURE_SWITCH_CHANNEL, RELAY_CHANNEL);
compressor->Start();
...
}
replace PRESSURE_SWITCH_CHANNEL and RELAY_CHANNEL of course
The short version is that there are classes (named objects) in the software packages we have been given. You just plug in the specifics (such as ‘channel 8 of sidecar 0’) and it works. I’m not a programmer, so I can’t explain how it works. Magic, maybe. But it’s pretty easy.
Turning the compressor on an off is only the start, of course. You turn it on while the pressure switch is “closed” and then turn it off when the switch is “open”. The only other major thing you need to do is ‘turn on this solenoid valve’ when ‘this’ (usually a joystick button press) happens. You usually toggle the valve on or off depending on what condition it had last.
What? I just made a solenoid object and literally just turned on or off the solenoid that was controlling the compressor, it worked great.
It “works”, but it’s not in accordance with the robot rules of the past two years. The compressor must be controlled based on the feedback from the pressure switch.
How do we put this piece of code on our code. We just have the simple template.
Never mind, got the compressor to start but now we need to get the compressor to stop. How do you make it stop at 60 psi?
code.txt (1 KB)
code.txt (1 KB)
Never mind, got the compressor to start but now we need to get the compressor to stop. How do you make it stop at 60 psi?
You can’t do this with whats in the KOP. Your pneumatics system should have a pressure switch inline with it. The pressure switch from the programs point of view, returns 1 when the pressure is less than 90 then returns 0 when its greater than 115. If i remember correctly. What the compressor class does is takes the channel for the pressure switch and a channel for the relay for the compressor itself. Then it turns the compressor on when the pressure switch returns a 1 and shuts it off when the pressure switch returns 0.
To turn the compressor off when it reaches a different PSI, you either need a pressure switch that changes state at 60 PSI or you need a Pressure Transducer, which applies resistance depending on the pressure.
you have compressor.Start() in the OperatorControl loop. it should be in the initializer (where you have GetWatchdog().SetExpiiration(0.1);), so your code becomes
RobotDemo(void):
myRobot(3, 4),
myRobot2(2, 1),
myRobot3(5, 6),
stick(1),
stick2(2),
stick3(3),
compressor(1, 8)
{
compressor.Start();
GetWatchdog().SetExpiration(0.1);
}
Assuming you have a pressure switch hooked up to GPIO port 1 your compressor should stop at 120 psi
Also, why do you have 2 different robotDrives running with the same inputs? You can list 4 jaguars in the initializer of a single robotDrive and it will output to two motors per side.