Snake Robot
Snake Robot
ROBOT
A PROJECT REPORT
Submitted by
MASTER OF TECHNOLOGY
in
MECHANICAL ENGINEERING
of
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
I would like to express my deepest gratitude to my guide, Dr. I.Infanta Mary Priya ,
for her valuable guidance, consistent encouragement, personal caring, timely help and
providing me with an excellent atmosphere for doing research. All through the work,
in spite of her busy schedule, she has extended cheerful and cordial support to me for
completing this work.
I would also like to thank Mrs. REKHA , without who I could not have completed
this project within the limited time frame. I would like to thank my reviewers Dr. S.
PRABHU and Dr. A. VIJAYA for reviewing through the whole project session. I
would like to express my sincere thanks to SRM Institute of Science and Technology in
providing the facilities to execute our vision.
I would like to thank Dr. M. CHERALATHAN, Head of the Department of Mechan-
ical Engineering and DR. D. KINGSLY JEBA SINGH, the Dean of Department of
Mechanical Engineering for leading the path for me and many more of us. They’ve
been the torch bearers in guiding the department to excellence.
I would like to use this opportunity to thank the teaching and non-teaching faculty of
the department of Mechanical Engineering for the support and guidance they have pro-
vided through the course of this project.
I would also like to thank my parents for the support that they’ve provided me all
through these years and believing in me all these years.
Author
iv
TABLE OF CONTENTS
ABSTRACT iii
ACKNOWLEDGEMENTS iv
ABBREVIATIONS ix
LIST OF SYMBOLS x
1 INTRODUCTION 1
1.1 Snake Robots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Biological Snakes . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 Locomotion in a snake . . . . . . . . . . . . . . . . . . . . 1
2 LITERATURE SURVEY 5
2.1 Mathematical Modelling of Snake-like Robots . . . . . . . . . . . . 5
2.1.1 Planar Motion Sideslip Constraints . . . . . . . . . . . . . 5
2.1.2 Planar Motion Friction Constraints . . . . . . . . . . . . . 6
v
4.3.1 SDF Definition . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3.2 Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3.3 Code compilation . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.4 Geometric Design of Snake-lke Robot . . . . . . . . . . . . 14
4.3.5 Actuator Sequence for Forward Kinematics . . . . . . . . . 14
4.3.6 Gait Clustering . . . . . . . . . . . . . . . . . . . . . . . . 15
5 CAD Modelling 18
5.1 Motor Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 Design Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 Analysis 22
7 Fabrication 24
7.1 Slicing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.2 Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9 Results 31
9.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.2 Real World Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.2.1 Lateral Undulation . . . . . . . . . . . . . . . . . . . . . . 33
9.2.2 Side Winding . . . . . . . . . . . . . . . . . . . . . . . . . 34
10 Conclusion 35
A CODING 36
LIST OF TABLES
vii
LIST OF FIGURES
viii
ABBREVIATIONS
GS Gazebo Sim
CM Centre of mass
ix
LIST OF SYMBOLS
A Addition matrix
D Difference matrix
sgn(.) Produces a vector containing the sign of individual arguments
diag(.) Diagonal matrix with individual elements of the argument along it’s diagonal
sin(.) Sine function of the argument
cos(.) Cosine function of the argument
Ik Identity matrix of size K x K
O( ixj) Zero matrix of the size ixj
N Number of links
l Half length of individual link
m Mass of individual link
J Moment of inertia of each link
θi Angle between link j and global x axis
ϕi Angle of joint j
(xi , yi ) Global co-ordinates of center of mass of link i
(Px , Py ) Global co-ordinates of center of mass of the robot
θi Link angle, for jth link
ϕi Joint angle, for jth link
V̄t Tangential Velocity
θ̄ Heading of the snake robot, defined as the average of the link angles
x
CHAPTER 1
INTRODUCTION
Snake-like robot are redundant manipulators, with high degrees of freedom, intended to
mimic a natural snake in gait. Roused by the advantages of organic serpent motion in
complex and unstructured environments, these robots meet the increasing necessity for
automated versatility in conditions that are obscure, unstructured and difficult environ-
ments and conditions. These instruments commonly comprise many adjacent revolute
or prismatic joints that are capable of bending in at least one plane(Trebuňa et al., 2016).
The high amount of levels of degrees of freedom of snake-like bots is hard to control
properly, but has good movement abilities in chaotic and sporadic conditions which can
outperform any other types of robots in these kind of environments.(Hu et al., 2009)
(Liljebäck et al., 2012)
Snakes are reptiles of the suborder "Serpentes", who are limbless and have an elon-
gated body structure. The absence of limbs doesn’t obstruct the locomotion of snakes.
They have fostered a few distinct methods of slithering to manage specific conditions.
Dissimilar to the strides of legged creatures, which posses a pattern, every method of
movement is discrete and particular in snakes than others; changes can abruptly happen.
They are practically exceptional among the land animals since they lack legs. Nonethe-
less, this doesn’t seem to hinder them on the capacity to move around. Unexpectedly,
gait of snakes are steady, strong, and flexible. Generally,the speed of snakes in motion
are, notwithstanding, generally sluggish, albeit some have been recorded to move at 11
km/h.There are also snakes with very specific types of motion. For example, some have
been recorded to stand as tall as a metre by creating a coiled-s shape using their body
and then jump by pushing their body . Some snakes have even developed the ability to
float through air by manipulating their body for more drag as they jump of trees. In the
following section, we look at 4 types of commonly found gait in snakes. (Jayne, 1986)
Lateral Undulation
The lateral undulation is one of the most common movement types known for ground
snakes. In this mode, the snake manipulates the body to create sine like waves trav-
elling through the body which can push against the objects in the environment, like
rocks, sticks, dirt in the ground, and so on. Every one of these ecological items, thusly,
produces a response power propelling the snake with the median being near the mid
of snake. The velocity that a snake can acquire in this case is thus directly related to
the amount of force that acts on the ground.This locomotion is depicted below in the
figure1.1.
Side-winding
Mostly found in colubridae snakes which dwell in environment that requires different
techniques to propel itself(like desert conditions where lateral undulation will make the
snake be pushed into the sand). Sidewinding is a modified version of natural lateral
undulation where specific of the segments arranged in one course to keep in touch with
2
the ground, while different sections are pulled up, coming about as an unconventional
"rolling" motion which could be identified as 2 sine waves, perpendicular to each other.
This technique helps to overcome the loose and unpacked structure of environments like
sand or mud by pushing with some segments of the body, while lifting and placing some
forward .This gait method is also very energy efficient that it consumes only about half
the calories that a reptile consumes to move the same distance. Although some have
attributed the sidewinding nature of desert snakes to sand being hot, there is no solid
evidences for these. This locomotion is depicted below in the figure1.2.
Concertina Locomotion
The Concertina motion is used by snakes when there are no points in the environment
that it can use as push points and due to lack of space available laterally for the sidewind-
ing or lateral undulation. In this, the snake harbours specific segments of the body in the
tunnel sidewalls and then either push or pull the rest segments, and then vice-versa to
create a creeping motion. Although this mode of locomotion is slow and more energy
consuming(due to all the amount of motions that does not contribute to gait, but only
to stabilise the snake), the ability to traverse even very tight spaces for food and such,
makes it worth the expenditure. This significant expense is because of utilizing dynamic
strong work to support against the passage dividers. This locomotion is depicted below
in the figure1.3.
3
Figure 1.3: Concertina Locomotion
Rectilinear(Straight) Locomotion
This is one of the slowest forms of gait found in snakes that doesn’t require the snake
to use lateral motion unless to turn. In this method, the belly scales are lifted and pulled
forward and anchored in the environment and then pulling with it while some other
segments will be pushing forward. These stretching and contraction creates a wave like
pattern in the belly scales which then push the snakes forward. Mainly scene in large
and heavy snakes, these types of locomotion doesn’t require the ribs of the snake from
bending or moving. This locomotion is depicted below in the figure1.4.
4
CHAPTER 2
LITERATURE SURVEY
The domain of snake robots have been widely researched upon from the initial intro-
duction of snake robot, about 50 years ago. (HIROSE, 1993). Although the earlier ones
used passive wheels for creating resistance to mimic frictional anisotropy, the newer
models have advanced from mere 2D to 3D models that can autonomously move in an
environment.
Each segment in the body of a snake that’s undergoing lateral undulation follows the
path etched out by the head. The frictional anisotropy that are foud in such cases are due
to snake skin that contain scales, as shown in (Hu et al., 2009), but at the same time is
brought about by anomalies on a superficial level that give hold and empower the snake
topush itself forward without just slipping towards the sides. To emulate this move-
ment, slideslip constraints was introduced, which creates a model with the assumption
that the body is restricted from moving sideways. We use the idea of a body velocity
integral, which can be used to approximate the displacement of the snake robot which
can also be used to find the velocity of the snake-like bot, was introduced by (Hatton
and Choset, 2009).
Obstacle-aided locomotion was an idea that used obstacles present in the environment
as push points to helo the locomotion of the robot which was first presented in (Transeth
et al., 2008). (Liljebäck et al., 2012) studied a model of snake-like bots, that are com-
plex, for motion considereing only in 2D plane , which takes ideas from the previously
mentioned literatures to create a mathematical model.
2.1.2 Planar Motion Friction Constraints
Although most models of snake robots consider sideslip constraint, many of the mod-
els do not use such a constraint, but enforces the assumptions that the links in contact
with the ground shows an anisotropy in friction with respect to ground , similar to an
actual snake, i.e,the frictional coefficient for the link in tangential and normal directions
will be different. (Liljebäck et al., 2012) uses the mathematical model using anisotropic
friction to model the snake robot’s locomotion in a complex environment. (Branyan and
Menğüç, 2018) depicts the use of compliant materials to alter the anisotropic frictional
coefficients between surfaces and studied the relation with velocity and torque require-
ments. (Serrano et al., 2015) studied the relation between the scales and the resulting
frictional anisotropy that it created and found that higher the number of scales, more
the velocity achieved due to higher frictional coefficient.
6
CHAPTER 3
Mathematical model for planar locomotion of snake robots was developed by (Liljebäck
et al., 2012) which was in turn developed from (Saito et al., 2002). The following model
uses the same approach as in these previous works, but is novel due to the cordinate
methods used, which helps us in splitting the model based on actuated and unactuated
parts.
We assume that, the width of the link has negligible contribution to the friction. We
assume that all links have similar properties, are of equal size and has the same mass of
m. Each link would be considered as having a cylindrical shape, which implies that
1
J= ml2 (3.1)
3
We also assume that the mass distribution of each link is uniform and thus they have a
center of mass in the exact middle point of the link.
3.2 Kinematics of Snake-like Robot
N
1 X
θ̄heading = θj (3.2)
N j=1
The rotation matrix for transformations from global frame to frames of the respective
links are given by,
cosθj −sinθj
Rglobal
linkj =
(3.3)
sinθj cosθj
P̄ denotes the Centre of mass (CM) of the snake robot in the global axis and it is given
by the equation
PN
1 t
Pxx j=1 mxj 1 e Xx
P̄ = = N m P = (3.4)
Pyy 1 N N et Yy
Nm j=1 myj
8
The Forward velocity,(which is the velocity at which the snakebot moves forwards)
V̄tangential of the snake-like bot is give by the component of velocity (Ṗ denotes deriva-
tive ) thorough the present heading of the snakebot θ̄.
The term tangential refers to the fact that at any given point in the serpendoid curve, to
calculate the velocity, we consider it tangentially.
For a serpendoid curve, as per (Liljebäck et al., 2012) we have two Holonomic con-
straints that governs the relations between linkj and link( j + 1). These constraints can
mathematically be represented as:
Combining equations 3.4,3.8 and 3.9, we can obtain the position of each link as a
function of the link angles and the postion of the Center of mass.
9
−lAm cos θ
Tm Xx = (3.10)
Pxx
−lAm sin θ
Tm Yy = (3.11)
Pyy
where,
Dm
Tm = (3.12)
1 T
N
e
Solving the equations (3.10) and (3.13) for Xx and Yy values , we get;
−lAm cos θ
Xx = T−1
m
= −lKTm cos θ + epxx (3.14)
Pxx
−lAm sin θ
Yy = T−1
m
= −lKTm sin θ + epyy (3.15)
Pyy
where,
10
Differentiating the equations (3.14) and (3.15), with respect to time, we get linear ve-
locities of the links.
Upon manually expanding the matrices and inspecting the individual rows of (3.17) and
(3.18), we get that the linear velocities at each individual link can be given by;
11
CHAPTER 4
4.2 Gazebosim
4.3 Methodology
We use SDF in GS to represent objects that are static and external plugins are used
to simulate the movement. The simulation of snake robot was done by modelling a
solid cuboid, which was then connected using Revolute joints which are actuated as per
desired successions to obtain a serpendoid curve like actuation.
A SDF is an eXtensible Markup Language (XML) file that is used by robotic simulators
to describe static objects and environments. An individual model file will have all the
attributes for a robot or any object that may be part of the environment. It should have
both the model.config and model.sdf files that are stored in the same directory.
We have defined all the solid cubes as links, with it’s own properties that describes the
interaction between the object and the environment.
4.3.2 Plugin
Plug-ins are code snippets that are compiled together which may be used to define
specific properties, actuations or other features in the program. The six types of ways
plug ins are used in GS are: World, model, Sensor, System, Visual and GUI, which
when compiled together with the model, simulates the robot based on the constraints
and properties applied.
13
4.3.3 Code compilation
Once the SDF and plugins are developed, they needs to be compiled together with the
program, so as to integrate it with the simulation. For this, we build a directory in Linux
and after the execution of the compilation,a library is formed which includes all of the
files.
Once this is done, we can load the program and GS parses the SDF file and the simula-
tion initiates.
The dotted lines represent the center axis and the green arrow indicates the possible
motion for the revolute joints between the two links.
The figure 4.2 shows the modes that are possible for actuation between the links.We
consider +2 to represent powered actuation in to the maximum angle possible in the left
14
direction and -2 to represent the same for right direction. We consider +1 for the half
of max angle in the left direction and -1 for the same in right direction. The detailed
representation of the actuation is shown in the table 4.1.
This is the process of actuation of multiple adjacent joints with a same angle, cluster-
ing them together, so as to form the shape of the required curve, instead of making
steep angles using less joints, which may increase the resistance from the ground. The
following tables (4.2) and(4.3) shows the configurations used and actuation sequences
corresponding to it. We have proposed two gaits, one propagating from the first to last
link and the other from last link to first link.
15
Table 4.2: Wave propogation from link 1-21
Actuation Forces
For the simulation, we set the actuation forces acting at the joints to be +10N and -10N.
We switch the forces between these values with a time interval of 200ms.
16
Figure 4.3: Actuation Forces
17
CHAPTER 5
CAD MODELLING
Before commencing the design process, we started with selection of the motor. The
specific requirements that were required are:
• Torque : The motor should have high holding torque that can in turn hold the
weight of the snake during a side-winding cycle.
• Dual-Shafted: Since there will be actuation on the both sides of the links, there
will be forces acting on the both sides. So as to eliminate these, we select a dual
shaft servo that has output on both sides.
• Light weight : Since we are using multiple segments of these motors, we need
them to be light weight.
• Compact : The more compact and small the motor is, the better will be the
controllability and flexibility of the snake robot.
Based on these, we selected the RKI 1206 dual shaft servo motor, with the follow-
ing specifications:
Table 5.1: RKI 1206 Dual shaft servo motor specification
Once the simulations were done, based on the results and literature referred, we came
to the conclusion to go with a cylindrical structure which closely mimics the structure
of a real snake while providing with adequate amount of ground contact points.
The motor selection was done based on the necessity for balancing forces when the the
snake moves on the ground and thus a dual shaft servo was selected. Based on these
factors, the design was done in SolidWorks CAD software. The 5.1 shows the CAD
design for the links that will be used to join the dual shaft motors in series with each
other. The assembled snake robot can be found in the 5.2. The link lengths have been
significantly reduced and all interference were accounted for in the design.
Once the CAD model was finished, it was converted into an STL file so as to be
analysed for the forces that are acting on it in a regular basis. Since the 3D printing of
the part would be very complex, we came up with a split flange design which is then
glued together once the process is over.
These are then analysed for their structural integrity using ANSYS. Once the analysis
is done and the design is optimized, we continue towards the fabrication part.
19
(a) Link (top view)
20
Figure 5.2: Assembly Model of snake robot
21
CHAPTER 6
ANALYSIS
Once the design of the snake robot was done, it was imperative that we do structural
analysis on the links of the snake robot which will have multiple forces acting on it
at the same time while in locomotion. The drawings were initially converted to STL
format after which they were imported into ANSYS Workbench and the analysis was
done in it.
The process for the structural analysis would be as following:
• Meshing: This is the process of cnverting the geometry into finite elements of
very small size, for the Finite Element Analysis(FEA).
• Modal:This is the process of confining the fixed points in the snake robot links
and then supplying them with the forces that are acting on them along with the
directions of forces.
• Post-processing: This is the process of specifying the necessary outputs and tak-
ing the results and interpreting them from the results.
Once the process is done, we obtain the results. The results for the analysis was
done and they were noted down. The results can be seen in the following images. The
6.1(a) shows the total deformation that acts upon the links when 1.5 times the maximum
force that can act on an individual link. The 6.1(b) shows the maximum stress that is
present in the link. The 6.1(c) denotes the maximum possible stress that can act on the
link while it is being in the lateral undulation and side-winding motion that might cause
high amount of sudden impacts on the structure.
(a) Total deformation
23
CHAPTER 7
FABRICATION
Once the analysis of the links were done, we went ahead to fabricate the robot. The
preferred choice was to use Rapid Prototyping due to complexity in the structure and
the ease. The CAD model of the link was split in half so that the complexity of print
was reduced, which in turn means reduced print times, reduced support material usage
and lesser chances of print failures. We used a Creality ender 3 pro 3D printer and Poly
Lactic Acid(PLA) filament of 2mm diameter. The extruder nozzle size was selected
to be 0.4mm for a very fine print so that, the surface of the robot is not rugged. The
specification of the print are mentioned in 7.1.
Specification Value
3D printer Creality Ender 3
Material Poly Lactic Acid(PLA)
Extruder nozzle size 0.4mm
Extruder nozzle temperature 200°C
Bed temperature 60°C
Infill 30%
The material PLA was selected due to it’s strength to weight ratio and it’s ability to
withstand the higher temperatures and forces that can act on it. A slower print speed
was selected so that the layer adhesion was better which in term implies better strength.
The infill percentage was selected at 30% so that the weight remains comparatively less
while the strength remains high.
7.1 Slicing
Once the parameters were selected, we proceed to slice( the process of converting the
STL cad file to G-codes that the 3d printer can work on. This was done using a free
software called Ultimaker Cura, which takes the STL file as input and then supplies the
G-codes that are required for the 3D printer to work.
(a) Input to Slicer
25
7.2 Printing
Once the process of slicing was done, the G-codes were supplied to the 3D printer via
an SD card, after which we commence the printing process. The speed of the process
was selected to be 20 mm/sec so that the print layers provide higher amount of adhesion
and thus gives higher strength. The 7.2 shows the finished links.
Once the printing was done, the individual segments were cleaned up and was aligned
together and glued together using a cyano-acrylate based glue, for stronger adhesion.
Then, the links were attached with the motors and then , wires were routed to the head
link, which contains the arduino mega controller. The wiring was done and the coding
was done accordingly. The 7.3 shows the assembled snake robot.
26
(a) Top view
27
CHAPTER 8
8.1 Controller
Once the robot fabrication was done, the coding part was initiated and the suitable
controller was selected. We selected an Arduino Mega 2560 as the controller for the
snake robot which is paired with a sensor sheild, which let’s us use multiple servo
motors in the Arduino along with a Bluetooth HC-05 module.
A 12v lithium ion battery was used to supply the power to the sensor shield and the
Bluetooth sensor. The coding that was used in the programming has been added to the
Appendix.
8.2 Algorithm
The snake robot is controlled directly by a pilot using the Arduino Bluetooth controller
app that has been installed in an Android smartphone. The app allows us to give spe-
cific commands to the snake robot via a bluetooth connection that is connected to the
Arduino via serial port. The Smartphone app has multiple buttons as shown in 8.2 that
can be reconfigured as per the needs of the user.
The signal flow of the entire process has been shown in the 8.3.
The code in the arduino mega decides on the PWM signal to be supplied to the dual
29
shaft servo motors based on the input received from the command from the smartphone
app.The snake robot mainly has 4 variables that can be user controlled. They are:
• Direction: This is the general direction command that has been given to the robot
on which direction to move.
• Frequency : This variable decides the no of sine waves that can be superimposed
on the snake
30
CHAPTER 9
RESULTS
9.1 Simulation
Once the simulation was run, the positions of links at each interval was noted and com-
pared between them. The figures (9.1)and(9.2) illustrate the gait of a simulated snake-
like robot in different propagation patterns.As is evident from the simulation, the motion
pattern in both cases are opposite to each other.
32
9.2 Real World Test
The real world testing of the snake robot was done using the code as shown in Appendix.
The control of different variables using the app was demonstrated and recorded. All the
3 types of locomotion was performed using control of the amplitudes and direction.
Lateral undulation of the snake robot was obtained by using a sine-wave on the alter-
nating motors. Lateral undulation was achieved by the articulation of alternative motors
by means of excitation using a simple sinusoidal wave. The amplitude and frequency
of the sine-wave are user controllable, which means better controllability and flexibility
for the robot. Higher amount of resistance was seen in the sinus area. The locomotion
was found to be best suitable in cases like hard ground or other such surfaces.
33
9.2.2 Side Winding
The side winding motion was achieved by superimposing another sine-wave along with
the horizontal sine-wave. The ability to manipulate the amplitude of this wave means
that we can control the side-winding angles and distances travelled in each stride. This
is best suited for loosely packed environments like sand or gravel which can obstruct
during a normal lateral undulation motion.
34
CHAPTER 10
CONCLUSION
In conclusion, we were able to simulate and confirm the wave propagation and the
serpendoid curve motion of the redundant manipulator(snake robot) using GS. The
mathematical model was also obtained relating the links angles and velocities for the
snake robot.
There needs to be further analysis and simulations to be done to improve the current
models and to refine them. The introduction of ventral scales and anisotropy in friction
also needs to be studied.
In total, the simulations showed how the complex motion of a snake can be mimicked
using a series wave propagation in a redundant manipulator, without any need of feed-
back mechanisms.
The three different types of motion was demonstrated in the snake robot. The use of
a user controllable amplitude for the motion helps in maneuvering difficult and uncer-
tain environments. The simulated and real world results have variations in them, mostly
due to the difference in friction. There needs to be further analysis and simulations to be
done to improve the current models and to refine them. In total, the complex motion of
a snake can be mimicked using a series wave propagation in a redundant manipulator,
without any need of feedback mechanisms The same speed as the simulation was not
achieved in the real world testing, the reasons for which could be:
• Frictional coefficient
CODING
include <Servo.h>
String data ;
Servo s1;
Servo s2;
Servo s3;
Servo s4;
Servo s5;
Servo s6;
Servo s7;
Servo s8;
Servo s9;
Servo s10;
Servo s11;
Servo s12;
int counter = 0;
float lag = .5712;
int f = 1; /f is the frequency of the sine wave
int amplitude = 40;
int amp_side = 40;
int offset = 0;
int delayTime = .5;
int startPause = 5000;
float pi=3.14159;
int prev_counter=1;
int rightOffset = 5;
int leftOffset = -5;
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
// horizontal motors
s1.attach(23);
s3.attach(3);
s5.attach(5);
s7.attach(7);
s9.attach(9);
s11.attach(11);
// vertical motors
s2.attach(2);
s4.attach(4);
s6.attach(6);
s8.attach(8);
s10.attach(24);
s12.attach(12);
s1.write(90+offset+amplitude*cos(6*lag));
s3.write(90+offset+amplitude*cos(4*lag));
s5.write(90+amplitude*cos(2*lag));
s7.write(90+amplitude*cos(-1*lag));
s9.write(90+amplitude*cos(-3*lag));
s11.write(90+amplitude*cos(-5*lag));
delay(startPause);
}
void loop()
37
{
while(Serial3.available() > 0)
{Serial.println("CONNECTED");
data = Serial3.readString();
Serial.print(data);
Serial.print("");
while(data=="forward")
{
}
prev_counter =counter;
while(Serial3.available() > 0) // Send data only when you receive data:
{
data = Serial3.readString();
38
}
}
}
while(data =="right")
{
Serial.println("right turn");
39
s7.write(90+rightOffset+amplitude*cos(f*counter*pi/180+2*lag));
s8.write(90+rightOffset+amp_side*cos(f*counter*pi/180+2*lag));
s9.write(90+rightOffset+amplitude*cos(f*counter*pi/180+1*lag));
s10.write(90+rightOffset+amp_side*cos(f*counter*pi/180+1*lag));
s11.write(90+rightOffset+amplitude*cos(f*counter*pi/180+0*lag));
s12.write(90+rightOffset+amp_side*cos(f*counter*pi/180+0*lag));
}
// Ramp down turn offset
for(counter = 350; counter < 360; counter += 1)
{
delay(5);
s1.write(90+offset+.1*(360-counter)*rightOffset+amplitude*cos(counter*pi/180+5*lag));
s2.write(90+offset+.1*(360-counter)*rightOffset+amp_side*cos(counter*pi/180+5*lag));
s3.write(90+offset+.1*(360-counter)*rightOffset+amplitude*cos(counter*pi/180+4*lag));
s4.write(90+offset+.1*(360-counter)*rightOffset+amp_side*cos(counter*pi/180+4*lag));
s5.write(90+offset+.1*(360-counter)*rightOffset+amplitude*cos(counter*pi/180+3*lag));
s6.write(90+offset+.1*(360-counter)*rightOffset+amp_side*cos(counter*pi/180+3*lag));
s7.write(90+.1*(360-counter)*rightOffset+amplitude*cos(f*counter*pi/180+2*lag));
s8.write(90+.1*(360-counter)*rightOffset+amp_side*cos(f*counter*pi/180+2*lag));
s9.write(90+.1*(360-counter)*rightOffset+amplitude*cos(f*counter*pi/180+1*lag));
s10.write(90+.1*(360-counter)*rightOffset+amp_side*cos(f*counter*pi/180+1*lag));
s11.write(90+.1*(360-counter)*rightOffset+amplitude*cos(f*counter*pi/180+0*lag));
s12.write(90+.1*(360-counter)*rightOffset+amp_side*cos(f*counter*pi/180+0*lag));
Serial.println("going right");
}
prev_counter=counter;
while(Serial3.available() > 0) // Send data only when you receive data:
{
data = Serial3.readString();
Serial.println(data);
}
}
40
//turning left
while(data=="left")
{
for(counter = 0; counter < 10; counter += 1)
{
delay(5);
s1.write(90+offset+.1*counter*leftOffset+amplitude*cos(counter*pi/180+5*lag));
s2.write(90+offset+.1*counter*leftOffset+amp_side*cos(counter*pi/180+5*lag));
s3.write(90+offset+.1*counter*leftOffset+amplitude*cos(counter*pi/180+4*lag));
s4.write(90+offset+.1*counter*leftOffset+amp_side*cos(counter*pi/180+4*lag));
s5.write(90+offset+.1*counter*leftOffset+amplitude*cos(counter*pi/180+3*lag));
s6.write(90+offset+.1*counter*leftOffset+amp_side*cos(counter*pi/180+3*lag));
s7.write(90+.1*counter*leftOffset+amplitude*cos(counter*pi/180+2*lag));
s8.write(90+.1*counter*leftOffset+amp_side*cos(f*counter*pi/180+2*lag));
s9.write(90+.1*counter*leftOffset+amplitude*cos(f*counter*pi/180+1*lag));
s10.write(90+.1*counter*leftOffset+amp_side*cos(f*counter*pi/180+1*lag));
s11.write(90+.1*counter*leftOffset+amplitude*cos(f*counter*pi/180+0*lag));
s12.write(90+.1*counter*leftOffset+amp_side*cos(f*counter*pi/180+0*lag));
}
// Continue left turn
for(counter = 11; counter < 350; counter += 1)
{
delay(5);
s1.write(90+offset+leftOffset+amplitude*cos(f*counter*pi/180+5*lag));
s2.write(90+offset+leftOffset+amp_side*cos(f*counter*pi/180+5*lag));
s3.write(90+offset+leftOffset+amplitude*cos(f*counter*pi/180+4*lag));
s4.write(90+offset+leftOffset+amp_side*cos(f*counter*pi/180+4*lag));
s5.write(90+offset+leftOffset+amplitude*cos(f*counter*pi/180+3*lag));
41
s6.write(90+offset+leftOffset+amp_side*cos(f*counter*pi/180+3*lag));
s7.write(90+leftOffset+amplitude*cos(f*counter*pi/180+2*lag));
s8.write(90+leftOffset+amp_side*cos(f*counter*pi/180+2*lag));
s9.write(90+leftOffset+amplitude*cos(f*counter*pi/180+1*lag));
s10.write(90+leftOffset+amp_side*cos(f*counter*pi/180+1*lag));
s11.write(90+leftOffset+amplitude*cos(f*counter*pi/180+0*lag));
s12.write(90+leftOffset+amp_side*cos(f*counter*pi/180+0*lag));
}
// Ramp down turn offset
for(counter = 350; counter < 360; counter += 1)
{
delay(5);
s1.write(90+offset+.1*(360-counter)*leftOffset+amplitude*cos(counter*pi/180+5*lag));
s2.write(90+offset+.1*(360-counter)*leftOffset+amp_side*cos(counter*pi/180+5*lag));
s3.write(90+offset+.1*(360-counter)*leftOffset+amplitude*cos(counter*pi/180+4*lag));
s4.write(90+offset+.1*(360-counter)*leftOffset+amp_side*cos(counter*pi/180+4*lag));
s5.write(90+offset+.1*(360-counter)*leftOffset+amplitude*cos(counter*pi/180+3*lag));
s6.write(90+offset+.1*(360-counter)*leftOffset+amp_side*cos(counter*pi/180+3*lag));
s7.write(90+.1*(360-counter)*leftOffset+amplitude*cos(f*counter*pi/180+2*lag));
s8.write(90+.1*(360-counter)*leftOffset+amp_side*cos(f*counter*pi/180+2*lag));
s9.write(90+.1*(360-counter)*leftOffset+amplitude*cos(f*counter*pi/180+1*lag));
s10.write(90+.1*(360-counter)*leftOffset+amp_side*cos(f*counter*pi/180+1*lag));
s11.write(90+.1*(360-counter)*leftOffset+amplitude*cos(f*counter*pi/180+0*lag));
s12.write(90+.1*(360-counter)*leftOffset+amp_side*cos(f*counter*pi/180+0*lag));
Serial.println("going left");
}
prev_counter=counter;
while(Serial3.available() > 0) // Send data only when you receive data:
{
data = Serial3.readString();
Serial.println(data);
}
42
}
while(data =="reverse")
{
for(counter = 360; counter > 0; counter -= 1)
{
delay(5);
s1.write(90+amplitude*cos(f*counter*pi/180+2*lag));
s2.write(90+amp_side*cos(f*counter*pi/180+2*lag));
s3.write(90+amplitude*cos(f*counter*pi/180+1*lag));
s4.write(90+amp_side*cos(f*counter*pi/180+1*lag));
s5.write(90+amplitude*cos(f*counter*pi/180+0*lag));
s6.write(90+amp_side*cos(f*counter*pi/180+0*lag));
s7.write(90+amplitude*cos(f*counter*pi/180-1*lag));
s8.write(90+amp_side*cos(f*counter*pi/180-1*lag));
s9.write(90+amplitude*cos(f*counter*pi/180-2*lag));
s10.write(90+amp_side*cos(f*counter*pi/180-2*lag));
s11.write(90+amplitude*cos(f*counter*pi/180-3*lag));
s12.write(90+amp_side*cos(f*counter*pi/180-3*lag));
Serial.println("going back");
}
while(Serial3.available() > 0) // Send data only when you receive data:
{
data = Serial3.readString();
}
}}
43
REFERENCES
1. Branyan, C. and Menğüç, Y. (2018). “Soft snake robots: Investigating the effects of gait
parameters on locomotion in complex terrains.” 2018 IEEE/RSJ International Confer-
ence on Intelligent Robots and Systems (IROS). 1–9.
4. Hu, D. L., Nirody, J., Scott, T., and Shelley, M. J. (2009). “The mechanics of slithering
locomotion.” Proceedings of the National Academy of Sciences, 106(25), 10081–10085.
6. Liljebäck, P., Pettersen, K., Stavdahl, , and Gravdahl, J. (2012). “A review on mod-
elling, implementation, and control of snake robots.” Robotics and Autonomous Sys-
tems, 60(1), 29–40.
7. Saito, M., Fukaya, M., Iwasaki, T., et al. (2002). “Modeling, analysis, and synthesis of
serpentine locomotion with a multilink robotic snake.” IEEE control systems magazine,
22(1), 64–81.
8. Serrano, M. M., Chang, A. H., Zhang, G., and Vela, P. A. (2015). “Incorporating
frictional anisotropy in the design of a robotic snake through the exploitation of scales.”
2015 IEEE International Conference on Robotics and Automation (ICRA). 3729–3734.
9. Transeth, A. A., Leine, R. I., Glocker, C., Pettersen, K. Y., and Liljebäck, P. (2008).
“Snake robot obstacle-aided locomotion: Modeling, simulations, and experiments.”
IEEE Transactions on Robotics, 24(1), 88–104.
10. Trebuňa, F., Virgala, I., Pástor, M., Lipták, T., and Miková, L. (2016). “An inspection
of pipe by snake robot.” International Journal of Advanced Robotic Systems, 13(5),
1729881416663668.
44