The use of hardware-in-the-loop (HIL) simulations to reduce development time and costs has been increasing rapidly in the robotics industry.
At its core, HIL is a form of real-time simulation. It differs from a pure real-time simulation in that a real physical component (the component being tested) is added to the loop. A software model of the plant is created to simulate the system and provide all necessary electrical signals to send to a controller; essentially fooling the physical component into thinking it's operating in a real environment, with real-world inputs and outputs, and in real-time.
The effectiveness of such a simulation relies on the fidelity of the plant model. Unfortunately, high-fidelity system models are rarely deployed for HIL simulations for two reasons: they can be difficult to develop, and they're too slow for real-time simulations. Consequently, there's always a compromise between model fidelity and simulation speed.
Causal vs. acausal physical modeling
In the traditional signal-flow approach to system modeling, the ordinary differential equations (ODEs) that describe the system dynamics must be derived prior to using the modeling tool, usually by hand, based on the engineer's knowledge of the underlying physics. The ODEs then have to be rearranged into a series of integral equations, which are then entered in block-diagram form. The process is time consuming and error prone. In addition, the models are hard to develop and look nothing like the original system representation.
With an acausal modeling tool, such as MapleSim, each modeling block is a discrete physical component, such as a spring or a mechanical joint. Each block maps directly to a physical component in your system, effectively eliminating the need to derive and manipulate equations by hand, and resulting in a model diagram that's more visually representative of the real system. This is possible because the associated physical laws are already embedded with the component.
In this approach, system modeling doesn't rely on the ability to derive system equations but rather on the inherent talent of engineers to visualize how physical components connect and interact in real systems. As a comparison of the causal and acausal approach to physical modeling, the model diagram of a double mass-spring-damper system is shown in Figure 1. While the concept is simple for a double mass-spring-damper system, the implications for complex system models are far greater.
Figure 1: The causal (right) vs. acausal (left) modeling approach is shown here.
Now let's discuss the application of various symbolic techniques to preprocess models for minimal code generation. For multi-body robotics models, the efficiency of a system's final set of equations is strongly dependent on the selected coordinates. The modeling tool's library, which is based on linear graph theory, can automatically select coordinates to generate compact equations, resulting in fast simulations. As an example, a simple pendulum resolves to an index 3 problem if absolute Cartesian coordinates are used. By contrast, using a pendulum's angular position as the generalized coordinate results in an index 0 problem, or simply an ODE (Fig. 2).
Figure 2: The pendulum coordinate selection can be greatly simplified using the right tool.