Moving the Robot Arm
Follow along: Moving the Robot Arm
The program launching process along with parameter settings are all simplified and set up on the Jupyter Notebook Environment.
- Open the 05_01_left_right.ipynb Jupyter Notebook.
- Load Arm_Lib module and register the robot arm as an object.
- Follow and Execute the example codes.
(The Jetson Board used for these examples are => Jetson Nano)
05_01_left_right.ipynb
- Running the cell code.Ctrl + Enter
To control the robot arm from code, don’t forget to shut down the docker container. See here.
Load Arm_Lib module and register the robot arm as an object.
import time
from Arm_Lib import Arm_Device
# Register robot arm object.
Arm = Arm_Device()
time.sleep(.1)
Run the below cell within your jupyter notebook.
# Repeat swinging the robot arm up and down
# Arm range = 0 ~ 180
def main():
# Make all servos in the middle.
Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 500)
time.sleep(1)
while True:
# Move the 3rd and 4th servos up and down.
Arm.Arm_serial_servo_write(3, 0, 1000)
time.sleep(.001)
Arm.Arm_serial_servo_write(4, 180, 1000)
time.sleep(1)
# Move the 1st and 5th servos left and right.
Arm.Arm_serial_servo_write(1, 180, 500)
time.sleep(.001)
Arm.Arm_serial_servo_write(5, 180, 500)
time.sleep(0.51)
Arm.Arm_serial_servo_write(1, 0, 1000)
time.sleep(.001)
Arm.Arm_serial_servo_write(5, 0, 500)
time.sleep(1.1)
# Move servo to initial position.
Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000)
time.sleep(1.5)
try :
main()
except KeyboardInterrupt:
# Move servo to initial position.
Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000)
print(" Program closed! ")
pass
Remove the robot arm object.
del Arm # Remove robot arm object.