A Multi-agent Controller on Embedded System for Complex Mechatronics
Xing Wu, Peihuang Lou, Dunbing Tang
College of Mechanical and Electrical Engineering, Nanjing University of Aeronautics and Astronautics, Nanjing 210016 E-mail: Wustar5353@nuaa.edu.cn
Abstract: A multi-agent controller on embedded system is presented for complex mechatronics in this paper. The agents' concept is combined with a physical control system to produce a controller agent. The multi-controller system of complex mechatronics can be regarded as a series of controller agents, and they can be converted to the Multi-Agent System (MAS) easily by changing corresponding concepts. Controller agents can be implemented by a number of agent tasks located on different microprocessors at the hardware level and coordinated by a Real-Time Operating System (RTOS) at the software level. In the view of control agents and MAS, an embedded control system with ARM and DSP is designed and developed for a vision-based Automated Guided Vehicle (AGV), from the agents' partitions to the MAS design, and from the hardware construction to the software programming. This development paradigm demonstrates an effective and concise implementation way in which the MAS-based approach is adopted on the embedded control system. It is expected to help the multi-controller system design for complex mechatronics. Key Words: MAS, embedded system, mechatronics, RTOS, microprocessor
Mechatronic systems design is the integrated design of a mechanical system and its (embedded) control system . It is a complicated design task because the control system of mechatronics generally has multiple control algorithms (each control algorithm is designed to fulfill a particular task) and lots of design constraints, which has been called the multi-controller system [2, 3]. It is hard to design one conventional microcontroller-based system that can fit all these objectives and design constraints. Designing such systems may benefit from a thorough understanding of design requirements and constraints, and engineering skills in structuring the control problem and organizing individual solutions. In this sense, the multi-controller system not only needs a series of control algorithms oriented to particular tasks, but also requires a reasonable system development methodology including function definition, system design and physical realization. A special role on analyzing and solving complex problems is attributed to the concepts of agent and Multi-Agent System (MAS) . Agent represents an abstract entity that can solve a particular or partial problem. Several agents can be integrated to constitute a system that is able to deal with more difficult issues by their cooperation. When the design problem is distributed in nature, the development of a solution may benefit from an agent-based approach . This agent-based approach has been used widely in different fields of software development, manufacturing system and mechatronics [2, 6-8], not only to organize the architecture at the high level, but also to construct the platform at the low level. The MAS-based approach is expected to help the synergy of intelligent agents, control
This work is supported by Fok Ying Tung Education Foundation under Grant 111056, and the fund of Jiangsu Key Laboratory of Precision and Micro-manufacturing Technology under Grant JSPM200701.
and physical devices for advanced automation in a highly distributed architecture . Comparing the concepts of a local controller and an agent, van Breemen  presents a particular type of agent, named the controller agent, which contains all information of a particular control problem. An implementation framework is described to design and implement the hierarchical structured multi-controller system that consists of a set of heterogeneous control algorithms. Ning  has promoted the work by designing an embedded software system based on MAS’ view for a tele-operation mobile robot. This is a good beginning to combine the MAS-based approach and the embedded control systems. The effective implementing means are also important for the multi-controller system development of mechatronics as well as the advanced design methodology. The conventional solution for such control systems usually consists of the general purpose computer with several function cards at the hardware level, and Windows operating system at the software level. However, this universal solution has some unavoidable disadvantages on real-time, cost and power dissipation . With the advent of VLSI system level integration, the embedded system of ARM (Advanced RISC Machine) and DSP (Digital Signal Processor), becomes the centre of gravity of the computer industry, and the first choice when the controller is designed for mechatronics [9-11]. This paper attempts to design and implement a multi-agent controller for complex mechatronics by using by a number of
agent tasks located on different microprocessors at the hardware level and coordinated by a RTOS at the software level. A
transformation method from the controller agent system to the embedded hardware and software is presented in this paper. The vision-based Automated Guided Vehicle (AGV) is selected as a design paradigm to show the MAS-based development process. The remaining parts of this paper are
978-1-4244-2723-9/09/$25.00 c 2009 IEEE
organized as follows. The MAS-based embedded system design approach at the software and hardware level is presented in section 2. The detailed development of AGV’s multi-agent embedded controller is described in section 3, from the agents' partitions to the MAS design, and from the hardware construction to the software programming. In section 4, the multi-agent embedded controller is used in the AGV’s path tracking experiment, and proved to have a good performance. A brief conclusion is given in section 5.
THE MAS-BASED EMBEDDED SYSTEM DESIGN APPROACH
The controller agent can be regarded as an autonomous unit in the control system, which may be a physical controller or a control program. With the guidance of function objectives (beliefs), a group of controller agents can realize their own control algorithms and operation process (behavior), and cooperate for the common objectives by communicating and interacting with others (coordination mechanism). The multi-agent system has a relatively loose and independent structure, and the agents’ cooperation can complete many difficult tasks that are impossible to an individual agent.
multi-agent system according to the coupling relationship among agents, which is also called modeling for MAS. Some strongly mutually coupled agents can be gathered as a controller agency with the common control objectives and local coordination mechanism. The main agent provides a blackboard system to share the information and achieve the interaction among the whole controller agency. The agency structure is suitable for a parallel processing and can save the cost of communication resources, in which all agents are able to work independently at different information levels. Other communication ways such as point-to-point and broadcasting are also employed to improve the real-time system performance for those agents that have the specific communicating partners.
2.3 The Hardware Design for Controller Agents
These controller agents with different objectives require various hardware resources to carry out the corresponding operations, such as microprocessors in which programs run, on-chip devices to carry out a particular command, and peripheral circuits to extend system functions. Physical ports provide these controller agents on different microprocessors with the mutual interaction means. Shared memory is a realization form of blackboard systems which constructs the hardware areas for the communication of these controller agents on the same microprocessor. These agents' implementation at the hardware level have not only the similarity but also the diversity in function and structure, so they can be classified as different catalogs containing input, output, communication, process and memory. So the modularization design can be considered in building the hardware platform of control systems by organizing the hardware resources. These controller agents are distributed in different microprocessors and different parts of the same microprocessors. Some controller agents only need the processor to carry out the algorithms’ computation without the data exchange to other peripheral devices, so they are located on the microprocessor kernel. Some controller agents want to acquire the information from different sensors, so analog and digital input pins and peripherals are used. Some controller agents make use of analog and digital output pins and peripherals to control different actuators. Some controller agents use various communication ports and bus, such as Uart port, and SPI, I2C and CAN bus, to accomplish the data transmission among different microprocessors. So it can be seen that these agents are located at different structure levels and can use various hardware resources in the consideration of their function objectives.
2.1 MAS-based Design Procedure
A high-efficiency and clear-hierarchy design scheme can be expected by applying the concept and thought of controller agents to the embedded systems. System design starts with the function decomposition and belief creation of a series of controller agents, which can be located on different micro- processors, and converted to several agent tasks on a RTOS. A set of on-chip devices and peripheral circuits are used by microprocessors to construct a physical platform. The agent tasks are implemented as programs with stacks on a RTOS, and the coordination mechanism among them is built by using system services offered by a RTOS. The whole design procedure is shown as Fig. 1.
2.4 The Software Design for Controller Agents
Fig 1. MAS-based design procedure
2.2 The Controller Agent Partition
A control system can be divided into a series of controller agents in the consideration of function objectives. These controller agents are distributed in different system layers, such as execution layer, cooperation layer and organization layer. The coordination mechanism is designed for the
We can implement the controller agents on the embedded control systems by using the multitasking RTOS kernel at the software level. A RTOS's task is a simple program that thinks it has the CPU all to itself. A priority, a set of CPU registers, and some stack areas are assigned to each task. The fundamental service provided by the RTOS kernel is context switching. Using this method, an actual embedded system possesses the real-time multitask processing capacity, and each RTOS’s task can be executed concurrently . We
2009 Chinese Control and Decision Conference (CCDC 2009)
may regard each task as an independent pseudo-processor, which can be scheduled by the multitasking RTOS kernel and can communicate mutually depending on the RTOS system services. These features cannot be achieved by lifting the processor’s processing capacity only. In the MAS’ view, we can design each task based on the controller agents’ model at the software level, and construct their coordination and communication mechanism based on the RTOS’s system services. The transformation model from the controller agent to the agent task is shown as Fig. 2. Each
Environment u(k) i(k) Behavior Controller Agent Belief Means ack(k) o(k) Task
controller agent can be encapsulated inside an agent task, in which the agent’s resources are converted to the task’s stacks and buffers, the agent’s belief and its emergency degree to the task’s kernel and its priority, the agent’s behavior to the task’s algorithms and process, the agent’s means to the task’s input and output interfaces. The process, algorithms and interface operations are described in the task’s code body eventually. Code, stack and priority are three basic elements to create a task.
RTOS u(k) i(k) Input Sensor Algorithm Stack Buffer Output Actuator Agent task Priority
ack(k) o(k) Task
Fig 2. The transformation model from the controller agent to the agent task
Four interactive modes between the controller agent and the environment, including input i(k), output o(k), request for activation u(k) and acknowledgement for operation ack(i), can be respectively realized by the input/output operations and the RTOS’s system services to coordinate different tasks and transmit shared data. The input data of agent task may come from sensors directly by using input interfaces or from other tasks indirectly by using messages of mailbox or queue. The output data of agent task may drive executive devices directly or send to other tasks by using a message. An agent task may wait for its activation conditions by requesting a semaphore, and activates other tasks in a waiting sate by sending a semaphore. The coordination mechanism of the controller agency  can be realized on the shared memory pool (SMP) and the RTOS’s system services. SMP is a shared memory area in RAM for the global data storage as a blackboard system referred above in section 2.2. Each agent task has a different access right to shared data in SMP. A mutex semaphore is assigned to each group of shared data to ensure the data’s reliability and integrality. A task can have the access chance only when it gets the mutex semaphore related to the shared data.
output between two driven wheels, so it is able to change its posture, and move to its destination along the desired paths. In this section, an embedded multi-processor control system containing ARM and DSP is conceived and constructed for the vision-based AGV in the MAS’s view as a paradigm. 3.1 AGV’s Controller Agent Partition The AGV control system can be divided into a series of controller agents in the function hierarchy according to its autonomous movement, as shown in Tab.1. Agents at the upper level can contain a number of sub-agents at the lower level in a way of function subdivision. For example, the movement control agent at the first level consists of a number of sub-agents of image processing, path tracking, and speed control, etc. Each controller agent at different levels and catalogs has its own belief and behavior, but they can be gathered into a group (controller agency) for the common control objective. The local coordination mechanism can be built in terms of the coupling relation -ship among these agents.
Table1. The Controller Agent at Different Levels The first level Movement control The second level Image processing, Path tracking, Speed measuring, Speed control, Obstacles detecting, Behavior control AGV communication Board communication
PARADIGM: EMBEDDED CONTROLLER FOR AGV
AGV is a car-like mobile robot that can deliver materials or parts to a destination autonomously along the desired paths in an automated logistic system. Machine vision is a novel navigation way for AGV owing to its obvious advantages such as high flexibility, quick processing and abundant information. The vision-based AGV can use a CCD camera to dynamically capture the image of the guideline on the ground, use a microprocessor DSP to process the image and measure two path errors between the guideline and itself, and use a microcontroller ARM to track the guideline and calculate a velocity difference
Communication management Material transmission Power management
In this paper, AGV’s path tracking is taken as the common control objective to gather the relevant controller agents, to organize the whole controller agency, and to construct their coordination mechanism, which is shown in Fig. 3.The image processing agent sends two path errors to the path tracking agent by on-board serial port communication.
2009 Chinese Control and Decision Conference (CCDC 2009)
The speed difference output to correct errors is calculated by the path tracking agent according to path errors and AGV speed, and transmitted to the behavior control agent. This agent uses the acceleration and deceleration functions to change the AGV speed, and converts this speed to two driven wheels’ speed. The speed control agent can keeps the actual speed of DC servo motors to track the expected number in a real-time way by changing the analog voltage of the output pins. It can be seen that the objective of path tracking requires the cooperation of various agents at different levels of software and hardware, and the coupling relationship among these agents lays the foundation of the coordination mechanism designed for system. The MASbased approach can provide a high-efficiency and clearhierarchy design scheme for the AGV’s control system.
Board communication AGV speed Speed measuring
Speed Behavior Path tracking difference control Speed Command regulation AGV Speed communication Command control Command Voltage regulatio Servo motor
can read the output of ultrasonic sensors, photoelectric sensors and contact switches to detect obstacles and locate targets. The speed control agent can regulate the speed of DC servo motors in a PWM mode, and it is only necessary for the material transmission agent to control start and stop of DC motors. These controller agents related to motor control are located in the output board. The power board is used by the power management agent to realize the voltage conversion, isolation and monitoring functions. The connection board is a mutual linking platform for the above six boards. The combination based on the MAS-based approach and the modularization thought produces a set of powerful control boards for the multi-agent control system of AGV. The combined design makes full use of various on-chip resources of ARM and DSP, and the peripheral circuits are very concise. All on-chip resources are made available to users through kinds of interfaces and ports provided by ARM and DSP. It is convenient to extend new functions and connect extra devices, e.g. adding a LCD screen and a keyboard to facilitate the human-computer interaction on the vision-based AGV.
Wireless Host computer communication on ground
Fig 3. The controller agency of path tracking control
3.2 Hardware Design of Agents on Modularization The multi-processor embedded system with ARM and DSP is constructed to implement these controller agents at the hardware level. ARM LPC2210 is a real-time micro -controller used for industrial applications, having not only various on-chip peripheral devices such as PWM channels and A/D converters, but also a good performance in the event management owing to the comprehensive supports from many matured RTOS, so it is used as the AGV’s main controller. DSP TI-DM642 is a high-performance microprocessor with parallel processing capacity, which is designed for the computer vision and image processing specially, and used as the vision navigation processor of AGV. The modularization method is adopted to design a multi-processor hardware control platform of the AGV. All resources needed by the controller agents are classified and collected in the consideration of physical functions, and the hardware control platform divided into a set of embedded control board, as shown in Fig. 4. A high-performance DSP-based board is used for the image processing agent to measure two path errors, in which a set of algorithms covering high pass filter, 2-D edge detection, and Hough transformation run. The serial port Uart0 is employed to exchange data and command between the AGV communication agent and the wireless communication controller. The data & address bus are used to get encoder signals by the speed measuring agent. These serial and parallel ports are all collected in the encoder & wireless communication board. The input board
Fig 4. Hardware platform of the multi-agent control system
3.3 Software Design of Agents on uC/OS-II The multitasking RTOS uC/OS-II is used as the software kernel to design the agent tasks. It is an open source code real-time kernel designed for embedded applications, authored by Labrosse . It is used widely for various microprocessors and microcontrollers due to its portable, ROMable, scalable, preemptive real-time and multitasking ability. It can manage up to 64 application tasks and provide a number of system services, which is appropriate for the control system of the vision-based AGV. The RTOS uC/OS-II is transplanted on the microcontroller ARM to improve its real-time control performance and event management ability. All controller agents run on ARM except the image processing agent on DSP in Fig. 4, so they can be implemented on the RTOS uC/OS-II. These main agent tasks are listed as follows: (1) The board communication between DSP and ARM is encapsulated into a serial port agent task TaskUart0Comm,
2009 Chinese Control and Decision Conference (CCDC 2009)
which sends two path errors as a message from the serial port to the mailbox of path tracking task. (2) The AGV communication agent task TaskUart1Comm sends different messages to the related tasks according to the type of commands from the ground host computer. (3) The speed measuring agent task TaskSpeedSensor gets the actual speed of AGV by accumulating encoder pulses in an accurate time interval, and saves it to SMP. (4) The path tracking agent task TaskPathTrack calculates the speed difference output between two driven wheels by an optimal predictive algorithm according to path errors from its mailbox and AGV speed in SMP. The output is saved in SMP, and also sent to the mailbox of the behavior control task. (5) The behavior control agent task TaskAGVMove can realize a smooth change in acceleration and deceleration by using a system time-delay service OSTimeDly(). It can not ensure that the former message can be always processed before the coming of the latter message, so the queue with a data buffer is considered here. The desired speed of driven wheels are obtained by decomposing the AGV’s speed, and sent to the speed control task as a message. (6) The speed control agent task TaskSpeedControl carries out an expert PID algorithm to eliminate the difference of actual speeds and desired speeds, and generates a PWM output to motor drivers. Owing to the preemptive real-time ability, uC/OS-II always runs the ready task with the highest priority. As an endless loop, each task is required to give up occupying the CPU’s usage by using uC/OS-II’s system services after it finishes its operation. When a task waits for an event or data, it can request a semaphore or message by using some system services, such as OSSemPend(), OSMboxPend() and OSQPend(), so it will exit from the running state and wait for the activation condition. The MAS-based method can design and develop a complex multi-controller system step by step in the from-bottom- to-top way. Each controller and its agent can be designed, developed and debugged independently. The coordination mechanism of the multi-agent system can be tested by the cooperation of a group of typical controller agents, without a necessity that the whole control system must be built completely. Therefore, this method can decrease the design complexity and improve the design efficiency greatly.
The supervisory and control software with a database in the host computer can acquire, store and display the state data of the vision-based AGV. Experimental results shows that the embedded controller has an excellent performance in the path tracking control of the vision-based AGV, and the MAS-based design approach is feasible and effective in the software and hardware development process of the multi-processor control system for complex mechatronics. These controller agents involved in path tracking control can concurrently run on different microprocessors of ARM and DSP, and the multitask processing capacity of uC/OS-II can facilitate their realization at the software level. It is capable for this multi-controller system of the vision-based AGV to accomplish motion control and image processing simultaneously and individually in one processing period of path tracking, so the real-time control performance of such system is improved significantly.
Fig5. The vision-based AGV in path tracking experiment
THE PATH TRACKING EXPERIMENT
The MAS-based embedded system design approach has been used to develop a multi-processor control system for the vision-based AGV successfully. A prototype vehicle with this controller is constructed for the vision-based path tracking experiment. The black rubber belt is set on the lab’s ground as the guideline, and the AGV moves along this guideline autonomously, which is shown as Fig. 5. The RF-based wireless communication technology is employed for the information exchange between the ground host computer and the AGV’s control system.
The MAS-based approach is combined with the multi -processor embedded system to design and develop the multi-controller system at the software and hardware level for complex mechatronics in this paper. The MAS-based embedded system design procedure is introduced at first, and then the transformation method from the controller agent system to the embedded hardware and software is presented. The MAS-based approach has a powerful ability to express the functional relationship of control systems, and can describe the whole system architecture clearly. It can decompose a control system to a series of the controller agents with individual behaviors and mutual interactions, and obtain an overall support at the hardware and software level of embedded system. The experimental results demonstrate that this control system has achieved the expected control performance for path tracking of AGV, and that the MAS-based approach can guide an effective and concise design and development process for the embedded control system of complex mechatronics.
 van Amerongen J, Mechatronic design, Mechatronics, vol. 13, 1045-1066, 2003.  van Breemen AJN, Agent-based multi-controller systems a design framework for complex control problems, Ph.D thesis, University of Twente, 2001.
2009 Chinese Control and Decision Conference (CCDC 2009)
 Johansen TA, Murray-Smith R. The operating regime approach to nonlinear modelling and control. Taylor & Francis; 1997.  Wooldridge MJ, An introduction to multiagent systems, New York: Wiley, 2002.  Ramdane-Cherif A, Levy N, Djenidi H, and et al, Agents paradigm to solve a complex optimization problem, Proceedings of IEEE International Conference on Cognitive Informatics, 247-256, 2002.  Maturana FP, Tichy P, Slechta P, and et al, Distributed multi-agent architecture for automation systems, Expert Systems with Applications, vol. 26, 49-56, 2004.  H.P. Tang, T.N. Wong, Reactive multi-agent system for assembly cell control, Robot and Computer-integrated Manufacturing, vol. 21, 87-98, 2005.
 K.J. Ning, R.Q. Yang, MAS based embedded control system design method and a robot development paradigm, Journal of Mechatronics, vol. 16, 309-321, 2006.  W.H. He, K. Yuani, W. Zou, An embedded control system for mobile robots, High Technology Letters, vol. 17, 595-599, 2007.  Q. Fang, C.X. Xie, A Study on Intelligent Path Following and Control for Vision-based Automated Guided Vehicle, Proceedings of 5th World Congress on Intelligent Control and Automation, 4811-4815, 2004.  J.Z. Xiao, Angel Calle, J. Ye, and et al, A Mobile Robot Platform with DSP-based Controller and Omnidirectional Vision System, Proceedings of 2004 IEEE International Conference on Robotics and Biomimetics, 22-26, 2004.  Labrosse J, MicroC/OS- the real-time kernel. 2nd ed, CMP Books, CMP Media LLC 2002.
2009 Chinese Control and Decision Conference (CCDC 2009)