Keywords

1 Introduction

Biomimetic robots are a class of robots that resemble a living organism’s shape, appearance, or behaviour. They are designed to use biological principles in engineered systems to behave like a natural being, allowing them to solve specific problems, not possible for standard machines [1]. A snake robot is an example of a biomimetic, hyper-redundant robot with many degrees of freedom. Changes in the internal shape cause the snake robot’s motion, similar to the natural biological creatures. Each robot configuration is characterized as a series of angles in joints connecting a series of robot segments [2].

Virtual Reality (VR) provides a platform to visualize the immersive behaviour of objects in a three-dimensional environment. Nowadays, VR is widely used in entertainment to enhance immersive movements. However, VR is also popular among researchers to construct complex environments in simulation and observe the behaviour of objects.

A comprehensive review of virtual reality interfaces for controlling and interacting with robotics is presented in [3]. The authors describe that VR interfaces are not only used for visualization but also for robotic interaction, planning, usability and infrastructure for both expert and non-expert users. However, this review couldn’t include biomimetic robotics. In [4] motion of haptic snakes-serpentine shapes is investigated for multiple feedback, i.e. tapping and gesture feedback in virtual reality. However, literature related to snake robots in virtual reality is limited.

The main aim of this paper is to present a VR environment prototype to visualise the snake robot’s motion. The proposed system can be used to evaluate different robot control algorithms.

This article is organized as follows. The Introduction section describes the importance of virtual reality simulations in snake robot design. Section 2 describes the snake model used in this paper. Section 3 presented a snake robot simulation in MATLAB. Section 4 presents results and simulations in MATLAB and Unity software. Finally, the conclusions and future works are given

2 Snake Robot Model

The model used in the article is based on widely used equations of snake robot motion on a flat horizontal surface. The dynamical model of the snake robot can be derived based on the torque equilibrium equation. A detailed description of the model can be found in [5] and [6]:

$$\begin{aligned} \textbf{M}_{\theta } \ddot{\boldsymbol{\theta }} +\textbf{W} \dot{\boldsymbol{\theta }}^{2} -l \textbf{S}_{\theta } \textbf{K} \textbf{f}_{R, x} +l \textbf{C}_{\theta } \textbf{K} \textbf{f}_{R, y} =\textbf{D}^{T} \textbf{u} \end{aligned}$$
(1)

where \(\textbf{S}_{\theta }=diag(sin(\theta )) \in \textbf{R}^{N \times N}\) and \(\textbf{C}_{\theta }=\text {diag}(cos(\theta )) \in \textbf{R}^{N \times N}\) are square matrices with trigonometric functions of link angles at the diagonal and zeros in the remaining elements, and link angles \(\boldsymbol{\theta }=\left[ \theta _{1}, \ldots , \theta _{N}\right] ^{T} \in \textbf{R}^{N}\) in global coordinate system. The vector \(\boldsymbol{u} \in \textbf{R}^{N-1}\) defines the controllable parameters - actuator torques exerted on successive links. The \(\textbf{f}_{R, x}\) and \(\textbf{f}_{R, y}\) vectors represent components of friction force on the links in global x and y direction.

The movement of the snake robot is possible due to anisotropic friction force. The friction coefficient in the longitudinal direction of each joint is much lower than the coefficient in the lateral direction. This property allows the robot joints to slide in the forward direction.

3 MATLAB Simulations

The robot’s equations of motion have been implemented in MATLAB software and solved using the ode solver. MATLAB implementation also included control algorithms that allowed the snake robot head to reach a designated position. It is also possible to track the position of the robot’s centre, but it is less useful in trajectory tracking problems.

A simple path-following method by the snake robot is called a Line-of-Sight (LoS) method [7]. According to this method, the robot is tracking a straight line. This approach requires the definition of the global coordinate system \(\{x, y\}\) in which the x axis is aligned along with the forward movement. The implementation of LoS algorithm is available at [11, 12]. Full description of the program and implemented snake robot model can be found in [9].

The MATLAB Model Predictive Control Toolbox allowed the implementation and testing MPC algorithm in trajectory tracking. Two MPC variations have been tested - when all joints of the robot could move independently and when all joints were coupled in sinusoidal function. In the first case, the MPC algorithm calculated nine independent variables for ten segment robot. In the second case, there where only three variables - parameters of the function \(a_1(sin(a_2+a_3\cdot i))\) where i is the segment’s number. Figure 1 shows the comparison of the resultant trajectory of the robot head for different control algorithms. During simulation the robot consisting 10 segments of length 0.2 m the robot had to achieve the following points one by one: (2.5 m, 0 m), (3 m, −1 m), (4 m, 0 m), (6 m, 1 m), (8 m, 1 m).

Fig. 1.
figure 1

Plot showing trajectory of the snake robot’s head for different control algorithms.

The resultant position and orientation of snake robot links at each moment have been saved to the txt file for each control strategy. Based on this information, visualisation programs can fully restore the snake robot’s motion

4 Visualisation of the Snake Robot Motion

4.1 Simulink 3D Animation

Visualization of robot movement is implemented using a MATLAB Simulink 3D Animation toolbox. The geometry of the robot segment is imported from the STL file created in SOLIDWORKS. The details of the segment design were described in [9]. The introduced framework allows simulating the robot’s motion for different geometry parameters (e.g., number of joints, weight, friction coefficients), target trajectories (position of points to follow), and control parameters (e.g., head/centre tracking, controller gains, joints’ disturbances). The ready-to-use code with comments, helping to run the software, is available in [11] and [12]. The main LiveScript file start.mlx contains a detailed description of the model and its implementation. The Simulink file VRmodel2.slx enables running 3D visualization of the snake motion shown in Fig. 2.

Fig. 2.
figure 2

Visualisation of the snake robot implemented in Simulink 3D Animation.

4.2 3D Simulations in Unity

The following work step was the implementation of the 3D visualisation of the snake robot using software dedicated to graphical animations. We used Unity Engine and Oculus Interaction SDKK [8]. The implemented program allows simulation in Oculus Quest 2 headset [10]. The user can interrupt the program execution using VR controllers. The visualisation program used the same CAD segments as the animation described in Sect. 4.1. The position and orientation of the robot segments in consecutive moments were interpolated using data read from a txt file generated by MATLAB. The virtual environment also displays the location of the reference point the snake is currently following (Fig. 3).

Fig. 3.
figure 3

Visualisation of the snake robot implemented in Unity.

The main advantage of VR visualisation is that the user can observe the snake robot’s motion from any distance and perspective. The proposed solution allows users to catch any distortion of robot motion and get an idea of how would the real robot behave.

Aside from the segments position program can also visualise the velocity of each segment. For this purpose, an animation shows a point corresponding with the future segment’s position. The current and future coordinates line describes the robot’s velocity value and direction. Users can change the selected link at any time during the simulation (Fig. 4).

Fig. 4.
figure 4

Graphical User Interface and controllers ray allowing interaction with GUI.

By manipulating the Oculus Quest 2 controllers, the user can change the speed of the simulation, stop it or rewind it. There is also a Graphical User Interface (GUI) shown in VR, which allows manipulating the simulation time, restarting it or running different simulations by changing the file with the positions of robot segments. The GUI provides for changing the selected link for velocity visualisation and includes sliders, push, toggle, and a drop-down list. The user interacts with GUI elements by “ray” going out from the controller.

5 Conclusions

Virtual Reality is a very innovative and quickly developing technology. It offers the possibility of not only observing but also experiencing the virtual environment. Above entertainment, education and socialization, it brings unique opportunities in engineering research. The article shows a novel way of using VR for visualization of the motion of the snake robot. This approach can significantly affect the development of control algorithms for robotic systems.

Future work should concentrate on observing the snake robot’s motion and interacting with it from VR. Visualisation in Unity and simulation in MATLAB will run parallel, and there will be established communication between both programs. The program will allow changing of the robot’s trajectory from the interior of VR, so the observer wearing a VR headset could analyze the robot’s motion and interact with it in real-time. The destination point that the robot should reach would be assigned by a user using the VR controller. The user will mark the desired position of the robot on the floor and click the trigger button to record it. Unity would send the coordinates of the chosen point to MATLAB. Unit-MATLAB communication will be based on TCP protocols. The control algorithm implemented in MATLAB would calculate the target trajectory based on the received reference point. The computed positions of segments will be sent back to Unity, and the output robot’s configuration will be displayed in VR. The new versions of the program GUI will include the algorithm selection and allow for parameter changes.