Project 3 A Graceful Turn of XGO
Ⅰ. Teaching Aims
Use
XGO turnto control left and right turning and understand positive and negative directions.Use “multiple small angles + waiting” to form any rotation angle.
Reduce your step size before turning to enhance stability.
Complete a 180° U-turn and then resume movement.
Ⅱ. Pre-class Check
XGO + Foxbit + MicroBlocks IDE.
XGO battery power ≥ 60 %.
MicroBlocks status bar shows a green dot, and the development board model is Foxbit.
Test
XGO initandXGO reset pose.Leave at least 40 cm of space around the desktop to prevent drops.
Ⅲ. Key Blocks Analysis
|
|
|---|---|
Value range |
−100 ~ 100 |
Functions |
Set the “Yaw Angle speed per step” and keep it in effect |
Common misuses |
Forget to zero out→ it keeps spinning |
|
|
Value range |
−100 ~ 100 |
Functions |
Forward/backward step size |
Common misuses |
Still take large step size when turning |
|
|
Value range |
≥ 0 ms |
Functions |
Maintain the time of the previous instruction |
Common misuses |
Write 100 as 1000 → an overly large angle |
Direction rule: Turn left when n > 0, turn right when n < 0.
Ⅳ. Test 1: 90° Smooth Left Turn
Complete script:

Click ▶Run, and you will see the dog slows down first and makes a smooth left turn of about 90°, and then it goes straight.
Online code: Click here
Ⅴ. Test 2: 180° Smooth U-turn
Requirements: Walk → Slow down → turn left 90°×2 → Resume walking → Reset.
Sample (Fine-tune the waiting time according to the actual rotational speed):

Bonus point: After the U-turn is completed, display image happy.

Online code: Click here
Ⅵ. Quiz
Why is it prone to rollover if we directly set it
turn 100andwait 400?What is the difference between
XGO turn 0andXGO walk step size 0?How to change “turn n×90°” into a custom Block?
Ⅶ. FAQ
Questions |
Possible causes |
Solutions |
|---|---|---|
There is no rotation |
|
Extend the waiting time |
Keep going around in circles |
Forgot |
Reset immediately after turning |
Slip when turning |
Slippery ground |
Put on an anti-slip mat; |
Large deviation in U-turn |
Single large-angle control |
Change to multiple small-angle cumulative control |


