### System model

The BCF mode carangiform style [5] of locomotion shown in Figure 1 is approximated using a 3-link (including the pectorals attached to the head) mechanism with two actuated joints as illustrated in Figure 2. The first link as the ‘head’ and second link as the body are roughly two-thirds of the length of the entire robot. The tail of the robot is formed by the third link connected to the caudal fin. The configuration of the robotic fish and non-fixed head is illustrated. Our 3-link mechanism (*n* = 2) is a reasonable approximation to the BCF carangiform locomotion, and therefore, small modifications of this model should have been used in the analysis of carangiform swimming. Moreover, the caudal peduncle and fin have been rendered in to a thunniform (shark) semi-crescent structure for an efficient thrust and therefore allowing high cruising speed for longer period of time [5]. While the kinematics study explains the geometry of the motion of robotic fish w.r.t, a fixed reference coordinate frame as a function of time, the dynamics of any rigid body [10]-[12] can be completely described by the translation of the centroid and the rotation of the body about its centroid. This leads to the ability to derive the actuator torques necessary to produce the tail motion that is desired. A linearized kinematic and dynamic model of the robotic fish system is developed. The present research work investigates into the system modeling as an *n*-joint manipulator-based mobile vehicle; the earth-fixed frame has been defined w.r.t. the fixed body reference frame. Relevantly, the two major sections of the present paper robotic fish system model are the following:

Denavit-Hartenberg (DH) kinematics model [11]: The kinematics due to translation and rotation along the joints on the robotic fish system in fluid (water) environment.

Lagrangian dynamics model [10],[11]: The dynamics due to kinetic and potential energies generate along each link and inertia of the free-flow water entrained in the robotic fish system.

When describing the kinematics and dynamics of the model shown in Figure 2, the interlink actuator shaft constitutes the inertial frame of reference. A local coordinate frame is assigned to each degree of freedom (DOF). The coordinate frames are assigned according to the standard Denavit-Hartenberg notation [11] mentioned in Appendix A.

#### Generalized equations of motion

The dynamic equations of the robotic fish are obtained using the Lagrange-Euler formulation [10],[11] given as:

\frac{d}{dt}\left(\frac{\partial L}{\partial {\dot{q}}_{i}}\right)-\frac{\partial L}{\partial {q}_{i}}={\tau}_{i}\phantom{\rule{1em}{0ex}}i=1,2,\dots ,n

(1)

The Lagrange (L) function is defined as the difference between the kinematic and potential energies expressed as:

where *K* is the total kinetic energy of the robot; *P* is the total potential energy of the robot; *q*_{
i
} is the joint variable of *i*_{
th
} coordinates; {\dot{q}}_{i} is the first time derivative of the *i*_{
th
} joint variable, and *τ*_{
i
} is the corresponding generalized force (external torque) at *i*_{
th
} joint acting on the head. The manipulator dynamic equations have been developed in three dimensions for an *n*-link manipulator on a 6-DOF base, assuming that there is gravity acting on the system. The equations of motion for the present 2*-* link robotic fish based on the *n*-link serial manipulator can be set as:

{\displaystyle {\sum}_{j=1}^{n}}{D}_{ij}\left(q\right){\ddot{q}}_{j}+{\displaystyle {\sum}_{k=1}^{n}}{\displaystyle {\sum}_{m=1}^{n}}{h}_{ikm}{\dot{q}}_{k}{\dot{q}}_{m}+{c}_{i}={\tau}_{i}\phantom{\rule{1em}{0ex}}i=1,2..,n

(3)

where *D* (*q*) is the symmetric inertia matrix; h\left(q,\dot{q}\right) is the velocity coupling vector or Coriolis and centrifugal force vector; *c* (*q*) is the gravitational vector; and *τ* is the generalized force of the Lagrange equations. As the above equation has been successfully used for investigating the dynamics of underwater vehicles [10],[12] as well as robotic manipulators [11], this research therefore aims to develop an *n*-joint manipulator-based mobile vehicle. Following the analysis, the mechanical design in SolidWorks is implemented. SolidWorks as the mainstream software in virtual prototype field combines multibody dynamics modeling with large displacements as well as multifunctioning tools. It has a more powerful geometric modeling function. By utilizing SolidWorks, a kinematics model of a robotic fish, with coordinated motion of multiple propulsive mechanisms, is established as shown in Figure 3a,b,c and the real hardware prototype used for closed-loop experiments [9] is shown in Figure 3d. Details of the dynamic modeling of present bio-inspired robot can be found in [12].

### Lighthill mathematical framework design

The initial work to understand the fish kinematics appeared prominently in the article by James Gray [13]. It mentions about the fish swimming by generating a traveling wave down their bodies from the anterior (leading surface) toward the posterior caudal tail (trailing surface). This propulsive wave travels faster than the fish body (center of mass) velocity. The wave amplitude also increases from the head to the tail, maximum at the narrow peduncle region. Lighthill in his analysis of Gray's work [13] extended and formulated the slender body theory, which proposed the fact that the overall fluid flow around the body is a compound of the steady flow around the straight body and the flow due to the lateral displacement *h*(*x, t*). The second component (flow) *V(x*, *t)* for a given cross sectional area *S*_{
x
} with fluid velocity *U* given by:

V\left(x,t\right)=\left(\frac{\partial h}{\partial t}\right)+U\left(\frac{\partial h}{\partial x}\right)

(4)

Lighthill's theory discusses the swimming efficiency in detail and discusses on the role of flow produced by the lateral displacement on the efficiency improvement during the undulatory propulsion. The overall swimming efficiency as a function of overall fluid flow *V(x*, *t)* is termed as Froude's efficiency [13]*η*_{
f
} given by:

{\eta}_{f}=1-\frac{1}{2}\left[\frac{V{\left(x,\overline{t}\right)}_{x=l}^{2}}{\left(\frac{\partial h}{\partial t}\right)V{\left(x,t\right)}_{x=l}}\right]

(5)

The theory uses a set of partial differential equations to calculate the thrust and efficiency of swimming with definite rhythmic and symmetric body motions. Supporting a laterally compressed wave and maintaining a high Froude number efficiency (as might be done by the biological fishes in real), the motion of a traveling wave displacement vector *h(x*, *t)* was introduced by Lighthill as an empirical expression given by:

h\left(x,t\right)=f\left(x\right)\times g\left(t-x/c\right)

(6)

where the *f*(*x*) term that indicates the amplitude, *g*(*x, t)* is an oscillatory frequency dependent wave function, and *c* is the fish body velocity. Out of the many alternative forms that can be represented, the equation structure resembles primarily that of a time-dependent harmonic oscillation wave. It is found that propulsion patterns generated by fishes are dependent on purpose like food-search, hunting, migrating, mating, etc. [14]. The body dimensions (size) evolved over the ages as well as a specific environment also plays major role in these patterns. Based on the detailed study of the biological attributes of fish undulatory propulsion as well as Lighthill postulation on the oscillatory motion, a novel approach is made to extend and evaluate different mathematical functions that can fit in the frame of Lighthill. The integration of Lighthill mathematical model with robotic fish inverse kinematics and dynamics model as shown in Figure 4. The platform to validate the present research is the robotic fish designed and fabricated in our laboratory. Also, it is significant from the point of view that an evolutionary (biological) trait can be studied through the bio-inspired algorithms evolving from these functions, like different need based actions, for example, a minimum energy body motion to travel a fixed distance etc. Therefore, a variety of actions and environments in real world can be understood through this research on a robotic fish (machine world). We can term it as understanding organic evolution of fish swimming (a biological hypothesis) through bio-inspired machines (designed on principles of mathematics and physics) [15],[16], in an inverse learning map. Another viewpoint presented through our 3 DOF robotic fish model is that, on varying this DOF, a proportionate variation can be seen in the resulting motion. For example, selecting one DOF and a sine oscillating function would generate a tadpole motion in a 2D plane. Similarly, selecting one DOF and a suitable spline wave equation can produce a tadpole helical motion in 3D plane. On the other hand, if we introduce a 2 DOF and the Lighthill quadratic wave function, it results into a planar BCF carangiform (undulatory) motion. Further, adding a DOF and running the median pectoral fin (MPF) anguilliform waveform can lead to a more maneuvering motion resembling between a tuna and an eel. Therefore, combination of the various DOFs and Lighthill frame wave function can together attain as well as sustain different undulatory actions to undertake various tasks in different environments. The different mathematical wave functions are given below.

#### Undulatory Lighthill quadratic amplitude body wave

Lighthill was the one of the pioneers in applying the methods of slender body theory [13] to an undulating body swimming in an inviscid fluid medium. Dewar's [17] practical studies on kinematics and energetics on carangiform fishes by direct observations of biological fish are imminent to support Lighthill's theory as they lie in a digitized record. It was later used in one of the pioneering works of biologically inspired robot called MIT Robotuna [6] to validate a carangiform robotic swimming mode and other prominent research findings [7],[15]. In this work, the mechanical robotic fish body generates a planar progressive wave function as a function of lateral curvature in spine and musculature, showing the undulatory propulsive behavior.

{y}_{\mathit{body}}\left(x,t\right)=\left({c}_{1}x+{c}_{2}{x}^{2}\right)\left[sin\left(kx+\omega t\right)\right]

(7)

where *y*_{body} is the transverse displacement of body, *x* is the displacement along main axis, *k* is the body wave number (*k =2π/λ*), *λ* is the body propulsive wave length, *c*_{
1
} is the linear wave amplitude envelope, *c*_{
2
} is the quadratic wave amplitude envelope, and *ω* is the body wave frequency. Taking this body wave, the present research does kinematic analysis to determine the proper body wave parameters (*c*_{
1
}, *c*_{
2
}, *k*, *ω*, etc.) for a desired and efficient undulatory swimming motion. We have further compared other mathematical functions in this frame (given below) to find their suitability to replace for a better undulatory wave function for robotic fish rectilinear swimming in a two-dimensional plane.

#### Undulatory Lighthill cubic amplitude body wave

In this paper, we propose the cubic body wave equation as an extension to Barrett's formulation by replacing the quadratic amplitude expression by a cubic spline polynomial. The motive behind this was to observe the efficacy of cubic polynomials in designing a continuous and smooth (non-jerky) motion through each rotational joint and therefore, passing more closely through the lateral displacement data points. It also accommodates more intermediate or via points in the plane. In the field of trajectory generation for robotics, cubic polynomials have been reported in majority due to its ability to track complicated trajectories efficiently [18].

{y}_{\mathit{body}}\left(x,t\right)=\left[\left({c}_{1}x+{c}_{2}{x}^{2}+{c}_{3}{x}^{3}\right)\right]\left[sin\left(kx+2\pi f\times t\right)\right]

(8)

As the curvature of the wave primarily depends on the second derivative, it is found to be continuous here, to assist in velocity control. A major advantage of adding local intermediate points is not only to fit a smooth curvature for the harmonic motion but also flexibility to the body in physical terms. Throughout a given time period when the speed, orientation, and velocity changes gradually, these factors render the resulting trajectory smoothness. In physical terms, this smoothness means that there are lesser abrupt changes in power output for the robot’s drive system, thus reducing navigational errors and helping to moderate the robot’s energy consumption. Therefore, the function allows specifying undulatory motion that conserves both battery power while reducing travel time and minimizing navigational errors.

#### Non-uniform rational B-spline (NURB) quadratic and cubic body wave (tadpole-like motion)

In order to adapt the Lighthill frame harmonic waveform from control design perspective (with the presence of control points), a Bezier spline traveling waveform is proposed in this paper. Wu [19] has modified the methods of thin airfoil theory to analyze the motion of a waving 2D plate. The essential 2D and 3D methods developed by Lighthill and Wu, respectively, have formed the basis from which the turning models were developed. Singh and Pedley [20] claim that Lighthill's classical elongated body theory for fish swimming forms the fundamental basis for the 3D flow model modified from the 2D small amplitude model reported earlier. Literature reports of combining efficient swimming propulsive force (speed) and maneuverability in the tadpole-like swimming mode can also be found [21]. The survey further mentions 3D propulsive motion of a free swimming larvae generating and controlling helical trajectory (rotation while swimming) by Long et al. [22]. Morphological and kinematic asymmetries of tail motion generate a rolling and pitching action [23] in addition to the yaw motion. Similar work, by Krishnamurthy et al. [24] find a bio-robotic implementation (robotic electric ray) in planar motion by modulating the propeller speed as the control variable, but the implementation was done in 2D (as a sub-case of 3D) to avoid dynamic complexity issues. Instantaneous trajectories are computed by extending Lighthill's two-dimensional model in *xyz*-plane by Singh and Pedley [20] and the tadpole’s cycloptic helical motion [22]. Inspired by the aforesaid work, a framework was incubated and finally modeled for fitting the present robotic fish kinematic model, generating the 3D turning maneuvers. An attempt is made in this research also to define a mathematical expression in Lighthill frame for the 3D undulatory motion. It is to be noted that the robotic fish model is actuated by rotational joints with 1 DOF which can lead to various singularities in response to the mathematical solutions generated by the NURB trajectory. This motion would aim to satisfy the combined requirements of propulsive forces (speed) and turning angles (maneuverability) from the perspective of an energy efficient trajectory. This section, therefore, proposes and formulates a NURB mathematical equation as the new parametric curve to represent the propulsive wave behavior as lateral curvature in spine and musculature in 3D. In addition to the control points, other advantages of using this model is that it can offer a common mathematical form for standard analytical shapes and also provide the flexibility to design a large variety of parametric shapes. Secondly, the geometrical evaluation can be reasonably fast by numerically stable and accurate algorithms. They are invariant under affine as well as perspective transformations. They are generalizations of non-rational B-splines and non-rational/rational Bezier surface curves. NURB shapes are not only defined by control points but also by their weights associated with each control point. This waveform assumes each reference point to be a control point as the traveling wave passes through only the first and the last control points therefore reducing the path length. This also adds to the trajectory planning in a way as the full control over the wave shape is achieved by tweaking a few parameters. They are also necessary to make it an optimal choice for the propulsive wave model. The weight calculation like parameter in other mathematical expressions is done based on the real kinematic data of carangiform fish. A NURB curve *C*(*u*), which is also a vector-valued piecewise rational polynomial function representation, can be expressed as:

C\left(u,v\right)=\frac{{\displaystyle {\sum}_{i=1}^{n}}{\displaystyle {\sum}_{i=1}^{n}}\left\{{w}_{i}\times {P}_{i}\times {N}_{i,k}\left(u,v\right)\right\}}{{\displaystyle {\sum}_{i=1}^{n}}{\displaystyle {\sum}_{i=1}^{n}}\left\{{w}_{i}\times {N}_{i,k}\left(u,v\right)\right\}}

(9)

where *w*_{
i
} is the weights, *P*_{
i
} is the control points (vector), and *N*_{
i,k
} is the normalized B-spline basis functions of degree *k.* The proposed mathematical model is in a normalized form. Therefore it reduces the scope of redundancy and dependency on one hand whereas increasing the consistency in results on the other. The proposed NURB mathematical model in Lighthill frame is verified for quadratic spline equations. To implement a curved trajectory, an arbitrary orientation for the robotic fish vehicle at its final position cannot be specified. To overcome this shortcoming, a somewhat more complicated curve in the form of a three-degree cubic polynomial is proposed, which uses an additional amplitude coefficient (weight) *c*_{
3
} form. Like in the case of other two coefficients *c*_{
1
} and *c*_{
2
}, its value is also dynamically calculated for the present robotic fish on the basis of the real fish study report [17]. Undulatory motions defined by the function in two-degree and three-degree NURB equations are written as:

{y}_{\mathit{body}}\left(x,t\right)=\left\{\frac{{c}_{1}x+{c}_{2}{x}^{2}}{\sqrt{{{c}_{1}}^{2}+{{c}_{2}}^{2}}}\right\}sin\left(kx+2\pi f\times t\right)

(10)

{y}_{\mathit{body}}\left(x,t\right)=\left\{\frac{{c}_{1}x+{c}_{2}{x}^{2}+{c}_{3}{x}^{3}}{\sqrt{{{c}_{1}}^{2}+{{c}_{2}}^{2}+{{c}_{3}}^{2}}}\right\}sin\left(kx+2\pi f\times t\right)

(11)

The smooth transition it provides helps preserve momentum, reduce navigation error due to loss in the robot’s drive mechanisms, and allow the robot to maintain its speed throughout its maneuvering. The proposed form (and its derivative) shown in the above equation has the advantage of being both continuous and differentiable at all points in the interval across all segments. The second derivative is also continuous throughout and differentiable across each interval except at ‘via’ points between segments. This form can permit considerable freedom in selecting the robot’s orientation (turning) at via points. It is now computationally easier to calculate velocity, rotational velocity, and acceleration at via points throughout the trajectory, therefore, allowing us to specify maneuvers that can reduce travel time and minimizing navigational errors while conserving the battery power. The mathematical modification is implemented in the form of a transition from the existing uniform no-rational spline equation (Lighthill quadratic and cubic spline wave equations) to the NURB. As discussed earlier, another major implementation issue challenged by this improved model is to test the dynamic undulatory motion of the fish in a three-dimensional plane which may not be well-defined under the existing two-dimensional plane Lighthill linear/quadratic amplitude equations. Its efficacy in the control performance remains to be verified in the future work. But based on its properties [25] and results obtained in the present research, it is validated that the equation causes sudden rise around the initial conditions (*jerk* at start point) as shown in Figure 5b, if control points do not have a specific arrangement. Except for the two (quadratic and cubic) Bezier splines, other waveforms reveal smooth curvature indicating an undisturbed oscillatory/undulatory. This effect causes unwanted offset distance of desired control points from the actual trajectory points.

#### Undulatory SINC and DIRIC body waves

The mathematical function called cardinal sine or sinc oscillates between positive and negative values with equal periodic repetition represents a sine wave that decays in amplitude as *1/x*. This oscillation represents a decrease in amplitude with an increasing frequency. This also depicts that the mean value at a point *x* → 0 will have a higher magnitude when compared to neighborhood of *∂x → 0+*, *∂x → 0-* as well as for other oscillating peaks. The function is continuous at all real values with a removable singularity at *x = 0* (where first derivative is equal to 1). Figure 6a shows two unnormalized (blue) and normalized (red) mathematical expressions. The normalization causes the definite integral of the function over the real numbers equal to 1. It is a building block for a large function class in Fourier analysis (a major technique in the solution of differential equations). It is also seen to be a solution to the wave equations for transmission in communication theory. Physical meaning can be interpreted as a traveling wave signal propagated through body leading edge to the trailing edge for a sharp or gradual turning action. If we look into the traveling wave envelope proposed by Lighthill, sinc function suits into it such that it moves down the fish body with velocity *c*, and whose amplitude *c*_{1}*x* + *c*_{2}*x*^{2} may vary with position along the fish body. The proposed undulating motion in Lighthill frame is given as:

{y}_{\mathit{body}}\left(x,t\right)=\left[\left({c}_{1}x+{c}_{2}{x}^{2}\right)\right]\left\{\frac{sin\left(kx+2\pi f\times t\right)}{2\pi f\times t}\right\}

(12)

An extension to the sinc function, in the form of a Dirichlet function is defined in the Lighthill frame. This function is found to be a periodic sinc or aliased sinc function.

{y}_{\mathit{body}}\left(x,t\right)=f\left(x\right)\times h\left(t-\frac{x}{c}\right)

(13)

Where

h\left(x,t\right)=\left\{\frac{sin\phantom{\rule{0.5em}{0ex}}N\left(kx+2\pi f\times t\right)}{\mathit{Nsin}\left(2\pi f\times t\right)}\right\}\text{.}

(14)

For *N* as odd, the function has a period of 2; for *N* as even, its period is 4. It can be used to add orientation to the tail beat of the caudal region as the traveling wave (midline) switches the amplitude mean value depending on the value of *N*. It is verified in its discrete Fourier transform for an *N*-point rectangular window as shown in Figure 6b. The centerline mathematical equation of motion in Lighthill frame is given by:

{y}_{\mathit{body}}\left(x,t\right)=\frac{1}{\left({c}_{1}x+{c}_{2}{x}^{2}\right)}\left\{\frac{sin\left(kx+2\pi f\times t\right)}{sin\left(2\pi f\times t\right)}\right\}

(15)

It can be noted that the quadratic wave amplitude is in the denominator and is used to dampen the oscillating wave function unlike the sinc function where it is allowed to grow as the numerator.

#### Undulatory anguilliform body wave (EEL like/maneuvering model)

Replicating the kinematics of a silver lamprey, a MPF anguilliform motion was proposed by Tytell [26]. From the maneuvering perspective, this equation adds another dimension to the overall fish propulsion. The motion of the fish centerline described by an exponentially growing traveling wave in Lighthill frame is given by a function as follows:

{y}_{\mathit{body}}\left(x,t\right)=\left[\left({c}_{1}x+{c}_{2}{x}^{2}\right)exp\left(2.18\left(\raisebox{1ex}{$x$}\!\left/ \!\raisebox{-1ex}{$L$}\right.-1\right)\right.\right]

(16)

where *y* is the lateral position of the midline, *x* is the coordinate following the midline, *α* is the amplitude growth rate parameter [26], *L* is the body length, and *λ* is the propulsive wave length. Modifications were done in this equation as compared to the original equation due to the fact that the present robotic fish model is carangiform so the DOF is restricted to the body posterior (caudal) unlike anguilliform where the entire centerline participates in undulation.

The idea of testing a modified anguilliform equation in a carangiform frame is whether maneuverability can be improved in slow undulatory motion. Two changes have been accommodated in order to undertake this test. Firstly, by replacing the constant amplitude by a quadratic amplitude wave and secondly, by provisioning that *α* can act as both an amplitude growth and dampening factor. This mathematical expression shows that a main wave function (sine or cosine) is decomposed in two Fourier functions. The primary function is again an oscillating sine wave which is multiplied by an exponentially growing function (can be represented in Fourier series) to satisfy the boundary conditions. The continuous everywhere exponential function is used for damping the sine wave. This function also resembles the Laplace transform with open unity integral.