Introduction
The project demonstrates how to make the crawling motion with Quadruped using individual servo control.
There are four positions of the robot we are going to make to create the crawling motion:
- Position 1
quad.moveall([60,120,0,180,60,120,180,0],Speed)
- Position 2
quad.moveall([30,150,60,120,60,120,120,60],Speed)
- Position 3
quad.moveall([120,60,60,120,120,60,120,60],Speed)
- Position 4
quad.moveall([120,60,0,180,150,30,180,0],Speed)
Code
sprite = Sprite('Tobi')
quarky = Quarky()
quad=Quadruped(4,1,8,5,3,2,7,6)
Speed = 250
while True:
quad.moveall([60,120,0,180,60,120,180,0],Speed)
quad.moveall([30,150,60,120,60,120,120,60],Speed)
quad.moveall([120,60,60,120,120,60,120,60],Speed)
quad.moveall([120,60,0,180,150,30,180,0],Speed)
Logic
- The “Quad” instance represents the quadruped robot and is initialized with several parameters that specify the location of each of its four legs.
- The “moveall” method takes a list of eight angles as its input, with each angle representing the angle of a joint in one of the quadruped’s legs.
- The method then uses these angles to calculate the position of each leg and moves them accordingly.
- The variable “Speed” is used to specify the speed at which the quadruped should move during each step of the loop.
Output