Non-Blocking Control - ADEEPT AWR Wheeled Robot Manual

4wd smart robot kit compatible with raspberry pi 4 3 model b+ b, opencv target tracking
Table of Contents

Advertisement

66

10.3 Non-blocking Control

●You can find the RPIservo.py file in the server folder of the robot product, copy it to the same folder as
the program you want to run, and then you can use this method in your program.
import
RPIservo
# Import a library that uses multiple threads to control the steering gear
import
time
sc = RPIservo.ServoCtrl()
sc.start()
# Start this thread, when the servo does not move, the thread is suspended
while
1:
sc.singleServo(3, -1,
time.sleep(1)
sc.stopWiggle()
sc.singleServo(3, 1,
time.sleep(1)
sc.stopWiggle()
●The above code can be used to control the servo to reciprocate, except for time.sleep (), it will not block
the running of the context program.
●Call singleServo () to start the movement of the servo, call stopWiggle () to stop the movement of the
servo, where singleServo ()Three parameters are required, which are the port number of the servo to be
controlled (3 is to control the No. 3 servo connected to Motor HAT), the movement direction of the servo (1 or
-1), and the movement speed of the servo (the greater the value, the greater The sooner).
# Instantiate the object that controls the steering gear
2)
2)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AWR Adeept Wheeled Robot and is the answer not in the manual?

This manual is also suitable for:

Picar-b

Table of Contents

Save PDF