Welcome to DOGZILLA-Lite repository
11. Teaching demonstration online
Teaching online
This tutorial is specific to the CM5 version and will not work directly with the CM4 version.
Teaching online1. Experimental Objective2. Experimental Procedure3. Experimental Results4. Experimental Source Code AnalysisNotes:
1. Experimental Objective
Learn to manually control the robotic arm of a single robot dog, thereby enabling control of multiple robot arms.
2. Experimental Procedure
Log in to the robot dog's system, exit the robot dog program, and enter "ip (where ip is the robot dog's IP address):8888 in your browser. Once logged in, enter the password "yahboom."

Then log in. Go to cd ~/DOGZILLA_Lite_class/3.Dog Base Control/11.Teaching online and run Teching_UDP.ipynb.
3. Experimental Results
- After running the source code, a mode selection window will appear, and the screen will display "Teaching Class!!!"

- Next, select a mode. There are two modes: Master and Slave. In Master mode, you can manually control the angle of the robot's arm, so that the slave's arm can rotate to the master's position.

Master mode selection page:

Slave mode selection page

- Master mode: Only one robot dog is required. All robot dogs that wish to be controlled by the master mode can be selected as slaves.
4. Experimental Source Code Analysis
xxxxxxxxxxdef host_mode(): """主机模式 Host mode""" time.sleep(1) dog.unload_motor(5) while True: # 显示界面 display interface draw.rectangle((0, 0, mydisplay.height, mydisplay.width), fill="BLACK") draw.text((20, 80), "Host Mode Running", fill="CYAN", font=font1) draw.text((20, 120), "B:Force Exit", fill="WHITE", font=font1) mydisplay.ShowImage(splash) # 业务逻辑 business logic motor_data = dog.read_motor() print(type(motor_data)) if motor_data: send_arm_angles(motor_data[-3:]) # 按钮检测 Button detection if check_exit_buttons(): break time.sleep(0.1)def client_mode(): """从机模式 slave mode""" dog.load_allmotor() while True: # display interface draw.rectangle((0, 0, mydisplay.height, mydisplay.width), fill="BLACK") draw.text((20, 80), "Client Mode Running", fill="CYAN", font=font1) draw.text((20, 120), "B:Force Exit", fill="WHITE", font=font1) mydisplay.ShowImage(splash) # Business logic (non blocking) angles, status = receive_arm_angles() if status == "success": dog.motor([51, 52, 53], angles) if check_exit_buttons(): break time.sleep(0.1)host_mode(): The main business logic is the host mode control dog.unload_motor(5): Unload the robot arm servo on the robot dog client_mode(): The main business logic is the slave mode control receive_arm_angles(): Receives the slave mode robot arm angles sent by the host mode, and then drives the dog.motor function to control the robot arm to reach the angle
Notes:
- This experiment requires two or more dogs to run properly
- To exit this experiment, it is best to use the button in the lower left corner of the screen. Other exit methods will cause the slave dog robot arm to be unloaded, causing other robot arm-related routines to run and the robot arm to not move normally.