Jump to content

File:Centipede forward propagation.gif

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Centipede_forward_propagation.gif (320 × 240 pixels, file size: 1.28 MB, MIME type: image/gif, looped, 50 frames, 1.5 s)

Summary

Description
English: Most centipedes and all millipedes, and indeed 4-legged creatures, walk with the rear legs leading the legs in front. In centipedes, this results in waves propagating from back to front. This simulation was created in w:OpenSCAD using a leg motion in which each foot spends half the time on the ground, and the motion of legs in adjacent segments are offset in phase by 45°. Changing the sign of the phase offset results in forward locomotion with the waves propagating from front to back, which is a characteristic of some centipedes such as scolopendra heros.

See also File:Centipede backward propagation.gif.

Date
Source Own work, scaled from the original in my blog article at https://www.nablu.com/2022/12/metachronal-waves-of-legs.html
Author Anachronist

OpenSCAD source code

/*
OpenSCAD code for centiped walking model

To animate in OpenSCAD, go to View -> Animate. In the animation fields,
set FPS to 3 and Steps to a value between 20-50.

The purpose of this script is to visualize the motion of a centipede's
legs in both modes of locomotion: with leg waves propagating from back
to front, and front to back -- with both modes resulting in forward
movement of the centipede.

Each segment of the centipede has a pair of legs that constantly windmill
around. Each successive segment has the phase of the windmilling offset
by 45 degrees from the previous segment. The offset direction is
controlled by the 'phase_direction' parameter. The phase_direction
values 1 or -1 result in forward or backward propagation, respectively.

The legs flex at the knees to look more natural.
*/

// ---------- customizable values ----------

phase_direction = 1;    // Set to 1 (back-to-front waves) or -1

segspacing = 12;    // spacing between segments
nsegs = 21;         // number of segments
leglen = 22;        // leg length at max extension
legr = 2;           // leg radius
legkneeht = 3;      // knee height at max leg extension
legangle = 15;      // overal downward leg tilt angle from body

// ---------- calculated values ----------

bodywid = 1.5*segspacing;           // body segment width
body_elev = leglen*sin(legangle);   // elevation of bottom of body above floor
legseglen = sqrt(leglen*leglen*0.25 + legkneeht*legkneeht); // length of a leg segment (each leg is 2 segments)
xmotion = 1.7*segspacing;           // front-to-back motion of each foot in the x direction
llmin = leglen*cos(asin(0.5*xmotion/leglen));   // minimum leg length when leg is perpendicular to body and foot is on the floor

// --------- render ----------

// $t is set internally by the animation option; initially it is zero.
// It ranges from 0 to 1 in increments determined by Steps, and repeats.

centipede(360*$t);
floor(360*$t);

// ---------- modules ----------

// render the whole centipede
module centipede(phase=0) {
    ns2 = nsegs/2;
    for(i=[0:nsegs-1]) translate([segspacing*(i-ns2),0,0]) bodyseg(phase, phase_direction*i*45);
    translate([segspacing*(-1-ns2),0,0]) head();
}

// single body segment with legs positioned at phase angle 'phase' with phase offset 'offset'
module bodyseg(phase=0, offset=0) {
    bodyblank();
    translate([0,0,body_elev]) color("orange") {
        translate([0,bodywid,legr]) rotate([-legangle,0,0]) leg(phase, offset);
        mirror([0,1,0]) translate([0,bodywid,legr]) rotate([-legangle,0,0]) leg(phase+180, offset);
    }
}

// head includes eyes and antennae, but no legs
module head() {
    bodyblank();
    // eyes
    translate([-bodywid/3,bodywid/2,body_elev+bodywid/3]) color("#00FF00") sphere(r=bodywid/4, $fn=20);
    translate([-bodywid/3,-bodywid/2,body_elev+bodywid/3]) color("#00FF00") sphere(r=bodywid/4, $fn=20);
    // antennae
    rotate([20,0,-45]) translate([0,0,body_elev+1]) color("brown") cylinder(bodywid*1.3, r=legr/2, $fn=8);
    rotate([-20,0,45]) translate([0,0,body_elev+1]) color("brown") cylinder(bodywid*1.3, r=legr/2, $fn=8);
}

// blank body segment, used by bodyseg() and head()
module bodyblank() {
    translate([0,0,body_elev])
        color("gray") scale([0.618,1,1]) {
            cylinder(2*legr, r=bodywid, $fn=24);
            translate([0,0,2*legr]) scale([1,1,0.382]) sphere(r=bodywid, $fn=24);
        }
}

// Model of one leg.
// The 'foot' of the leg follows a straight line backward on the floor, and arches
// over forward in a semicircle. The knee flexes to accommodate moving backward in
// a straight line, with full extension in the forward and back positions.
module leg(phase=0, offset=0) {
    ph = (phase + offset + 3600) % 360;
    if (ph < 180) {
        x = 0.5*xmotion*cos(ph);
        y = 0.5*xmotion*sin(ph);
        zrot = -asin(x/leglen);
        xrot = asin(y/leglen);
        rotate([0,0,zrot]) rotate([xrot,0,0]) ballcylinder([0,0,0], [0,leglen/2,legkneeht], [0,leglen,0]);
    } else {
        x = xmotion * ((ph-180)/180 - 0.5);
        zrot = -asin(x/leglen);
        ll = sqrt(llmin*llmin + x*x);
        kneeht = sqrt(legseglen*legseglen - ll*ll*0.25);
        
        rotate([0,0,zrot]) ballcylinder([0,0,0], [0,ll/2,kneeht], [0,ll,0]);
    }
}

// the leg is two segments with a knee; parameters are coordinates of the root, knee, and foot.
module ballcylinder(p1, p2, p3, r=legr) {
    fn = 10;
    hull() {
        translate(p1) sphere(r=r, $fn=fn);
        translate(p2) sphere(r=r, $fn=fn);
    }
    hull() {
        translate(p2) sphere(r=r, $fn=fn);
        translate(p3) sphere(r=r, $fn=fn);
    }        
}

// moving floor tiles
module floor(phase=0) {
    xp = phase/360 * 2*xmotion;
    for(i=[0:nsegs+6]) let(x=(i-nsegs/2-3)*xmotion)
        for(j=[0:10]) let(y=(j-5)*xmotion, col = (i+j)%2==0 ? "white":"lightblue")
            translate([x+xp,y,0]) color(col) cube([xmotion,xmotion,0.1], center=true);
}

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Simulated centipede animation walking with a posterior propagation gait

Items portrayed in this file

depicts

29 June 2022

image/gif

c9e9bcff3c912650a76f132a3799f21ef7c71de6

1,344,404 byte

1.500000000000001 second

240 pixel

320 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current02:30, 4 July 2022Thumbnail for version as of 02:30, 4 July 2022320 × 240 (1.28 MB)AnachronistUploaded own work with UploadWizard

Global file usage

The following other wikis use this file: