Figure 1: The completed switchblade robot balances upright.
"Using the LabVIEW graphical system design approach and the NI Single-Board RIO platform, we designed and simulated an LQR controller for our system and then seamlessly deployed the control algorithm to hardware, which significantly accelerated development."
The Challenge: Creating a small, low-cost mobile robot capable of navigating complex terrain, including rubble and stairs.
The Solution: Developing a unique mechanical architecture, simulated and controlled with NI LabVIEW software, that can operate in statically stable and unstable configurations.
The Coordinated Robotics Lab in the Jacobs School of Engineering at the University of California at San Diego conducts research into agile robotic platforms for a variety of applications, including search and rescue, reconnaissance, and mine exploration. Building on previous success with wheeled balancing robots similar to the Segway Personal Transporter, we decided to develop a robot with tank-style treads.
We designed a unique mechanical architecture in which the tread assembly on either side of the central chassis can rotate independently, thus changing the center of mass. Motors inside the chassis drive the treads back and forth and actuate the pivoting of the tread assemblies. Inexpensive microelectromechanical system (MEMS) accelerometers and gyroscopes mounted in the chassis measure the angle of the robot with respect to gravity and the angular velocity. Optical encoders mounted between the chassis and the treads measure the position and velocity of the treads relative to the chassis.
In order to estimate the exact pose of the robot, we needed to fuse together data from all the sensors. Using the accelerometer, which measures the pull of gravity, we can estimate the absolute angle of the robot’s chassis with respect to gravity. However, high frequency noise and body accelerations corrupt this estimate so it is only accurate for slow changes in angle. The gyroscope directly measures the absolute angular velocity of the robot’s chassis, allowing us to estimate the absolute angle of the chassis. However, numerical integration error, calibration error, and thermal drift can add up over time so it is only accurate for fast changes in angle.
Using a complementary filter, we can combine the accelerometer and gyroscope data into one estimate that is valid over a wide frequency range. We apply a low pass filter to the angle estimate from the accelerometer to eliminate the high frequency error and a high pass filter to the integrated gyroscope estimate to eliminate the low frequency error. By choosing the filter constants appropriately, we can add the two together to get a complete estimate.
We derived the nonlinear dynamics from first principles and then linearized them about the desired operating point, the robot standing upright and stationary. We next designed and simulated a continuous-time linear quadratic regulator (LQR) controller with the LabVIEW MathScript RT Module and the LabVIEW Control Design and Simulation Module. After iterating the design and validating the performance, we created a discrete-time LQR controller and simulated it with the continuous-time plant model with only a few minor modifications to the code. After verifying that the performance remained adequate, we added a discrete-time estimator subsystem to simulate the sensors on the robot, including noisy and limited-accuracy measurements. Again, the controller performed satisfactorily.
We used the simulator to test how the robot would recover from a number of different nonequilibrium states without risking damage to the actual hardware. From these tests, we determined that the robot could transition from a statically stable position, with the treads flat on the ground and the chassis opened 15 degrees past vertical, to the upright position by simply turning on the controller. The simulation results gave us confidence in the expected performance of the real robot.
We chose an NI Single-Board RIO device to act as our robot’s embedded controller because it has a field-programmable gate array (FPGA) for ultra-high-speed, massively parallel computation. In addition, it has a PowerPC processor for floating point math computation with minimal compile time. We replaced the MathScript Node in the simulator with a FPGA read/write control block to deploy the code to the NI Single-Board RIO device mounted on the robot. We also added code to detect falls and switch between different operation modes.
We connected the accelerometer and the gyroscope to an NI 9205 analog input module, which is connected to the NI Single-Board RIO device. In addition, the optical encoders are connected to the FPGA. Code developed in LabVIEW running on the FPGA samples the optical encoder channels and calculates position, velocity, and acceleration for the four encoders simultaneously in parallel. A wireless Ethernet adapter connects to the Ethernet port on the NI Single-Board RIO device to deploy and debug code over Wi-Fi. The 5V bus on the NI Single-Board RIO device powers the sensors, the wireless Ethernet adapter, and several status lights on the robot.
To communicate between the host PC VIs and the robot, we used network-published shared variables. A Logitech USB gamepad is plugged into the host PC and a simple VI running on the host PC reads the button and joystick commands and writes to the shared variables. The onboard camera is connected to a moviMED AF-1501 analog frame grabber module. Images are processed in real time and sent to the host PC over Wi-Fi for remote teleoperation.
The robot was able to right itself and balance as predicted by the simulation. We logged data to a Technical Data Management Streaming (TDMS) file on the NI Single-Board RIO device and compared it to the simulation. The results matched closely, though not perfectly due to uncertainties in the model such as motor backlash. The combination of the mechanical structure, electronics, and software create a uniquely agile mobile robot.
National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.