Skip to main content

Case 13: Guard Patrol

Introduction

In this course, students will learn how to program XGO Rider to perform a reciprocating motion similar to a guard. This motion pattern is essential for understanding the path repetition and task automation of the robot. Students will master the programming skills of loop control and conditional judgment through practical operations, thereby improving their application capabilities in the fields of automation and robot programming.

Teaching Objectives

  • Master the programming concepts of loop control and conditional judgment.

  • Learn the programming method to achieve the periodic reciprocating motion of XGO Rider.

  • Enhance students' understanding of robot task automation.

Teaching Preparation

Before starting teaching, please make sure you have prepared the following necessary materials:

micro:bit V2
XGO-Rider
USB Cable
PC

These materials will provide you with a complete experience and ensure that you can smoothly carry out subsequent operations and learning. If you are ready for the above, we can proceed to the next step.

After XGO Rider is turned on, in order to keep the fuselage balanced, it needs to move back and forth slightly. Please do not place XGO Rider on the edge of the table or in a dangerous place to avoid damage.

Teaching process

Course introduction

The guard's patrol back and forth is a typical example of an automated task. In this course, students will learn how to program XGO Rider to simulate this behavior, which can not only deepen students' understanding of robot motion control, but also exercise their ability to realize automated tasks.

Exploration activities

  • How can robots perform repetitive tasks without external instructions?
  • How to implement XGO Rider's back-and-forth motion through programming?
  • What strategies can be used to optimize the robot's patrol path?

Start Programming

Add XGO Rider Software Library

1. Go to "makecode.microbit.org" and click New Project.

2. Enter the project name in the pop-up window and click Create.

3. Click Extension in the code drawer, enter XGO Rider in the search box on the pop-up interface and click the search icon. Click it after the XGO Rider software library is displayed.

Sample Program

Reference Program Link: https://makecode.microbit.org/_RW2KcM7R65t3

Because XGO Rider has forward and backward movement in the performance mode, please place XGO Rider on a spacious flat ground.

Download Program

1. Use a USB cable to connect PC and micro:bit V2.

2. After the connection is successful, a drive letter named MICROBIT will be recognized on the computer.

3. Click in the lower left corner and select Connect Device.

4. Click

5. Click

6. Select BBC micro:bit CMSIS-DAP in the pop-up window, and then select Connect. At this point, our micro:bit has been successfully connected.

7. Click Download program.

Teamwork and Presentation

  • Students will be divided into groups to practice programming and explore the implementation methods of back-and-forth motion.
  • Students are encouraged to share their solutions and programming experiences.
  • Each group of students will have the opportunity to present their XGO Rider back-and-forth motion results.

Expected Results:

Summary and Reflection

  • Summarize the knowledge and skills that students have learned in this course.

  • Discuss the problems encountered in programming practice and their solutions.

  • Think about how to improve the program to improve the efficiency of task automation.

Expand Knowledge

In the field of automation and robotics, the repeatability and predictability of tasks are the key to automation. Through this course, students will learn how to use programming technology to control robots to perform repetitive tasks, which is of great significance for future applications in smart homes, security monitoring and other fields. In addition, students will also learn how to optimize the behavior of robots through programming to adapt to different environments and task requirements.