Welcome to DOFBOT-JetsonNANO repository
6.DOFBOT up down left right
Robotic Arm Up Down Left Right Movement
I. Experimental Approach
This experiment controls the robotic arm to move up, down, left, and right, then return to an upright state. By simultaneously controlling servos 3 and 4 at different angles, the up and down movement function is achieved, then servo 1 is controlled for left and right movement, and finally it returns to the upright state.
II. Start Docker
After entering the main board desktop, open a terminal and run the following command to start the corresponding Dofbot container:
xxxxxxxxxx./Docker_Ros.sh
Then enter the following command in the Docker terminal to start jupyter-lab,
xxxxxxxxxxcdjupyter-lab --allow-root
Then enter the main board's IP address followed by :9999 in the browser,
xxxxxxxxxxIP:9999 // Example: 192.168.1.11:9999
III. Code Content
Code path: /root/Dofbot/3.ctrl_Arm/6.left_right.ipynb
xxxxxxxxxx#!/usr/bin/env python3#coding=utf-8import timefrom Arm_Lib import Arm_Device# Create robotic arm objectArm = Arm_Device()time.sleep(.1)xxxxxxxxxxdef main(): # Reset servos to center position Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 500) time.sleep(1) while True: # Control servos 3 and 4 for up and down movement Arm.Arm_serial_servo_write(3, 0, 1000) time.sleep(.001) Arm.Arm_serial_servo_write(4, 180, 1000) time.sleep(1) # Control servo 1 for left and right movement Arm.Arm_serial_servo_write(1, 180, 500) time.sleep(.5) Arm.Arm_serial_servo_write(1, 0, 1000) time.sleep(1) # Control servos to return to initial position Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000) time.sleep(1.5)try : main()except KeyboardInterrupt: print(" Program closed! ") passxxxxxxxxxxdel Arm # Release the Arm object