add wishlist add wishlist show wishlist add compare add compare show compare preloader icon-theme-126 icon-theme-161 icon-theme-138 icon-theme-027 electro-thumb electro-return-icon electro-brands-icon electro-payment
  • +1 (857) 226-1305
  • +86 18825289328

ROS Robot Control Board Guide - Controlling Multiple Serial Bus Servos

1. Preparation

1.1 Wiring Instructions

This tutorial uses the following hardware: seven LX-824HV high voltage serial bus servos, an ROS robot control board, an 11.1 V lithium battery, and a Type-C data cable. The Type-C data cable is used to connect the board to a computer for program flashing.

This tutorial applies to the full range of Hiwonder serial bus servos, except magnetic encoder motors. For different servo models, use the matching connection cables and a battery with the proper supply voltage for the servo.

The seven servos used in this tutorial have already been assigned IDs 1-7. Before following this tutorial, use a serial bus servo controller and the TTL / USB Debugging Board to set the servo IDs.

If the serial bus servo controller and TTL debugging board are not available, refer to the 1. RRC Bus Servo ID Writing and Source Code Analysis in the following directory: ROS Robot Control Board/3. RosRobot Controller Program Analysis/Lesson 8 RRC Bus Servo Control and Source Code Analysis .

2. Operating Steps

2.1 Modify the Source Code

  1. Find the RosRobotControllerM4_serial_servo_run.rar compressed package in the following path: ROS Robot Control Board/3. RosRobot Controller Program Analysis/Lesson 8 RRC Bus Servo Control and Source Code Analysis/RRC Bus Servo Control Routine. Extract the package to the computer desktop or to a project folder in the root directory of a drive.
  1. After extraction is complete, open the project folder. Follow the path shown below, then click the Keil startup file RosRobotControllerM4.uvprojx to open the project.
  1. After the project opens, find the Hiwonder/System directory in the Project panel on the left side of Keil, then open app.c.
  1. After app.c opens, select the content on lines 32-45, then click the comment button in the Keil toolbar to comment out the selected code, as shown below.
  1. After commenting out the code, add the following code below serial_servo_init(); on line 30:
while(1)
{
// Move servos 1-7 to position 0. Move time: 1000 ms
serial_servo_set_position(&serial_servo_controller , 1 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 2 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 3 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 4 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 5 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 6 , 0 , 1000);
serial_servo_set_position(&serial_servo_controller , 7 , 0 , 1000);
osDelay(1000);
// Move servos 1-7 to position 1000. Move time: 1000 ms
serial_servo_set_position(&serial_servo_controller , 1 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 2 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 3 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 4 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 5 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 6 , 1000 , 1000);
serial_servo_set_position(&serial_servo_controller , 7 , 1000 , 1000);
osDelay(1000);
}

This code is only a basic control example for multiple servos. To use other servo function calls, open the serial_servo.h and serial_servo.c files in the project folder for reference.

  1. After modifying the code, press Ctrl+S to save it. Then click the Compile button shown below. When compilation is complete, the Build Output window at the bottom displays 0 errors, as shown below.

2.2 Flash the Program

  1. After the program has been compiled, open the project folder and search for hex in the search box at the upper right, as shown below.
  1. Copy RosRobotControllerM4.hex to the desktop. Open the ATK-XISP flashing tool, select RosRobotControllerM4.hex, configure the settings as shown below, then click Start Programming to begin flashing. If a serial port error appears after clicking Start Programming, click Start Programming again to start flashing.
Light
Dark