Beetle Navigation
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model demonstrates the navigation techniques of a dung beetle. The beetle reorients itself at the observer's discretion and attempts to reach the other edge of the grid while navigating around obstacles.
HOW IT WORKS
The beetle first must move a certain number of steps, choosing a random angle each time for its next step. After this number of steps, which is set by the observer, the beetle reorients for a certain number of ticks before resetting its orientation and moving the same number of steps at a random angle once again. If the beetle encounters an obstacle, it moves around it by comparing the y-coordinate of the obstacle to its own in order to go either up or down.
HOW TO USE IT
SETUP: Sets up one beetle, one ball of dung, and the background.
GO: Runs the simulation.
STEP-ANGLE: The set of values from which the beetle can choose its random angle of navigation.
NUMBER-STEPS: The number of steps before the beetle reorients itself.
REORIENT-TIMER: The amount of time the beetle spends reorienting.
SHOW-PEN: Traces/does not trace the path of the beetle.
NUMBER-OBSTACLES: Sets the number of obstacles.
SIZE-OBSTACLES: Sets the size of obstacles.
THINGS TO NOTICE
View the Distance vs. Time graph which demonstrates the beetle's distance from its starting point to its current point as time progresses. Notice how changing the step angle and number of steps in between orientations alters this graph. The beetle changes color from black to gray when reorienting to indicate that it is reorienting. Also observe the method by which the beetle navigates around obstacles.
THINGS TO TRY
Change the step angle or number of steps to simulate a rough surface of navigation for the beetle, the amount of time the beetle spends reorienting, or the number and size of obstacles in order to observe changes in the beetle's navigation patterns.
Comments and Questions
breed [ boxes box ] breed [ beetles beetle ] beetles-own [ beetle-home distance-home moving-timer time-reorienting x-position y-position ] to setup clear-all ask patches [ set pcolor green + (random-float 0.8) - 0.4 ] setup-beetle setup-obstacles reset-ticks end to setup-beetle create-beetles 1 [ set shape "bug" set color black set size 3.5 ] ask beetles [ setxy -24 0 facexy 25 0 set moving-timer number-steps set time-reorienting reorient-timer set beetle-home patch-here ifelse show-pen? [ pen-down ] [ pen-up ] ] end to setup-obstacles ask n-of number-obstacles patches with [ distancexy -25 0 > 4 and abs pxcor < (max-pxcor - 5) and abs pycor < (max-pycor - 5) ] [ sprout-boxes 1 [ set shape "circle" set size size-obstacles set color 1.5 ] ] end to go if all? beetles [ xcor >= 24 ] [ stop ] ask beetles [ ifelse moving-timer >= 1 [ move-beetles ] [ reorient ] ] tick end to move-beetles ask beetles [ set heading random-float step-angle + 90 fd 1 set distance-home distance beetle-home set moving-timer moving-timer - 1 if count boxes in-cone (size-obstacles) 180 > 0 [ go-another-direction ] if abs pxcor >= 25 or abs pycor >= 24 [ set heading random 360 bk 1 ] ] end to go-another-direction ask beetles [ let target one-of boxes in-radius size-obstacles set x-position [ xcor ] of target set y-position [ ycor ] of target ifelse step-angle < 90 [ ifelse y-position > ycor [ lt random 45 bk 1 lt random 90 bk 1 ] [ rt random 45 bk 1 rt random 90 bk 1 ] ] [ if x-position < xcor and y-position < ycor [ case-one ] if x-position > xcor and y-position > ycor [ case-one ] if x-position > xcor and y-position < ycor [ case-two ] if x-position < xcor and y-position > ycor [ case-two ] ] ] end to case-one ask beetles [ bk 1 rt random 15 bk 1 ] end to case-two ask beetles [ bk 1 lt random 15 bk 1 ] end to reorient ask beetles [ set shape "rotating bug" set color 3 set heading heading + ( 1 / reorient-timer ) * 360 set time-reorienting time-reorienting - 1 if time-reorienting < 1 [ set heading 90 set shape "bug" set color black set moving-timer number-steps set time-reorienting reorient-timer ] ] end
There are 9 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Beetle Navigation.png | preview | Preview for 'Beetle Navigation' | about 7 years ago, by Jake Hofgard | Download |
This model does not have any ancestors.
This model does not have any descendants.