Paul's Tutorials - logo2-4Pneumatics



In this chapter, you have learned how to actuate different motors on the robot, and how to use them with driving. However, this does not include all of the possible parts on the robot that can be actuated.

In this lesson, you will learn how to actuate pneumatic control devices.

Pneumatic Control

The pneumatics on the robot follow a slightly different method of operation compared to motors. So, before you start looking at code for pneumatics, you should understand just how pneumatics work.

If you remember from lesson 1-1, pneumatic actuators are controlled by solenoid valves. These valves have two states: open and closed. These states are then keyed to the operation of the machine.

It is important to realize that the valve's closed state is not necessarily like an "off" state. While it is the state that the machine is in while it is off or disabled, teams usually make this state the state the machine is in most often. For example, on the 2014 HOTBOT, the shifter was controlled by a solenoid valve. However, when the solenoid was closed, the gearbox was in high gear. In order to shift into low gear, the valve had to be opened. Essentially, it is important to realize that the solenoid's closed state is not necessarily inert or unuseful.

Solenoids

Just like motors, Solenoids are controlled using the Set() function.

void Solenoid::Set(bool state)

Solenoid Set() parameters

The only parameter for the Set() function is a true or false value. These map to open and closed, respectively.

Solenoid Set() use

m_solenoid->Set(true); //open valve
m_solenoid->Set(false); //close valve

What state?

Again, you may be in a situation where you need to know what state a solenoid is currently in. You can get this with the Solenoid Get() function. The return value is a boolean that is true when the valve is open and false when it is closed.

bool Solenoid::Get()

Compressor

One of the important things about a pneumatic system is that the pressure in the system must be kept at safe levels. In the past, teams had to program this safety feature into their code, but since the 2015 season, this has been automatically controlled by the controls system.

However, it is still important to be able to control whether the compressor is running or not, for similar safety reasons. The Compressor class has remained on the new control system, and can be used to this effect.

The unique thing about the Compressor class is that it acts both as a sensor and an actuator. It combines the input from the pressure switch and the output to the compressor in one class.

Reading from the Pressure Switch

If you remember from lesson 1-1, the pressure switch only gives you a true or false value. You can use the following function to get that value:

bool Compressor::GetPressureSwitchValue()

GetPressureSwitchValue() will return:

Setting the Compressor

Of course, the other important thing that you need to be able to do with the compressor is control whether it is on or off. You can do this with the following two functions:

void Compressor::Enable()
void Compressor::Disable()

Running the appropriate function will enable or disable the compressor.

Is it enabled?

In addition to being able to set the compressor, much like everything else, sometimes it is also helpful to know what the compressor is currently set to. You can use the following function to do this:

bool Compressor::Enabled()

This function will return true if the compressor is enabled, false otherwise.

Activity

If you currently have access to a robot with a pneumatics system, figure out the mapping of the solenoid valves and do the following:


← 2-3 Earning Your Driver's License: Driving 2-4 Pneumatics Chapter 3: Control →