Based on the digital control system in open type of Android platform and the method for wherein carrying out secondary development
Technical field
The invention belongs to the Electromechanically integrated numerical control technical field, and relate to a kind of digital control system in open type.More specifically, the present invention relates to based on the digital control system in open type of Android platform and the method for wherein carrying out secondary development.
Background technology
In the prior art, digital control system has become the core key equipment of lathe equipment.Through years development, the architecture of digital control system is divided into two types basically: traditional single plate structure and fieldbus structure.Wherein traditional single plate structure systemic-function is fixed, and does not possess opening, can't satisfy the application demand that the user increases day by day; Though and the digital control system of fieldbus structure has good opening, can expand or revise system user configuration or function easily, its expensive price is not suitable for the popular user application demand that has a large capacity and a wide range.Yet no matter be traditional single plate structure or field summary structure, the human-computer interaction interface of existing digital control system is fixed, and towards the machine tooling control procedure, very flexible, secondary development does not suit to carry out.Along with manufacturing industry and robotization industry are strong to controlling personalized increasing demand, existing fixed user function, interface model and expensive personalized customization expense can't satisfy the diversified demand of user.Therefore, overcome the deficiency of traditional digital control system man-machine interface, satisfy the customized demand at user individual function and interface, realize secondary interface exploitation fast, the shortening construction cycle seems particularly urgent and important.In addition; The operating system platform that existing digital control system adopted is confined to DOS, Windows, industrial Linux and chip level dedicated system basically; Have good reliability, advantage that real-time is good for the realization of core control function; Yet for the exploitation inefficiency at personalized user function and interface, and available resource relatively lacks.Therefore, existing digital control system can't satisfy the growing personalized demand for control of user on system architecture and platform construction, need improve and improve it, and to guarantee when meeting consumers' demand, improving development efficiency, rich interface is exploited natural resources.
The Android platform is the mobile terminal operating system of increasing income based on the Linux platform of Google (Google) company exploitation, hopes in the industry of moving, to form an open ecosystem by setting up standardization, open mobile terminal software platform.At present, the Android platform has become the first-selected platform of mobile terminal device exploitation, and the application of extensive maturation is arranged in the communications field.Yet, still there are not digital control system exploitation and application at numerical control field based on the Android platform, Android platform rich in natural resources, free use and open architecture also do not absorb in the exploitation of digital control system.
To sum up can know,,, be necessary the improvement that existing digital control system is innovated in order to solve this secondary development problem because the platform of the framework of digital control system and employing at present has significant limitation to the exploitation at quick personalized function of user and interface.
Summary of the invention
The technical matters that the present invention will solve; To the problem of the limitation of digital control system of the prior art when carrying out user individual function and interface development with the long construction cycle, provide a kind of have good open property, structural arrangements flexibly, cost is easy to control and applicable to the digital control system in open type based on the Android platform of dissimilar users' supporting demand.
The technical matters that the present invention will solve is achieved through following technical method: a kind of digital control system in open type based on the Android platform is provided; Comprise and be used to receive the servo-drive system that steering order is accomplished the real-time control of digital control processing process; Wherein, said digital control system also comprises:
Adopt the human-computer interaction interface of said Android Platform Implementation, be used to receive the result who shows real-time control to the data configuration of said digital control system and to the user;
The IPC unit is used to carry out the real-time control task of said digital control system and through carrying out data interaction with said Android platform;
Bus type I/O unit and bus type servo drive unit are used for the said steering order that said IPC unit sends is transmitted to said servo-drive system to control said digital control processing process and to be used for the result of the real-time control of said servo-drive system is fed back to said IPC unit.
In above-mentioned digital control system in open type based on the Android platform, said digital control system also comprises real-time multi-task scheduler module and the real-time multi-task interface that is used to provide real-time development environment; Said IPC unit is through said real-time multi-task scheduler module scheduling real-time task.
In above-mentioned digital control system in open type based on the Android platform, said real-time multi-task interface also is used to call the needed external interface function of inner nuclear layer of the said digital control system of visit and is used to be implemented in the real-time exploitation that the application layer of said digital control system is carried out.
In above-mentioned digital control system in open type based on the Android platform, said Android platform comprises:
The Linux cross compilation environment is built module, is used to build the Linux cross compilation environment and generates the .so library file that is applicable to the operating system under the said Android platform;
The Android development environment is built module, is used to build the development environment that is applicable to the operating system under the said Android platform; And
The program compilation module, the Launcher code and the generation APK that be used to generate application layer human-computer interaction interface program, generate based on the operating system under the said Android platform install file.
In above-mentioned digital control system in open type based on the Android platform, said Linux cross compilation environment is built the module generation and is applicable to that the .so library file of the operating system under the said Android platform refers to: transfer the API library file to said .so library file.
In above-mentioned digital control system in open type based on the Android platform, said program compilation module generates said APK installation file and refers to: said Launcher code and the packing of API library file are installed file to generate said APK.
In above-mentioned digital control system in open type based on the Android platform, the data configuration to said digital control system that said human-computer interaction interface receives comprises system operation management, parameter setting, G code input, system diagnostics and position display; The real-time control task of the said digital control system that said IPC unit is carried out comprises process control, motion control and logic control.Wherein, motion control includes but not limited to position interpolation, axis Position Control and position compensation.
In above-mentioned digital control system in open type based on the Android platform, said IPC unit is connected through Ethernet with said Android platform, and said bus type I/O unit and bus type servo drive unit are through universal serial bus and said IPC unit strings row communication.
According to a further aspect in the invention, a kind of method of in based on the digital control system in open type of Android platform, carrying out secondary development is provided, said method comprising the steps of:
S1, build the Linux cross compilation environment, and generate the .so library file that is applicable to the operating system under the said Android platform;
S2, build the development environment that is applicable to the operating system under the said Android platform; And
S3, under the development environment that step S2 is built exploitation based on the code of the digital control system of said Android platform.
Carry out in the method for secondary development in based on the digital control system in open type of Android platform above-mentioned, said step S3 specifically comprises following substep:
S31, based on Java language Application and Development layer human-computer interaction interface program;
S32, based on the operating system under said Android platform exploitation Launcher code; And
S33, the packing of said Launcher code and API library file is installed file to generate APK.
Embodiment of the present invention can obtain following beneficial effect:
(1) digital control system in open type of the present invention is based on the Android platform; Operating system under this platform is integrated in the Android panel computer; Can follow the operator during operation moves; Hang on the basic machine after then can being placed on the screen protection pattern during inoperation, promptly energy-conservationly overcome again that existing digital control system man-machine interface is fixed, shortcoming such as stiff, dumb;
The man-machine interaction mode hommization more of (2) setting up based on the Android platform is easy to study and operation; The Android platform is supported real-time multi-task operating system, and software development is easy with transplanting, is fit to be applied to the Industry Control occasion; Secondary development method of the present invention also is suitable for the Different software operating environment simultaneously, has very strong portability;
(3) can make the present invention on hardware, be directed against different lathe and processing objects through choosing flexibly, have extensive applicability with bus type I/O unit that disposes difference in functionality and bus type servo drive unit;
(4) adopt the Android platform to solve the too high problem of personalized customization cost in the prior art, be convenient in the digital control processing process that has a large capacity and a wide range, be applied.
Description of drawings
Below will combine accompanying drawing and specific embodiment that the present invention is explained further details.In the accompanying drawing:
Fig. 1 is the structural representation of the digital control system in open type based on the Android platform of the present invention;
Fig. 2 is the hardware configuration synoptic diagram of the digital control system in open type based on the Android platform of the present invention;
Fig. 3 a is first logic diagram of the digital control system in open type based on the Android platform of the present invention;
Fig. 3 b is second logic diagram of the digital control system in open type based on the Android platform of the present invention;
Fig. 4 is the process flow diagram that in based on the digital control system in open type of Android platform, carries out the method for secondary development of the present invention; And
Fig. 5 is another process flow diagram that in based on the digital control system in open type of Android platform, carries out the method for secondary development of the present invention.
Embodiment
In order to make the object of the invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with accompanying drawing and embodiment.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
Shown in Fig. 1-2 and 3a-3b, the invention provides a kind of digital control system in open type (hereinafter to be referred as digital control system) based on the Android platform.This digital control system is divided into the three-decker (see figure 1): system kernel layer, application platform layer and application layer.Compare with existing digital control system, all only need carry out, isolate with hardware and system kernel layer simultaneously in the application layer of application platform layer and application layer composition to interface development and personalized customization that digital control system of the present invention is carried out.
Referring to Fig. 2 and Fig. 3 a, digital control system of the present invention comprises Android platform 1, IPC unit and servo-drive system 2; Wherein, Android platform 1 is used to accomplish the data configuration process of digital control system, and servo-drive system 2 then is used to receive steering order to accomplish the real-time control to the numerical control process.
Particularly; The Android platform 1 that the present invention adopted is the Android panel computer; It comprises the human-computer interaction interface 11 based on the Android Platform Implementation; And this human-computer interaction interface 11 is user oriented running program, and the user can import each parameter that digital control system is controlled through this running program, thereby accomplishes the data configuration process of digital control system.In other words, human-computer interaction interface 11 can be used for receiving the data configuration to digital control system.Here said data configuration is such as but not limited to system operation management, parameter setting, G code input, system diagnostics and position display etc.On the other hand, human-computer interaction interface 11 also can be shown to the user with the result that servo-drive system 2 is controlled in real time, is convenient to the user and according to actual conditions the numerical control process is further regulated and control.
As shown in Figure 1; Correspondingly with the data configuration process be; Human-computer interaction interface 11 can comprise common menu and application programming interfaces (Application Program Interface, API), failure diagnosis unit, text editor and API, network communication unit, state demonstration and API and MDI etc.In addition, (or being described as in the PC) is provided with at least one shared drive district (not shown) that is mutually related in the Android platform; The all types of data that human-computer interaction interface 11 is received can mail to the shared drive district after suitability is handled, also can in this shared drive district, read each result of control in real time simultaneously, are used for further demonstration.
Digital control system of the present invention also comprises IPC (Industrial Personal Computer) unit 3, bus type I/O unit 4a, 4b ... 4n and bus type servo drive unit 5a, 5b ... 5n; Wherein, IPC unit 3 is the core component of digital control system, is used to carry out the real-time control task of digital control system.As shown in Figure 2, IPC of the present invention unit 3 provides four serial communication interface PORT0, PORT1, PORT2 and PORT3.Further, bus type I/O unit 4a, 4b ... 4n and bus type servo drive unit 5a, 5b ... 5n is through universal serial bus and 3 serial communications of IPC unit, and is used to set up being connected between IPC unit 3 and the servo-drive system 2.Particularly; Bus type I/O unit 4a, 4b ... 4n and bus type servo drive unit 5a, 5b ... 5n is used for the motion control instruction that IPC unit 3 sends is transmitted to servo-drive system 2 with control digital control processing process, also is used for simultaneously the result that servo-drive system 2 is controlled is in real time fed back to IPC unit 3.
What further specify is that communicating by letter with Android platform 1 through Ethernet in IPC of the present invention unit 3, realizes exchanges data between the two.Particularly; From Android platform 1, especially from receive the control data of users' input based on the human-computer interaction interface 11 of Android platform 1 realization, to Android platform 1, especially to the result of transmitting real-time control based on the human-computer interaction interface 11 of Android platform 1 realization.In addition, the 3 enforceable controls of IPC unit comprise process control, motion control and logic control.Accordingly, application layer (application layer and application platform layer) comprises the process control unit 31 and motion controller 32 of implementing logic control and motion control.Motion control of the present invention includes but not limited to position interpolation, position compensation and axis Position Control; Its implementation procedure is: assemblies such as the interpolator of motion controller 32, axis Position Control module and position compensation module receive the control data by the corresponding application programs interface transmission of application platform layer; The correlation function function and the interface function of calling system inner nuclear layer are accomplished the control of the digital control processing process that is applicable to real-time task simultaneously.
Further referring to Fig. 2 and Fig. 3 b, digital control system of the present invention also comprises the real-time multi-task scheduler module 6 and real-time multi-task interface (be also referred to as real-time multi-task API, see Fig. 1) that is used to provide real-time development environment; Wherein, real-time multi-task API also is used to call the needed external interface function of inner nuclear layer of visit digital control system and is used to be implemented in the real-time exploitation that the application layer of digital control system is carried out.Real-time tasks are dispatched through real-time multi-task scheduler module 6 in IPC unit 3, thereby realize corresponding control.Be connected with real-time multi-task scheduler module 6 through this real-time multi-task API with in real time relevant module in concrete the application.Through real-time multi-task API, real-time application of the present invention and hardware are isolated fully, only need revise application layer software to the secondary development of different application like this, and need not to come into contacts with hardware.Utilize the various API (the application development interface layer API that goes out as shown in Figure 2) of application platform and application program, also can realize quick expansion its function.Therefore, only need utilize corresponding API just can accomplish secondary development.
Digital control system of the present invention can be set up " man-machine interface " of being convenient to carry out secondary development in application layer; Specifically, Android platform 1 comprises that the Linux cross compilation environment is built module 12, the Android development environment is built module 13 and program compilation module 14.Wherein, the Linux cross compilation environment is built module 12 and is used to build the Linux cross compilation environment and generates the .so library file that is applicable to the operating system under the Android platform.If the Linux cross compilation environment is built module 12 and is built the Linux cross compilation environment through enabling Cygwin software under the Windows system; If set up required Linux cross compilation environment through enabling Ubuntu gcc software in that linux system is next.Subsequently, because existing API all can only support Windows and Linux platform, the Linux cross compilation environment that the API library file is passed through to be set up converts the .so library file that under the operating system of Android platform, can call into.The Android development environment is built 13 of modules and is used to build the development environment that is applicable to the operating system under the Android platform.Wherein, the Android development environment is built module 13 and is set up the Android development environment through enabling softwares such as Eclipse, JDK, NDK and SDK.14 of program compilation modules are used to generate application layer human-computer interaction interface program, generate Launcher code and generation APK installation file based on the operating system under the Android platform.The application layer human-computer interaction interface program that is generated comprises interface layout and the api interface function that calls from the system kernel layer; The Launcher code that is generated can directly move each corresponding program of digital control system of the present invention when making os starting under the Android platform; The APK that is generated installs file and then by program compilation module 14 Launcher code and the packing of API library file is formed.Above-mentioned secondary development process has been utilized the various API of application platform of the present invention and application program well, and the real-time exploitation through application layer can realize modification and the adjustment with the real-time task coupling.
As shown in Figure 4, the present invention also provides a kind of method of in based on the digital control system in open type of Android platform, carrying out secondary development.This method starts from step S11, in step S12, builds the Linux cross compilation environment subsequently, and generates the .so library file that is applicable to the operating system under the Android platform.In step S13, build the development environment (also can abbreviate the Android development environment as) that is applicable to the operating system under the Android platform, being convenient to follow-up based on the Android Platform Implementation is according to carrying out and the secondary development process with the real-time task.In step S14, under the Android development environment of being built, develop the code of digital control system of the present invention subsequently; Operating system under the Android platform can directly be moved the code of being developed.This method ends at step S15.
In Fig. 5, the present invention further provides a kind of method of in based on the digital control system in open type of Android platform, carrying out secondary development.This method starts from step S21, in step S22, builds the Linux cross compilation environment subsequently.Particularly, judge based on operating system be Windows system, or linux system.If the Windows system then in step S23a, enables the operation of Cygwin software; If linux system then enables the operation of Ubuntu gcc software in step S23b.In next step S24, under the Linux cross compilation environment of being built, convert the API library file into the .so library file, the operating system under the Android platform can be called the .so library file.In next step S25, build the development environment that is applicable to the operating system under the Android platform through the operation that enables softwares such as Eclipse, JDK, NDK and SDK, also promptly build the Android development environment.Subsequently, in step S26, based on Java language Application and Development layer human-computer interaction interface program; Specifically comprise and carry out interface layout and call the api interface function.Next, in step S27,, can directly move the software of this numerical control system when making the os starting of Android platform based on the operating system under the Android platform of being built exploitation Launcher code.In step S28, Launcher code of being developed and the packing of API library file are generated APK installation file at last.This method ends at step S29.
Details are as follows to carry out a concrete example of secondary development among Fig. 5:
1. build cross compilation environment: download and install Cygwin software, and system environment variable correctly is set.
2. use Cygwin software that digital control system API library file is generated the .so library file: to open Cygwin software; Call the cd order and get into API library file place catalogue; Write self-defining .mk file, Tiao Yongmingling $NDK/ndk-build can generate the .so library file that Android can call in Cygwin software then.
3. build Android open loop border, this example uses Eclipse to develop software, and according to actual development requirement the corresponding function module is installed.
4. exploit person machine interactive interface: newly-built Android project file in Eclipse software is provided with behind the correlation parameter according to demand and calls the digital control system api interface function interface that develops software.
5. develop the Launcher code:, and in project file, the AndroidManifest.xml file is carried out corresponding configuration based on Android Launcher source code exploitation Launcher code.
6. generate APK file is installed: operation Run As Android Application option corresponding command under project file, and then be compiled in the corresponding APK file of generation under the libs file automatically.
In sum, digital control system in open type of the present invention solved that traditional digital control system man-machine interface fixing can't move, deficiencies such as complex operation and shortcoming dirigibility; Based on the man-machine interaction mode hommization more that the Android platform is set up, be easy to study and operation; The Android platform is supported real-time multi-task operating system, and software development is easy with transplanting, is fit to be applied to the Industry Control occasion; Secondary development method of the present invention also is suitable for the Different software operating environment simultaneously, has very strong portability; Because secondary development process and hardware are isolated fully, digital control system of the present invention can be directed against different lathe and processing objects on hardware, and configuration property is strong and widely applicable.In addition, adopt the Android platform to solve the too high problem of personalized customization cost in the prior art, be convenient in the digital control processing process that has a large capacity and a wide range, be applied.Also be that the present invention has realized that a kind of secondary development is convenient, structural arrangements is flexible, cost is controlled and has been applicable to the digital control system in open type of polytype supporting requirements.
The above is merely the preferred embodiments of the present invention, not in order to the present invention is done any restriction.It should be understood that those skilled in the art can teaching according to the present invention carry out various modifications and adjustment to the present invention, but these modifications and adjustment all should be included within protection scope of the present invention.