Design of a Distributed Control System Using a Personal Computer and Micro Control Units for Humanoid Robots 1

Problem statement: Humanoid robots have many motors and sensors and many control methods are used to carry out complicated tasks of the robots. Therefore, efficient control systems are required for the robots. Approach: This study presented a distributed control system using a Personal Computer (PC) and Micro Control Units (MCUs) for humanoid robots. Distributed control systems have the advantages that parallel processing using multiple computers is possible and cables in the system can be short. For the control of the humanoid robots, required functions of the control system were discussed. Based on the discussion, the hardware of the system including a PC and MCUs was proposed. The system was designed to carry out the process of the robot control efficiently. The system can be expanded easily by increasing the number of MCU boards. The software of the system for feedback control of the motors and the communication between the computers was proposed. Flexible switching of motor control methods can be achieved easily. Results: Experiments were performed to show the effectiveness of the system. The sampling frequency of the whole system can be about 0.5 kHz and that in local MCUs can be about 10 kHz. Control method of the motor can be changed during the motion in an experiment controlling four joints of the robot. Conclusion: The results of the experiments showed that the distributed control system proposed in this study is effective for humanoid robots.


INTRODUCTION
Humanoid robots require efficient control systems to complete the complicated tasks using many actuators and sensors. Most of humanoid robots have 10-40 motors and many sensors. Many control methods have to be applied in order to complete various tasks of the robots.
The control systems for humanoid robots can be divided to two groups. One is the centralized control system by single computer and the other is distributed control system. In the centralized control system, all of the calculations and I/O processes are concentrated to single computer. The software of the system is easy to develop, because the computer can access all of the data without communications between computers. The time to access all devices such as actuators and sensors tends to be long in case of that the robot has many devices. The signal lines to the device also tend to be long, because all of the lines have to be connected to single computer directly.
In the distributed control systems, multiple computers and communication lines are used for the control. Multiple computes can be located in the body, the arm and the leg of the robot. The communication between the computers enables the system to share the data and control a whole robot. The advantage of the distributed systems is that parallel processing using multiple computers is possible. Small numbers of devices are connected to each computer. I/Os for many devices are distributed to many computers. Therefore the access time to the devices can be short and high sampling frequency of the control can be achieved. Another advantage of the distributed systems is that many cables from the computer to the devices can be short, because distributed computers can be located near the devices. The disadvantage of the system is that software tends to be complicated, because the communications between the computers are required.
For the control of humanoid robots, some distributed control systems have been proposed. Zhong et al. (2005) realized distributed control system based on CAN bus for a humanoid robot with wheels. Albero et al. (2006) proposed distributed architecture for a small biped robot. Kanehiro et al. (2006) developed a distributed control system based on realtime Ethernet for a human-size biped humanoid robot. For factory automation, distributed systems have been developed. Some specifications of communication network to operate machines remotely are proposed. The specifications such as CC-Link, MechatroLink and EtherCAT enable the operators of factories to manage the machines efficiently. The efficient control system for prototype robots is desired for various researches. For the research of the robots in laboratories, it is not uncommon that additional devices are attached to the robots or some devices of the robots are changed. For example, the designs of the arm of the three robots shown in Fig. 1 are almost same, but the degrees of freedom of the robots vary greatly according to the purpose of respective experiments (Yussof et al., 2007;2008). One robot has two arms and two legs and the other robots have fingers. Different sensors such as force sensor and tactile sensor are used according to the experiments.
Because wide varieties of tasks are desired for humanoid robots, many control methods such as position control force control are desired in the motion of the robots. It is also desired that the control method can be flexibly switched by its software during the motion.
This study presents the development of a distributed control system for humanoid robots. The system is designed for the research robots used in laboratories. Therefore the system is based on smallscale software and low-cost hardware whose parts are easily obtainable.

MATERIALS AND METHODS
Humanoid robots have many motors to drive the joints of their arms and legs. For the motor control of the robot, some motor-driver boards with the function of velocity/position feedback control by the hardware of electronic circuits have been developed and marketed. The advantages of those motor drivers are that necessary number of signal lines is small and commands to the driver are simple. Their disadvantage is that their control method and gains cannot be changed easily during the motion. It is desired that humanoid robots can switch the control methods flexibly so that the robots can have wide applications. In case of that H-bridge motor-driver circuit is controlled from computer directly, control methods of the motors can be designed flexibly and they can be easily changed during its motion.
It is important to reduce the number of signal lines of the robot system for the efficiency of the experimental production. Four signal lines are required to control H-bridge circuit from the computer, while typical commercial motor drivers require one signal line. Most of humanoid robots have 10-40 motors. If single computer accesses many H-bridge circuits directly, many long cables are required. Furthermore, many encoder cables are required for many rotary encoder attached to servo motors. If multiple small computers are located at the body and the legs of the robots, amount of the signal cables can be reduced.
Distributed control systems also have the advantage in efficiency of the control process. The processing time to access many motors can be shorten by distributing the process to multiple computers. For the calculation of the motion planning and whole-body feedback control, not only distributed small computer but also a high-performance computer is required.
As a prototype of control system, a system using a PC and MCUs has been developed (Suzukawa et al., 2009). The prototype is the system for simple robots with a few DOFs. Figure 2 shows the hardware structure of the prototype control system. Micro Control Unit (MCU) in Fig. 2 is microchip technology dsPIC30 MCU. The MCU is connected to PC via USB/UART (Universal Asynchronous Receiver Transmitter) converter and includes UART module, PWM module, pulse-counter module for a rotary encoder and so on. For feedback control of a motor, PWM duty ratio is adjusted based on the encodercounter value and the calculation in the MCU.
The response of the communications in the control systems using USB/UART converter is not fast enough for the control of humanoid robots. We have developed a control system using Rs-485 (EIA-485) by the improvement of the prototype. The system is designed for complicated robots with many DOFs. Figure 3 shows the hardware organization of the control system using Rs-485. The system consists of single PC and multiple MCU boards. The operating system of the PC is Linux. Data of the control is shared using Rs-485 serial communication. The MCU boards access the motor driver and rotary encoder and carry out simple feedback control for each motor. The PC is used for complicated calculation such as motion generation and whole-body feedback control of the robots. Simple process for each motor can be done in a short time, because multiple MCU boards work at the same time and each MCU boards access one or two motors. Because the performance of MCU boards is lower than that of the PC, complicated calculation is carried out by the PC.
To control a whole robot, communications between the PC and MCU are required.  We have developed a MCU board for motor control. Figure 4 and 5 show the photograph and the hardware structure of the MCU board. Two MCUs are mounted in the board. Both of those are microchip technology dsPIC33 MCUs. One is used for data relay and the other is used for I/O and control. The relay MCU receives data from PC via Rs-485/UART converter and sends data to the I/O MCU. The I/O MCU receives data from the relay MCU and sends data to PC via UART/Rs-485 converter. Digital I/O line connects two MCU boards in order to adjust the transmission timing from the MCUs to the PC. I/O MCU is connected to the motor drivers and rotary encoders. One MCU board can be connected to two motor drivers and two rotary encoders. Many motors can be controlled using many MCU boards in the system. We have developed a motor driver board including two sets of H-bridge circuit using four FET.
The motor driver board can be attached to the MCU board. The rotation direction and angular velocity of the motor are controlled by PWM output and digital output from the I/O MCU to the circuit. The control method can be flexibly switched during the motion of the robot according to the command from the PC. In the control system, the PC and the MCU share data such as command to the motors and encoder-counter value. Figure 6 shows the transmission data from and to the PC. The data from PC to the Relay MCUs consist of multiple blocks. In each block, ID is written in the top of each block and the commands to the MCU board are written in following parts. Each Rely MCU receives all data from the PC and selects the block that ID in the block corresponds with the ID of the board. The selected data is sent from the Relay   For the control of the motors, each I/O MCU receives the command from the PC and controls the motors based on the command. For example, in case of position control of the motor angle, the MCU reads encoder-pulse-counter value, calculates PWM duty ratio and outputs the ratio and digital I/O for the motor drivers. Other control methods and dynamic brake can be applied to the motors by the software of the I/O MCU. To execute the control task along with the communication task, timer interruption is used in the I/O MCU. The control methods can be easily switched to other method according to the command from PC. The function is useful for humanoid robots that multiple control methods are often used during their motion. Because the motor control process in all I/O MCU boards are carried out at the same time, sampling period of motor control loop can be small even if many motors have to be controlled in the system.

RESULTS
In order to evaluate the control system, three experiments are performed. First and second ones are carried out in order to measure the sampling frequency in the I/O MCU and in the whole control system respectively. In the third experiment, four joints of a humanoid robot are controlled using three different control methods. The humanoid robot has 21 DOFs and its height is 1.25 m. The 1.0 kg box is connected to the tip of the right arm. The joints of the arms and legs are driven by 90 W DC servo motors. The angles of the motors are measured by rotary encoders attached to the motors.
In the first experiment, the I/O MCU outputs a digital signal to show its status. The MCU changes the output voltage when the timer interruption begins and ends. Figure 7 shows the voltage measured by 400 kHz data logger. In the Fig. 7, timer interruption process begins and ends at the rising edge and falling edge of voltage. Fig. 7 shows that the sampling frequency of the local feedback control at I/O MCU is about 10 kHz.  Fig. 8. The sampling frequency of the whole control system is almost same as that of data reception at I/O MCU. In the Fig. 8, the rising edge of voltage shows the start time of the reception of command data. The Fig. 8 shows the frequency of the data reception is about 0.5 kHz.
In the third experiment, right shoulder-pitch, right shoulder-roll, right elbow and waist joints are controlled using single PC and two MCU boards. The joints of the legs, the neck and the left arm are not controlled in this experiment. The position feedback control is applied to right shoulder-roll, right elbow and waist joints. To the right shoulder-pitch joint, position feedback control, dynamic brake and motor off are applied.  Figure 9 shows reference angles of the position feedback control. The reference is calculated using a polynomial equation. In the Fig. 9, "control 1" is position feedback, "control 2" is dynamic brake and "control 3" is motor off. The reference angle of right shoulder-pitch joint is not calculated after 6 sec, because position feedback control is applied to the joint before 6 sec. Figure 10 shows photograph of the experiment. The tip of the right arm rises by the rotation of the right shoulder-pitch joint before 6 sec. It is put down slowly from 6-9 sec because of dynamic brake and gravity force and it is put down quickly because of motor off and gravity force after 9 sec. The body of the robot is twisted by the rotation of its waist joint. The right arm is bent at the elbow joint by the position feedback control.

DISCUSSION
Motor drivers of position feedback control or velocity feedback control are often used for robot control. It is not easy that control method of most of those drivers is changed from one method to the other during the motion. The result of third experiment shows that the control system presented in this study has the capability of changing the control method during the motion. In centralized control system, the sampling frequency has to be lower if the number of the motors increases. In the distributed system presented in this study, the sampling frequency of the local feedback control at the MCU boards is independent of the number of the boards, because the process of the MCU boards is carried out in parallel.
The PC in the system broadcasts the data including the commands to all MCU boards at one time in order to increase the efficiency of the process in the PC. The Relay MCU in the MCU board receives large data from PC and sends small data to I/O MCU. The function of the relay MCU decreases the load of I/O MCU.

CONCLUSION
This study discussed the control system for humanoid robots. The control system that consists of single PC and multiple MCUs has been proposed. The software to control the motors has been developed and its effectiveness is verified by basic experiments. In the future, we plan to extend the system so that all joints of the humanoid robot can be control for complicated tasks.