14.10.2013 Views

FRC 2012 Safety Config Tutorial - The Fighting Pi

FRC 2012 Safety Config Tutorial - The Fighting Pi

FRC 2012 Safety Config Tutorial - The Fighting Pi

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Safety</strong> <strong>Config</strong>uration <strong>Tutorial</strong><br />

For <strong>FRC</strong> 2010 and earlier, the Watchdog timer was used as a safety mechanism to prevent runaway<br />

robots. LabVIEW <strong>FRC</strong> 2011 introduced a new way to implement similar functionality for MotorControl,<br />

PWM, Relay, RobotDrive, and Solenoid operations with the <strong>Safety</strong> <strong>Config</strong>uration VIs. <strong>The</strong>se safety<br />

configuration VI’s are unchanged for <strong>2012</strong>. <strong>The</strong>re are three main steps to using the safety features:<br />

1. Opening a new reference to a MotorControl, PWM, Relay, RobotDrive, or Solenoid creates a<br />

“safety reference” for that device in the background.<br />

2. Calling the <strong>Safety</strong> <strong>Config</strong> VI for the device allows you to enable or disable the safety feature for<br />

that device and to set a timeout value.<br />

3. <strong>The</strong> value written to that device must be updated at least every period of the timeout counter<br />

or the safety mechanism will interrupt its output. <strong>The</strong> following actions are taken for each type<br />

of device:<br />

MotorControl – stops the motor<br />

PWM – turns off PWM<br />

Relay – resets the relay to its default value<br />

RobotDrive – stops the motor<br />

Solenoid – resets the solenoid to its default value<br />

NOTE: Only the RobotDrive Open VIs enable the safety feature by default. For other devices, the safety<br />

feature needs to be manually enabled by calling the <strong>Safety</strong> <strong>Config</strong> VI for that device.<br />

Here is an example of the <strong>Safety</strong> <strong>Config</strong> VI being used for MotorControl:<br />

When the MotorControl<strong>Safety</strong> VI is called it automatically creates a “safety reference” for that device in<br />

the background. <strong>The</strong> MotorControl<strong>Safety</strong><strong>Config</strong> VI is then used to enable the safety feature and set a<br />

timeout value of 100ms. Inside the While Loop, the MotorControlSetOutput VI is called repeatedly. If<br />

more than 100ms elapse between calls to the MotorControlSetOutput VI then the motor will be stopped<br />

until the MotorControlSetOutput VI is called again. At the end of the program, calling the<br />

MotorControlClose VI also closes the “safety reference” in the background.


For safety reasons it is recommended that you always enable the safety feature for your MotorControl,<br />

PWM, Relay, RobotDrive, and Solenoid devices. However, if you prefer to use the Watchdog VIs to<br />

implement a safety mechanism in your code, those are still available to you in LabVIEW <strong>FRC</strong> <strong>2012</strong> as<br />

well.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!