IO Signal Management
IO and Signal Management for ThriftyNova
Overview
The ThriftyNova controller provides comprehensive access to input/output signals and status information. These features allow you to monitor limit switches, encoder indexes, and other digital signals to coordinate robot actions effectively.
Understanding IO States
The ThriftyNova tracks six digital input signals that can be accessed individually or as a group. Each represents a different signal available on the controller's inputs.
IO State Methods
Getting the Complete IO State
The boolean array returned by the getIOState method provides the current state of each digital input on the motor controller. Here's a breakdown of each index:
Index 0: Represents the state of the forward limit switch (
FWD_LIMIT
).Index 1: Corresponds to the quadrature encoder index (
QUAD_INDEX
).Index 2: Indicates the state of the reverse limit switch (
REV_LIMIT
).Index 3: Reflects the alternate quadrature index (
ALT_QUAD_INDEX
).Index 4: Signifies the status of the quadrature encoder A signal (
QUAD_A
).Index 5: Represents the quadrature encoder B signal (
QUAD_B
).
Example Usage:
Individual IO Signal Access
Example Usage:
Analog Input Support
The ThriftyNova includes support for analog input sensors through a 12-bit ADC (Analog-to-Digital Converter). This provides 4096 discrete levels of resolution, making it suitable for a wide range of analog sensors including potentiometers, distance sensors, and analog absolute encoders. The analog input can be used for position feedback or other sensor applications where continuous variable measurement is required.
Encoder Signal Access
The ThriftyNova also exposes encoder signals as digital inputs. These are primarily intended for monitoring the state of the encoder lines, not for position or velocity tracking.
Note: For tracking encoder position and velocity, use the dedicated methods like
getPosition()
andgetVelocity()
rather than these boolean suppliers. These methods provide the actual encoder values that should be used for control and feedback.
Encoder Position Handling
The ThriftyNova supports multiple types of position feedback:
Internal encoder (built into brushless motors like the NEO)
Quadrature encoder (external)
Absolute encoder (external)
Each type has specific methods to access their position values:
Best Practices for IO Signal Usage
Integrating IO Signals With WPILib
The ThriftyNova's IO methods return BooleanSuppliers, making them compatible with WPILib's Command-based programming. You can use these directly in conditionals or pass them to commands.
Efficiently Polling IO Signals
Like other status frames, you can control how frequently IO data is sent over the CAN bus. If you're using limit switches for critical safety stops, you'll want a higher polling rate, but if you're just using them for homing sequences, you can use a lower rate.
Consider how your robot uses these signals:
For emergency stops or critical limits: 10-20ms (50-100Hz)
For position reference or homing: 50-100ms (10-20Hz)
For diagnostic information only: 200-250ms (4-5Hz)
Remember that IO states are included in the current frame, so you can control their update rate using motor.canFreq.setCurrent()
.
Quick Tips for Encoder and IO Usage
For mechanisms with hard stops (like an arm or elevator):
Use limit switches connected to ThriftyNova inputs
Check limit switch states with
getForwardLimit()
andgetReverseLimit()
When a limit is reached, zero your encoder with
setEncoderPosition(0)
For tracking mechanisms through full rotations:
External encoders often provide more precision than internal encoders
Use
getQuadIndex()
to detect when an encoder passes its index pulseThis can be used to know when a full rotation has occurred
Remember that digital inputs can be used for more than just limit switches:
Connect beam break sensors to detect game pieces
Use proximity sensors for position detection
Implement end-of-travel detection for moving mechanisms
Last updated
Was this helpful?