Welcome to MicroROS Self-balancing Car repository
0.Quick Start (Must Read)
MicroROS Balance Car: Quick Start
MicroROS Balance Car: Quick Start1. Burn ESP32 communication board firmware2. Burn STM32 control board firmware3. APP Bluetooth remote control1. BalanceBot2. Bluetooth remote controlBluetooth connectionDirection control4. VMware installation and use1. VMware installationVMware Workstation Pro2. VMware usage5. Configure ESP32 communication board1. Parameter introduction2. Configuration parameters3. Start/connect the agentStart the agentConnect to the agent4. TestView ROS nodesKeyboard control of the carVI. View the camera screen (optional)1. Hardware connection2. Connection agent3. TestView ROS nodesView the camera screenImage correction
This tutorial is just a simplified version, mainly with a quick start video!
xxxxxxxxxxFor detailed tutorial steps, please see the [Pre-development Preparation] tutorial!Software location involved in the quick start:Factory firmware: Source code summaryVirtual machine: Virtual machine system
1. Burn ESP32 communication board firmware
Note: For users who have just received the product, the ESP32 communication board does not need to be burned with factory firmware
xxxxxxxxxxOur products will be burned with firmware before leaving the factory. If the firmware has not been modified, there is no need to burn it. If the firmware has been modified, you can refer to the next tutorial to burn the factory firmware.
2. Burn STM32 control board firmware
Note: For users who have just received the product, the ESP32 communication board does not need to be burned with factory firmware
xxxxxxxxxxOur products will be burned with firmware before leaving the factory. If the firmware has not been modified, there is no need to burn it. If the firmware has been modified, you can refer to the next tutorial to burn the factory firmware.
3. APP Bluetooth remote control
1. BalanceBot
Use the mobile browser to scan the QR code to download the BalanceBot APP (only supports Android)

2. Bluetooth remote control
Before Bluetooth remote control, we need to install the BalanceBot APP.
Bluetooth connection
When you open the Bluetooth remote control APP for the first time, it will automatically search and connect to nearby Bluetooth devices. We need to bring the phone close to the car, and the Bluetooth remote control APP will automatically connect to the Esp32 expansion board; if the connection is successful, a "Connection successful" prompt will appear.
If no search is found, you can click the Bluetooth search and connection options in turn.
Note: The mobile phone needs to turn on Bluetooth and positioning functions and allow the Bluetooth remote control APP related permissions.
Direction control
The main control interface can control the movement of the balance car through buttons, gravity and joysticks.
(Only the selected functions are available, and other functions of the interface require additional installation of the Bluetooth module)

Bluetooth module: If the Bluetooth module and Esp32 Bluetooth exist at the same time, if you want to connect the Bluetooth module, you can turn off the power of ESP32, wait for the app to connect, and then power the Esp32 board.
If you want to connect to the Bluetooth of ESP32, you need to unplug the Bluetooth module, otherwise you can only connect to the Bluetooth of ESP32 with probability
4. VMware installation and use
1. VMware installation
VMware Workstation Pro
Customers need to use the following link to register an account and download the virtual machine (refer to the manual for detailed steps), or directly use the virtual machine compressed package in the attachment to decompress and use.
For non-commercial use only
xxxxxxxxxxhttps://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Workstation%20Pro
2. VMware usage
You need to download and decompress the virtual machine image provided in our materials in advance, open it and enter the virtual machine.
5. Configure ESP32 communication board
1. Parameter introduction
Edit the config_Balance_Car.py file according to your own configuration
xxxxxxxxxxif __name__ == '__main__':robot = MicroROS_Robot(port='/dev/ttyUSB0', debug=False)print("Rebooting Device, Please wait.")robot.reboot_device()
robot.set_wifi_config("Yahboom2", "yahboom890729")robot.set_udp_config([192, 168, 2, 108], 8899)robot.set_car_type(robot.CAR_TYPE_COMPUTER)#robot.set_car_type(robot.CAR_TYPE_UASRT_CAR)
robot.set_ros_domain_id(20)robot.set_ros_serial_baudrate(921600)robot.set_ros_namespace("")set_wifi_config: Configure the network information connected to the ESP32 communication board
set_udp_config: Virtual machine IP address (displayed at the top of the virtual machine terminal or viewed using ifconfig)
set_car_type: Set the car type (currently only the virtual machine version)
set_ros_serial_baudrate: Set the baud rate of ROS serial communication
set_ros_namespace: Set the name of the multi-machine communication car
2. Configuration parameters
Put the microROS balance car in a balanced position and turn it on. After balancing, connect the Type-C data cable to the ESP32 communication board on the upper layer of the car and choose to connect to the virtual machine (the CP210X driver must be installed on the computer in advance).
Short press the reset button of the ESP32 communication board (reset within 5 seconds is in the configuration state), enter the following command to configure the robot, if the data returned by the terminal is consistent with your settings, it means that the configuration parameters are successful!
xxxxxxxxxxsudo python3 ~/config_Balance_Car.py
After successful configuration, you can unplug the data cable connecting the virtual machine and the ESP32 communication board, turn the car off and on, or press the reset button of the ESP32 expansion board!

3. Start/connect the agent
Start the agent
Use the virtual machine provided in our materials and run the following command:
xxxxxxxxxxsh ~/start_agent_computer.sh

Connect to the agent
Turn on the power switch and the car will automatically connect to the agent.

4. Test
View ROS nodes
Reopen a terminal and enter the following command:
xxxxxxxxxxros2 node list

Keyboard control of the car
Enter the following command in the terminal and keep the mouse on the terminal: Control the car according to the key functions in the table!
xxxxxxxxxxros2 run yahboomcar_ctrl yahboom_keyboard
The keyboard keys are as follows,
Direction control
| 【i】 or 【I】 | 【linear, 0】 | 【u】 or 【U】 | 【linear, angular】 |
|---|---|---|---|
| 【,】 | 【-linear, 0】 | 【o】 or 【O】 | 【linear, - angular】 |
| 【j】 or 【J】 | 【0, angular】 | 【m】 or 【M】 | 【- linear, - angular】 |
| 【l】 or 【L】 | 【0, - angular】 | 【.】 | 【- linear, angular】 |
Speed control
| Key | Speed change | Key | Speed change |
|---|---|---|---|
| 【q】 | Increase both linear and angular speed by 10% | 【z】 | Linear and angular speeds both decrease by 10% |
| 【w】 | Linear speed only increases by 10% | 【x】 | Linear speed only decreases by 10% |
| 【e】 | Angular speed only increases by 10% | 【c】 | Angular speed only decreases by 10% |
| 【t】 | Linear speed X-axis/Y-axis direction switch | 【s】 | Stop keyboard control |
Note: Since the car is a two-wheeled balancing structure and cannot move sideways, the 【t】 key is meaningless.
VI. View the camera screen (optional)
1. Hardware connection
The image transmission module should be connected to the STM32 control board, as shown in the figure.

2. Connection agent
After all the hardware is connected, while configuring the ESP32 communication board parameters, the wifi and ip agents connected to the ROS-WIFI image transmission module will be directly configured.
Use the virtual machine provided in our materials and run the following command:
xxxxxxxxxxsh ~/start_Camera_computer.sh

3. Test
View ROS nodes
Reopen a terminal and enter the following command:
xxxxxxxxxxros2 node list

View the camera screen
Open the terminal of the factory virtual machine system and enter
xxxxxxxxxxros2 run yahboom_esp32_camera sub_img

Image correction
If the camera is upside down, open a new terminal and enter
xxxxxxxxxxpython3 ~/SET_Camera.py
Then enter the IP address connected to the ROS-wifi image transmission module, and you can check it in the terminal connected to the ROS-wifi image transmission module agent

Enter the IP in the terminal according to the IP found, and then press Enter

The picture is restored
