Physical properties of a snake like robot
This snake is based off of Shiego Hirose’s ACM-III robot(https://ieeexplore.ieee.org/abstract/document/4799450/figures#figures). It utilises physical properties of the snake’s body and the undulatory motion of the body to propel itself forward. In order for propulsion to occur, the contact surface must have differing frictional properties in the tangential and normal direction. It must be able to move smoothly when the body is aligned with the normal direction and resist movement in the tangential direction. This is done in this robot using passive rubber wheels. If there was no difference in friction the robot would stay moving in one place.
Snake movement algorithm
The second factor that allows the snake to move forward is its undulatory motion. Through research of the movement of biological snakes the serpenoid curve was derived by Shiego Hirose. The curve is defined by
where (x(s),y(s)) are coordinates along curve at arc length s from the head of the snake. The a, b and c values are positive scalars that change the shape of the curve. As shown below, by changing a, it can change the amplitude of the curve. B changes the period and c allows for the curve to turn a specific direction.
Figure 1: Various serpenoid curves [1]
Although Hirose’s serpenoid curve is useful for visualising the curves on a graph it, it is more useful to have the angles between each link when implementing the curve in a robot. Hirose’s serpenoid curve was developed on by Saito et al(https://www.ics.forth.gr/bioloch/internal/papers/snake_robot.pdf). and breaks the continuous equation into angles between n links . For a robot with links the length of 1/n the angles can be expressed as:
The a, b and c values can be used in the same way to change the shape of the serpenoid curve in the robot. The photos below have examples of how the shape of the snake changes depending on the parameters implemented.
Code
Initialising
The A, B and C variables are initialised to be used in the calculations of alpha, beta and gamma previously shown in the segmented serpenoid curve formula.
var M1block;
var M2block;
var speed = 0.1;
var t = 0;
var A = 3;
var B = 2*Math.PI;
var C = 0;
var num_segments = 7;
var gamma = -C/num_segments;
var beta = B/num_segments;
var alpha = A*Math.sin(beta/2);
async function onReload(){
moveNow()
}
The onReload function initialises the two motor drivers connected and calls the moveNow function.
moveNow
let times = 400;
let b = 0;
async function moveNow(){
try{
if(!times--) return;
await ServoWaveGen(M1block,M2block, t, alpha, beta, gamma);
if(go){
t+= speed;
if (t > 2*Math.PI){
t=0;
} else if (t < 0){
t = 2*Math.PI;
}
i++;
}
}catch(e){
}
}
The moveNow function will increment the time variable t over one sinusoidal period and reset it once it has completed a cycle. By changing the speed variable the snake’s speed will change depending on if it is increased or decreased.
The ServoWaveGen function is called to change the shape of the snake for each time increment.
ServoWaveGen
This function uses the incremented t value, as well as the alpha, gamma and beta previously calculated to calculate the angle between each segment of the snake robot. It saves the angle for each servo into the RCservo array and uses the “SetAngle” API call to send the angle to 8 potential servos.
//Calculate servo positions and send to servos
async function ServoWaveGen(M1block, M2block, t, alpha, beta, gamma){
var RCservo = [90,90,90,90,90,90,90,90];
var ratio = 1;
var offset = 90;
var i = 0;
while (i<8){
RCservo[i]=Math.floor((alpha*Math.sin(t - i*beta)*180/Math.PI + gamma)*ratio)+offset;
i++;
}
console.log("POS : "+RCservo + " time" +t);
try{
Kitsi.APICall('SetAngle', [[RCservo[0], RCservo[1], RCservo[2], RCservo[3]]], M1block);
Kitsi.APICall('SetAngle', [[RCservo[4], RCservo[5], RCservo[6], RCservo[7]]], M2block);
}catch(e){
console.log("%j", e);
}
setTimeout(moveNow, 20);
}
Check out the logic maker version HERE
Improvements
-Redesign chassis to be fully 3d printed and use smaller Servo motors
-Create steerable snake robot by using C value of snake movement algorithm.
[1] M. Saito et al. (2002). Modelling, analysis, and synthesis of serpentine locomotion with a multilink robotic snake. Available from https://www.ics.forth.gr/bioloch/internal/papers/snake_robot.pdf.