Frequently Asked Questions

How does one implement motion detection using navX-Sensor technology?
Detecting motion/no-motion can be simply detected by determining if a body’s linear acceleration exceeds a small threshold.

Using the data directly from accelerometers, this is not as easy as it seems, since raw accelerometer readings contain both acceleration due to gravity as well as acceleration due to a body’s motion. One method for detecting motion with raw acceleration data is to use a high-pass filter, which lets quickly-changing information through but blocks information that doesn’t change frequently.

However, a more comprehensive and reliable approach is to subtract the acceleration due to gravity from the raw acceleration values. The result value is known as “world linear acceleration”, representing the actual amount of acceleration due to motion, and is calculated automatically by navX MXP’s motion processor. Whenever the sum of the world linear acceleration in both the X and Y axes exceeds a “motion threshold”, motion is occurring.

FRC C++ Example

Full C++ Source Code

FRC Java Example


Full Java Source Code

FRC LabView Example

The navX-MXP AutoBalance LabView example shows how to make small modifications to the LabView “FRC RoboRIO Robot Project” using the “Mecanum Robot” configuration to detect when your robot is moving.

RobotMain.vi

Place the NavX main vi on the block diagram and set it up to your needs. The default sample rate is 50Hz. You may need to process faster for your situation. For the SPI, I2C and USB connections the max sample rate is 200Hz.

image

Teleop.vi

The Teleop.vi is modified to detect when the robot has motion.

image

Full LabVIEW Source code on Github

Last Updated 7 years ago

Please Wait!

Please wait... it will take a second!