EasyManua.ls Logo

SunFounder PiCrawler Kit - Page 76

Default Icon
137 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder PiCrawler Kit
(continued from previous page)
crawler.do_step('stand',speed)
print(crawler.step_list.get('stand'))
sleep(3)
crawler.do_step(new_step,speed)
print(new_step)
sleep(3)
if __name__ == "__main__":
main()
How it works?
In this code, the code you need to pay attention to is this crawler.do_step().
Similar to do_action(), do_step() can also manipulate PiCrawler’s behavior. The difference is that the former
can perform the continuous behavior of move forward, while the latter can be used to make separate gestures of
stand and sit.
It has two uses:
One: It can write strings, directly use the step_list dictionary in the picrawler library.
crawler.do_step('stand',speed)
# "speed" indicates the speed of the step, the range is 0~100.
Second: It can also write an array of 4 coordinate values.
crawler.do_step([[50, 50, -80], [50, 50, -80],[80, 80, 0], [50, 50, -80]],speed)
# These four coordinates are used to control the four legs of right front, left front,
˓ left rear, and left rear respectively.
Each foot has an independent coordinate system. As shown below:
72 Chapter 3. Play with Python

Other manuals for SunFounder PiCrawler Kit

Related product manuals