Petoi Doc Center
🇺🇸English
🇺🇸English
  • Welcome to Petoi Doc Center
  • Getting Started Guide
  • 🙋‍♂️FAQ(Frequently Asked Questions)
  • Petoi robot joint index
    • Joint Pins on NyBoard
      • Nybble
      • Bittle
    • Joint Pins on BiBoard V0
      • Bittle X
      • Bittle X+Arm
    • Joint Pins on BiBoard V1
      • Bittle X
      • Bittle X+Arm
      • Nybble Q
  • Bluetooth Connection
    • BiBoard
    • NyBoard
  • Upload Firmware
    • NyBoard
    • BiBoard V0
    • BiBoard V1
  • Joint Calibration
  • Infrared Remote
    • Remote Controller
  • Mobile App
    • Introduction
    • Calibrator
      • Nybble
      • Bittle
    • Controller
  • Desktop APP
    • Introduction
    • Firmware Uploader
      • NyBoard
      • BiBoard V0
      • BiBoard V1
    • Joint Calibrator
      • NyBoard Preparation
      • BiBoard Preparation
      • Nybble
      • Bittle / Bittle X
        • Bittle (NyBoard)
        • Bittle X (BiBoard V0)
        • Bittle X (BiBoard V1)
      • Bittle X+Arm
        • BiBoard V1
        • BiBoard V0
    • Skill Composer
      • NyBoard Connection
      • BiBoard Connection
      • Interface
        • Nybble
        • Bittle / Bittle X
        • Bittle X+Arm
    • Tools
  • Block-based programming
    • Petoi Coding Blocks
      • NyBoard Preparation
      • BiBoard Preparation
    • Block-based Coding Curriculum - Learn Quadruped Robotics for Beginners
    • Python coding mode in Mind+
    • Generic Arduino Uno Blocks
    • Install Mind+ on Chromebook
  • Arduino IDE
    • Upload Sketch for NyBoard
    • Upload Sketch for BiBoard
    • Calibrate the joints with Arduino IDE
    • Serial Monitor
    • C++ Curriculum: Learn Quadruped Robotics for Beginners
    • Install Arduino IDE on Chromebook
  • Free Curriculum
    • 📚Download
  • APIs
    • 🖇️Serial Protocol
      • Feedback servos
      • Nested task queue and signal generator
    • 🐍Python API
    • 🐛8266 MicroPython controller
      • Run MicroPython on ESP8266
      • Setup WebREPL
      • Using the ESP-NOW protocol
    • 🦎8266 Arduino C Controller
    • ©️C++ API
    • 🍓Raspberry Pi serial port as an interface
      • For BiBoard V1
    • 💻Set up Development Environment on Chromebook
    • 🤖ROS
  • Nyboard
    • Overview
    • NyBoard V1_0
    • NyBoard V1_1 & NyBoard V1_2
  • BIBOARD
    • BiBoard V0 Guide
    • BiBoard Extension Hat
    • Demo Applications
      • 1.GPIO port
      • 2.Serial port
      • 3.Analog-digital converter
      • 4.Digital-Analog Converter
      • 5.EEPROM (Electrically Erasable Programmable read only memory)
      • 6.Gyro IMU(MPU6050)
      • 7.Infrared remote control
      • 8.PWM(Pulse Width Modulation)
      • 9.Servo(under construction)
      • 10.Classic Bluetooth serial port SPP
      • 11.Bluetooth low energy (BLE) serial port pass-through
      • 12.File system SPIFFS
      • 13.Add hardware partition configuration option in Arduino IDE
      • 14.Play MP3
      • 15.The usage of Wi-Fi OTA(Over-The-Air)
    • BiBoard V1 Guide
  • Communication Modules
    • Introduction (For NyBoard)
    • USB Uploader (CH340C or CH343G)
    • Dual Mode Bluetooth
    • WiFi module ESP8266
      • ESP8266 + Python Scripts Implement wireless crowd control
  • Extensible Modules
    • Introduction
    • MU Camera
    • Ultrasonic Sensor
    • Light Sensor
    • Touch Sensor
    • Gesture Sensor
    • PIR Motion Sensor
    • IR Distance Sensor
    • Voice Command Module
    • Petoi AI Vision Module
    • Advanced development and application of AI vision modules
      • Model Training
      • Model quantification
      • Model deployment
      • Training on the COCO DIY dataset
    • Robot Arm
      • Upgrade your older Bittle/Bittle X for the robotics arm gripper
    • 🎮Joystick with Micro:Bit
  • Applications
    • Melody Creation
    • Skill Creation
    • OpenCat Imitation Tutorial
    • Programmable Puppet Character
    • Tutorial for simulating Bittle In Isaac Sim
  • History
    • Upload Sketch For NyBoard (software 1.0)
  • Technical Support
    • 💾Supporting Application and Software
    • 🔧Burn Bootloader for NyBoard
    • 🛠️Useful Tools
    • 🔋Battery
  • Useful Links 🕸
    • 🔭Home of Petoi Robots
    • 🛒Shop Coding Robots
    • 💿GitHub of OpenCat
    • 🎪PetoiCamp (Forum)
    • 📽️Petoi Robot Videos
    • 📬Users' repositories
Powered by GitBook
On this page
  • Prepare Mind+
  • Watch the video tutorials
  • Prepare Petoi Robot
  • Import Petoi Mind+ extension library
  • Programming and Running
  • The principle and process
  • The instructions for blocks
  • Open the serial port
  • Deactivate Gyro
  • Perform inherent skills
  • Perform the last skill exported from the Skill Composer
  • Perform the skill in the file
  • Rotate joints in a sequence.
  • Rotate joints simultaneously
  • Get the current angle value of a joint.
  • Transform to frame
  • Play a melody
  • Execute a serial command
  • Write analog value
  • Read analog value
  • Write digital value
  • Read digital value
  • Read Ultrasonic sensor distance
  • Close the serial port
  • Demos
  • Free curricular

Was this helpful?

Export as PDF
  1. Block-based programming

Petoi Coding Blocks

How to use the extension library specially developed for the Petoi robot in Mind+

PreviousToolsNextNyBoard Preparation

Last updated 2 months ago

Was this helpful?

Prepare Mind+

  • Download the latest version from the

    • Windows: >= V1.7.0

    • Mac: version: >= V1.7.3 RC2.0

If you cannot download the software from Mind+'s official website, you can download a stable version from . However, we strongly recommend that you download and use the official latest version.

  • After the installation is complete, you can open Mind+

If the default installation language is Chinese, you can switch to English as follows:

Watch the video tutorials

We provide on using Petoi Coding Blocks with . Be sure to click next to go through all the videos.

Prepare Petoi Robot

Please follow the instructions in the subpages to prepare according to the robot's mainboard.

Import Petoi Mind+ extension library

Programming and Running

Petoi Coding Blocks is a user-extended library of Mind+.

If you open Mind+ by double-clicking the code file(suffix mp or sb3) that uses this extension library or load these code files after opening Mind+, Mind+ will automatically load this extension library.

The principle and process

This extension library can control the robot without compiling and uploading the code to the robot's main board. Click the "Run" button directly to run the program on the Python level and send instructions to the robot's serial port. If you need to stop the program while running, you can click the "Stop" button anytime. The process of the program can be divided into three steps:

  1. Open the serial port

  2. Control the robot

  3. Close the serial port

The instructions for blocks

Open the serial port

There are two ways to open the serial port:

If it fails to open the serial port, you can refer to the printed information in the terminal window to replace the name of the serial port:

Deactivate Gyro

When the gyroscope function is turned on, the robot can balance its body in real-time. It may be seen that when the robot is doing preset actions (especially when performing more violent actions), the body will shake back and forth, and even the body will tip over. The robot will automatically perform recovery actions, which may disrupt your preset steps.

If the uploaded sketch is Mind+ mode sketch(#define GROVE_SERIAL_PASS_THROUGH this line is activated), the gyroscope function will be turned off, and the robot will not be able to balance or auto-recover, so there is no need to add this block.

Perform inherent skills

Use this block to let the robot perform skills pre-built on the robot's main board. Skills from "sit" to "zero" are postures (containing only one action frame). Skills from "boxing" to "sniff" are behaviors (containing multiple posture frames and are performed only once). Skills from "stepping" to "trotRight" are gaits (containing multiple posture frames, and are repeated in periodical loops until stopped).

After finishing the current block's task, the program will wait a short time (delay xx seconds) before moving to the next block.

Perform the last skill exported from the Skill Composer

Perform the skill in the file

Use this block to let the robot perform the skill in the skill files, which are in the following directory:

  • Windows: C:\Users\{your user name}\.config\Petoi\SkillLibrary\{model}

  • MacOS : /Users/{your user name}/.config/Petoi/SkillLibrary/{model}

  • Linux: /home/{your user name}/.config/Petoi/SkillLibrary/{model}

The folder .config is a hidden directory on MacOS/Linux but can be visited in the terminal or through a specific view setting:

  • MacOS open the directory /Users/{username} in Finder, then press the “Command” + “Shift” + “.” (period) keys at the same time.

Rotate joints in a sequence.

Use this block to control one joint or multiple joints to rotate in sequence. There are several ways to use the blocks for reference:

  • Controls individual joint rotations to an absolute angle value.

  • Controls individual joint rotations to a relative angle value.

  • Control multiple joints to rotate sequentially to absolute angle values or relative angle values.

  • Use the joint angle list to control multiple joints to rotate to absolute angle values in a sequence.

Rotate joints simultaneously

Using this block can control multiple joints to rotate at the same time. There are several ways to use the blocks for reference:

  • Control multiple joints to rotate to absolute angle values or relative angle values at the same time

  • Use the joint angle list to control the simultaneous rotation of multiple joints to absolute angle values.

Get the current angle value of a joint.

Use this block to get the current angle value of the selected joint. It is recommended to assign it to a variable first and then use the variable and algorithm to control other joints to rotate.

The return value of this block is only an angle value, which cannot be filled in the "Turn sequentially" and "'Turn simultaneously" blocks alone.

Demo code:

Transform to frame

Use this block to control all joints to rotate at the same time. Please use it with the "Action frame" block. As shown below:

Play a melody

Use this block to control the robot to play music. There are several ways to use blocks together for reference:

  • A list made up of multiple "Tone + Duration" blocks

  • Using a tone duration list

Consists of one or more pairs of Tone + Duration, the specific format is as follows:

[tone, duration, tone, duration, tone, duration...]

Execute a serial command

Write analog value

Use this block to write an analog value to a specified pin. Analog value range: 0~255

Read analog value

Use this block to read an analog value from a specified pin.

Write digital value

Use this block to write a high/low-level value to the specified pin. High-level: 1; Low-level: 0.

Read digital value

Use this block to read the high/low-level value of the specified pin.

Read Ultrasonic sensor distance

Use this block to read the distance value from the ultrasonic sensor.

  • NyBoard (connects to the D6 and D7 pins)

  • BiBoard (connects to the Rx and Tx pins)

For other ultrasonic sensor models (e.g., HC-SR04 connects to the D6 and D7 pins), you can set the two pins like this:

Close the serial port

Generally, at the end of the program, it is recommended to use this block to close the serial port communication.

Demos

We provide some demos to download for reference in the GitHub repository (Petoi_MindPlusLib/examples).

Free curricular

Paste the GitHub URL() in the text box of the import interface:

For macOS (<=V1.7.2 RC3.0), you need to download and copy the extracted folder (PetoiRobot) to /Users/{your username}/Documents/mindplus-py/environment/Python3.6.5-64/lib/python3.6/site-packages/

If you open Mind+ by double-clicking the icon, it will not automatically load this extension library, and you need to re-import it manually every time you open the app.

Automatically identify and open the serial port

Enter the name of the serial port to open the serial port

If the robot is in , you'd better deactivate the Gyro after the serial port-opening block. It deactivates the gyroscope function to prevent the robot from performing balance feedback actions in real-time. For example:

Use this block to let the robot perform the last skill exported from the .

It is equivalent to inputting the serial command 'T' in the and then delaying the preset time.

The folder name {model} is Bittle or Nybble. When a skill file from the Skill Composer, it will automatically save the skill file to this directory.

Tips: you can also copy & paste the folder from the source code of the OpenCat project on GitHub to the .config/Petoi directory. Therefore, you can use some sample skills for your Mind+ program, and there is no need to use the export function in the Skill Composer.

, represents a list consisting of a and an angle value. For example, [Head panning to 30 degrees] represents the list [0, 30].

It consists of one or more pairs of + angle value, and the specific format is as follows: [joint index, angle value, joint index, angle value...]

The "Action frame" block represents a list of 16 angle values. Each angle value corresponds to the absolute angle value to which the corresponding servo rotates.

Use this block to send a serial command to the robot, which can provide you with more and more flexible control methods. For example, you can input "kkcL" (kick the left front leg), and "khiR" (raise the right front leg to say hello). For more serial port commands, please refer to .

For the (or RUS-04), you can set the two pins ( Trigger and Echo) like this:

https://github.com/PetoiCamp/Petoi_MindPlusLib
PetoiRobot.zip
standard mode
Skill Composer
serial monitor
exporting
SkillLibrary
joint index
the serial protocol
Petoi RGB Ultrasonic Sensor
Mind+ official website
the Google Drive folder
a series of video tutorials
the free Scratch-like robotics coding curriculum
joint index
joint index
278KB
DemoEn.mp