Building and Controlling a Multiple Degree-of-Freedom Fish Robot to Study Motion Optimization Using CompactRIO
"The NI CompactRIO embedded system provides a complete solution as it contains a real-time processor to perform algorithms, an extendable interface to handle various sensor signals simultaneously, and is fully supported by LabVIEW."
- Chunlin Zhou,
Nanyang Technological University (NTU)
Developing a multiple degree-of-freedom (DOF) robot fish in order to study the fish-like propulsion hydrodynamics and to determine optimal locomotion patterns.
Using CompactRIO, LabVIEW, an artificial central pattern generator (CPG), a genetic algorithm (GA), and a closed-loop swimming control system to control a swimming robot.
Chunlin Zhou - Nanyang Technological University (NTU)
Control System Description
In this project, we wanted to explore the application of CPGs to generate the swimming gait for multi-DOF fish robots and the use of GAs in the online optimization of swimming locomotion. We hoped to determine both the maximum linear swimming speed and the most efficient swimming pattern. Figure 1 shows the fish robot prototype and the overall three-layer control architecture. The swimming robot is suspended in a water tank through a sliding carriage, which moves along a linear motion guide. The inactive parts of the prototype such as the actuators, wires, sensors, and structural frames, stay in the air while the fish body is submerged in water. Our prototype contains eight brushless servo motors to drive the multi-DOF fish body, eight strain gage-based force sensors to detect the force outputs of the actuators, one digital velocity sensor to measure the swimming speed, and several limit switches.
The outputs of the CPGs, performed in the NI CompactRIO system, drive the motors in the robot. The GA optimizes the nine input parameters (eight amplitudes, A1–A8, and a frequency, f) that regulate the behaviors of the CPGs. We chose a GA, which is a stochastic global search method inspired by biological evolution in nature, because of its ability to search global optima and universality in many application areas. GA involves a set of algorithms and operations, all performed in a PC-based program. The fish speed and position, and the output forces of the actuators act as the feedback to the GA, help determine the swimming performance, and refine the control parameters. Thus, the whole control loop is closed.
Overall, the control system executes algorithms in the CPG, generates driving signals for multiple actuators of the robot, collects and processes various sensory signals, and exchanges data with a higher level controller. The CompactRIO embedded system provides a complete solution as it contains a real-time processor to perform algorithms, an extendable interface to handle various sensor signals simultaneously, and is fully supported by LabVIEW. The PC performs the GA and sends the optimized control parameters to the CompactRIO, which controls the swimming of the robot and then returns the performance data to the PC. The two systems communicate through the built-in FTP server in CompactRIO.
Applying CompactRIO in a Fish Robot
CPGs are neural systems capable of producing coordinated patterns of rhythmic activity without any input from sensory feedback or higher control centers. Both invertebrate and vertebrate animals, including humans, have CPGs. Mathematically, artificial CPGs can be modeled by certain coupled nonlinear ordinary differential equations (ODEs). Two ODEs define each CPG system and 16 total equations must be solved for the present robot within the sampling period. Our system had a 20 ms sampling time, which presented a critical control challenge. Our system solved ODEs using the 4th order Runge-Kutta method in LabVIEW, deployed in an NI 9073 real-time controller. LabVIEW provides the ODE Runge Kutta 4th Order VI to solve nonlinear ODEs, but you could also create your own code in the Formula Node VI to perform this task. We chose the latter method because it ran faster on the CompactRIO. We created a subVI, osc.vi, to solve each ODE pair, and the high-performance operational capability of the NI 9073 controller ensured that all pairs could be solved in real time. Figure 2 shows the connection of these artificial CPGs.
Two NI 9219 modules collect 8-channel, full-bridge strain gage signals. Each module contains 4-channel, high-speed A/D converters, which provide full support for acquiring raw strain gage signals. Using these modules, we eliminated the need for signal amplifiers, which helped reduce our hardware budget. The control signals for the eight servo motors are encoded into 8-channel, 50 Hz PWM pulse trains controlling the motors through an NI 9401 digital I/O module. We obtained the PWM signals by simply setting the property of the module in LabVIEW. We used an NI 9403 module to handle the normal digital inputs obtained from the velocity sensor and limit switches. After the CompactRIO system collects and processes the sensory signals, it transmits them to a PC for GA processing. Once the GA obtains better motion control parameters, they travel to CPGs operated in the CompactRIO system, thus controlling the locomotion of the robot. The Ethernet and built-in FTP server in the NI 9073 facilitates the exchange of data.
Using CPG-based gait control and a GA as a parameter optimizer, we determined that the optimal speed for energy efficiency in a fish robot is 0.52 body length/s, which is larger than the findings of offline-based approaches. We used the speed per unit input power as an indicator of cost-efficiency. These findings can improve the performance of future bionic underwater vehicles.
Our CompactRIO system, including the CompactRIO real-time controller and chassis, various NI C Series I/O modules, and the LabVIEW Real-Time Module, was key to our experiment. It provided a one-stop solution for the data acquisition, data processing, control, and communication necessary for this research. We saved both money and development time thanks to this highly integrated system.
Explore the NI Developer Community
Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.
Who is National Instruments?
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.