Description
In the robot, there are several communication chains. Motors in the chain are connected in series via RS485. If we want the program to control a specific motor, we need to change the corresponding motor ID; otherwise, the program won't know which motor should move (since all motors come from the factory with ID=0, they cannot be distinguished when all motors have the same ID).
Motor Preparation
Reference documentation: https://support.unitree.com/home/zh/Motor_SDK_Dev_Guide/line_connection
We need to remove the relevant motor joints; otherwise, when you debug, they might suddenly move and exceed the joint limits of the 3D printed parts, which is very dangerous!!!!
We need to connect a single motor to the computer for setup. There should be no connection between motors.
The relevant diagram is as follows:
The tools in the diagram can all be purchased from the Unitree Official Flagship Store: Jump Link
After the motor is powered on, the light flashing indicates readiness. Once ready, you can proceed to the next step...
Motor Debugging Tool
Download Tool
We use the tool provided by Unitree to change motor IDs: Download Link
Open and Select Serial Port
Double-click Unitree Motor Debug Assistant.exe to open the software, select and connect the serial port. Use the dropdown to select the serial port corresponding to the USB to 485 module.
Start Debugging
Click 【Start Debugging】. The motor debugging assistant will connect to the motor. If the connection is successful, you can see the 【Send Frequency】 values continuously changing.
Motor Control
Next, let's test if the motor rotates properly.
- Enter the correct 【Motor ID】 and 【Control Parameters】 in the right input box. The host computer will immediately send control instructions to the motor for motor control.
Control Parameter Meanings:
- Motor ID: The ID of the motor. ID 15 is the broadcast ID, and the motor will not respond. You can query or modify the motor ID using the 【Motor Debugging Assistant】.
- Motor Mode: 0-Stop mode; 1-FOC mode; 2-Calibration mode (Note: After sending calibration mode, do not send data to the motor within 5 seconds. Therefore, after using this tool to input mode 2, immediately click to disconnect the serial port). Click to learn about motor modes
- Motor Rotor Actual Output Torque (Nm) =
Rotor Torque (Nm) + (Rotor Target Speed (rad/s) - Rotor Current Speed (rad/s)) / Speed Kw + (Rotor Target Position (rad) - Rotor Current Position (rad)) * Position Kp - Communication Frequency: The number of instructions the debugging tool sends to the communication bus per second
Select the serial port (here it is COM17, please select based on your actual situation), click connect, enter Motor ID (here it is 0, please enter based on your actual situation), enter Motor Mode 1 (FOC mode), enter Rotor Torque 0.08Nm, and you can see the motor outputting 0.08Nm of torque, causing the rotor to continuously accelerate. Enter Rotor Torque 0Nm, and the motor gradually decelerates and stops.
Then, click the 【Enable Auto Guide】 button, then click the 【Restore Motor Mode】 button. When the motor light changes to slow flashing, it can be used normally.
Motor ID Query
If you don't know the current motor ID, you can query it through the host computer's 【Query ID】:
You can try multiple times.
Special Note: After querying the motor ID, you cannot debug directly. Please follow the instructions, click the 【Enable Auto Guide】 button, then click the 【Restore Motor Mode】 button. When the motor light changes to slow flashing, it can be used normally.
Special Note: After querying the motor ID, you cannot debug directly. Please follow the instructions, click the 【Enable Auto Guide】 button, then click the 【Restore Motor Mode】 button. When the motor light changes to slow flashing, it can be used normally.
Special Note: After querying the motor ID, you cannot debug directly. Please follow the instructions, click the 【Enable Auto Guide】 button, then click the 【Restore Motor Mode】 button. When the motor light changes to slow flashing, it can be used normally.
Changing Motor ID
For example: To modify the ID to 5, enter 5 in the input box, then click the 【Modify ID】 button and wait for the prompt to return the result.
Note: You must query the ID before modifying it!
You can modify the motor IDs according to the diagram in the 【Description】 chapter.