Invention content
Method and its application in robot field the purpose of the present invention is to provide a kind of programming of material objectization so that
Children and new hand can break away from the lengthy and tedious grammer of programming language, can preferably learn and the prehension program design logic of itself.
The technical scheme is that:A kind of method of material objectization programming, step are:
(1) the operation object with master control borad is built;
(2) suitable programming building blocks in kind are chosen and build programmed logic;
(3) programming module and master control borad in kind are connected;
(4) the corresponding programmed logic of programming module in kind is loaded into depositing for master control borad by the load module started in master control borad
In reservoir;
(5) simultaneously whether determining program logic is correct for CPU analysis programs in master control borad;
(6) if programmed logic is correct, program is performed, and whether the execution of proving program is correct;If programmed logic
It is incorrect, then to the programming building block module feedback information of mistake, the corresponding program of programming module in kind is changed, returns to above-mentioned steps
(3) continue, until correct;
(7) it if operation object operation is correct, just ends task;Otherwise, mobile and replacement programs building blocks to change program
Continue above-mentioned steps (3) afterwards, until running object operation correctly.
Further, the programming building blocks in kind refer to including basic programming instruction building blocks, delay class instruction building blocks, sensor
Enable building blocks and other instruction building blocks.Wherein, basic programming instruction building blocks include:If it is determined that instruction building blocks, cycle do instruction product
Wood, assignment directive building blocks, computations building blocks, boolean's decision instruction building blocks.
Further, contain inside described instruction building blocks and instruction module mark is stored as by memory there are one microcontroller
A unique ID;The instruction module mark is stored as alternatively, containing chip inside described instruction building blocks and passing through toggle switch
The unique ID known.
Further, the load module described in step (4) is by circuit signal, from the programming building blocks in kind of first connection
Start, the unique ID being successively read in each programming module in kind together connects the network of the programming module in kind read
It connects in relationship storage to the memory in master control borad.
Preferably, the device LED light on material object programming building blocks, master control borad detects erroneous procedures module output signal, right
The LED light answered will light.
Material objectization programmed method can be applied to robot field, the specific steps are:
(1) robot that design will be built with design;
(2) robot is built, is made of master control borad and sensor and the modules such as acoustic luminous;
(3) according to robot contemplated in step (1), programming building blocks in kind are chosen to build programmed logic;
(4) programming module in kind and the master control borad in robot are connected;
(5) the corresponding programmed logic of programming module in kind is downloaded to master control borad storage by the load module started in master control borad
In device;
(6) robot is run:Main control module parses and performs the program being loaded.
Compared with prior art, the present invention has the advantage that and technique effect:
1st, the complicated grammer of conventional programming language is simply turned to the splicing of programming building blocks by the present invention, makes children and new hand
It can easily learn to program.
2nd, the present invention is by the programming Control machine people of material objectization operation, allow children and new hand can it is vivider specifically
Prehension program designs program, changes program.
3rd, programming in kind is to complete programming process in open space in itself, so multiple users can be in open space
It is interior that same task is unfolded to cooperate.
4th, the present invention can be applicable to robot field, and support most of sensor, and children can be by operating sensor
Understand the application principle of various sensors, this considerably increases the interests of programming.
Description of the drawings
Fig. 1 is the flow chart of the material objectization programmed method of the present invention;
Fig. 2 is the foundation class instruction module schematic diagram of the present invention;Fig. 2 a-if it is determined that instruction module, Fig. 2 b-cycle are done
Instruction module, Fig. 2 c-assignment directive module, Fig. 2 d-computations module, Fig. 2 e-boolean judge (comparison) instruction module;
Fig. 3 is time delay command module diagram of the present invention;
Fig. 4 inputs class instruction module schematic diagram for inventive sensor;Wherein Fig. 4 a-sensor input instruction module, figure
4b-analog sensor input module;
Fig. 5 is example machine people trolley special instruction module of the present invention;Wherein Fig. 5 a-robot advancement commands module, figure
5b-robot left-hand rotation instruction module, Fig. 5 c-robot right-hand rotation instruction module, Fig. 5 d-robot retreat instruction module, figure
5e-robot halt instruction module;
Fig. 6 is the other class sensors command modules of the present invention;Wherein Fig. 6 a-" being forever 1 " instruction module, Fig. 6 b-" number
Word value " instruction module;
Fig. 7 is the entity exemplary plot of present invention instruction module in kind;
Fig. 8 is present invention instruction module splice program exemplary plot in kind;
Fig. 9 is schematic diagram inside the instruction module in kind of the present invention;Fig. 9 a are the on-off mode schematic diagram that chip adds coding,
Fig. 9 b are the mode solution principle figures that microcontroller adds memory;
Figure 10 is the system schematic using material objectization programmed method control robotic movement of the invention;
Figure 11 is robot along example of the present invention and black line relationship block diagram;
Figure 12 is robot program's flow chart along example of the present invention;
Figure 13 is the program that robot material objectization programming module is realized along example of the present invention;
Figure 14 is that the connection of master control borad and programming module in kind and its internal composition are schemed;
Figure 15 is load module operation principle flow chart;
Figure 16 is master control borad analysis program operation principle flow chart.
Specific embodiment
Technical solution of the present invention is described further with reference to specific example and attached drawing.For embodiment be only pair
Product of the present invention or method make generality illustration, help to more fully understand the present invention.It should be pointed out that for the art
For those of ordinary skill, without departing from the technical principles of the invention, several improvement and modification can also be made, these
Improvement and modification, which should also be considered as, to be fallen within the scope and spirit of the invention.
As Fig. 1 be the present invention material objectization programmed method flow chart, the specific steps are:
(1) build the operation object with master control borad, the operation object can be along robot, sweeping robot etc. can
To realize any operation object of program operation.
(2) suitable programming building blocks in kind are chosen and build programmed logic;
The programming building blocks in kind include basic programming instruction building blocks, delay class instruction building blocks, sensors command building blocks and
Other instruction building blocks.If Fig. 2 is basic programming instruction schematic diagram, including:If it is determined that it instructs, cycle instructs, assignment refers to
Enable, computations, boolean's decision instruction, it is specific as follows:
Fig. 2 a are if it is determined that instruction module:If【Rule of judgment】Meet, then perform【YES】Following instruction, otherwise
It performs【NO】Following instruction after finishing, then performs【Next instruction】, wherein【Rule of judgment】Usually connect sensor;
Fig. 2 b do instruction module for cycle:When【Rule of judgment】When meeting, cycle performs【DO】Following instruction, otherwise,
Then perform【Next instruction】,【Rule of judgment】Usually connect sensor;
Fig. 2 c are assignment directive module:【Digital value】Value specified by interface is assigned to【Variable】Connect to variable, it is complete
Afterwards, it then performs【Next instruction】;
Fig. 2 d are computations module:【Variable】With【Digital value】Carry out the operator specified in plank module<Plus-minus multiplies
It removes>After operation, result is assigned to【It is assigned variable】, after finishing, then perform【Next instruction】;
Fig. 2 e judge (comparison) instruction module for boolean:It returns【Variable 1】With【Variable 2】Or【Digital value】Carry out plank mould
The operator specified on block<It is equal to, be not equal to, be more than, be less than, be more than or equal to, is less than or equal to>Comparison result.
In addition to aforementioned basic programming instruction, also time delay command, sensor input instruction and other instructions.As Fig. 3 is
Time delay command module diagram, specific instruction are:Delay【Time value】The time of interface institute connection module designation number.Finish
Afterwards, it then performs【Next instruction】.Fig. 4 inputs class instruction module schematic diagram for sensor:Fig. 4 a refer to for sensor input port
Module is enabled, is digital switch signal, it is 1 that sensor detection, which has signal, and no signal is then 0.Fig. 6 is other class instruction modules:Figure
6a is " being forever 1 " instruction module, commonly used in the condition judgment interface of While loop modules, to realize Infinite Cyclic;Fig. 6 b
For " digital value " instruction module, the digital display (decimal system) adjusted by toggle switch (binary system) or button, to set
A fixed value.
Certainly, other instructions can also be extended according to the needs of programming.Such as it is then needed the characteristics of robot operation along
There are the dedicated operating instruction of robot car, such as Fig. 5:
Robot advancement commands (Fig. 5 a):Robot car is advanced with the fixed speed of default.After finishing, then hold
Row【Next instruction】.
Robot turns left to instruct (Fig. 5 b):Robot car is turned left with the fixed speed of default.After finishing, then hold
Row【Next instruction】.
Robot, which turns right, instructs (Fig. 5 c):Robot car is turned right with the fixed speed of default, after finishing, is then held
Row【Next instruction】.
Robot retreats instruction (Fig. 5 d):Robot car is retreated with the fixed speed of default.After finishing, then hold
Row【Next instruction】.
Robot halt instruction (Fig. 5 e):Robot car stops.After finishing, then perform【Next instruction】.
The material objectization building blocks of the above instruction can refer to Fig. 7, Fig. 8, and building blocks inside is each instructed to contain, and there are one microcontrollers
Or chip, each instruction module are stored as every a kind of instruction module by toggle switch or memory and identify one uniquely
ID, inside modules principle such as Fig. 9:Fig. 9 a are the on-off modes for adding coding with chip, unique ID of storage programming building block module;Figure
9b is in a manner that microcontroller adds memory, and the unique ID of programming building block module is stored with eeprom memory.
(3) programming module and master control borad in kind are connected;
Figure 14 illustrates the connection relation of programming module and master control borad in kind and the inside composition of master control borad, material object programming
First instruction building blocks of module are connected with master control borad, and the Sensor interfaces wherein in master control borad are used to connect various sensings
Device, such as:Button, photoelectric sensor, sound transducer, infrared sensor, ultrasonic sensor etc.;Motor interfaces are used for
Connect direct current generator;Output interfaces are used to connect various outputs, such as:LED light, loud speaker, steering engine, relay, network etc.
Deng.
(4) the corresponding programmed logic of programming module in kind is downloaded to depositing for master control borad by the load module started in master control borad
In reservoir;
Load module is located in main control module, when press load button after, system will BootLoader, then load
Program since the programming module in kind of first connection, is successively read in each programming module in kind by circuit signal
Unique ID, and together reading the network connection relation storage of programming module in kind in CPU memory.As Figure 15 is
Load module operation principle flow chart, operation principle are as follows:1. read first mould unique ID in the block;2. bristle with anger down successively
Enable choose first mould each port in the block as next step the object to be read, and read each port it is corresponding under
Unique ID of one module;3. according to the method for previous step, each mould of next stage connection is successively read by recursive algorithm
Unique ID of block, unique ID until running through entire connected all modules.
(5) simultaneously whether determining program logic is correct for CPU analysis programs in master control borad;
If Figure 16 is master control borad analysis program operation principle flow chart, loaded in the CPU recognition memories in master control borad
Instruction ID simultaneously performs programmed logic according to each instruction.
(6) if programmed logic is correct, program is performed, and whether the execution of proving program is correct;Otherwise, corresponding error
The red LED lamps of programming building blocks will light, then need to change the corresponding program of programming module in kind, return to above-mentioned steps
(3) continue, until correct;
(7) it if operation object operation is correct, just ends task;Otherwise, mobile and replacement programs building blocks to change program
Continue above-mentioned steps (3) afterwards, until running object operation correctly.
In addition, above-mentioned material objectization programmed method of the invention can be applied to robot field, if Figure 10 is with this hair
The whole system of the method control robot operation of bright material objectization programming, the system be divided into input module, load module module,
Logic processing module and output module.It is applied in terms of robot along the line with reference to material objectization programmed method of the present invention,
Technical scheme of the present invention is specifically described by taking the robot walked along black line as an example:
(1) robot along the line that design will be built with design:Such as Figure 11, in the movement of Robot black line walking,
There are five types of situations altogether between robot and black line, are respectively:Robot completely on line, robot left avertence, robot right avertence,
The complete left avertence of robot, the complete right avertence of robot, need to be programmed according to different situations.
(2) robot along building, built-in master control borad and infrared ray sensor:Realize a machine walked along black line
People then needs to install two infrared ray sensors below this robot, and left and right two just rides on black line, is used for
It has detected whether black line, has there is black line to be then fed back to 1, without being then fed back to 0, there are two input ports for robot master control borad along this, left
Side infrared ray is connected on the input port 1 of master control borad, and right side infrared ray is connected on the input port 2 of master control borad.
(3) along the characteristics of robot, programming building blocks in kind are chosen to build programmed logic;With suitable volume in kind
Cheng Jimu carrys out splice program;
The characteristics of according to along black line robot, walk to keep it in black line, equipment infrared ray sensor with
Logical relation of the action of robot just like Figure 11:In Robot black line activity, black line has been detected on the left of robot
When, right side also detects that black line, then stops returning detection left side infrared ray again, do not turn left then and return and detect a left side again
Side;Black line is not detected on the left of robot, right side detects that black line is then turned right and returns to detection left side again, does not advance then
And return to detection left side again;It can be realized as that Robot black line is made to walk by this logical relation.This logical relation it is every
One instruction has entity --- the programming instruction building blocks after its corresponding material objectization, will be various according to the logical relation of Figure 12
Programming instruction module is spliced, and it is material objectization program to be formed such as Figure 13.Wherein sensor 1 is the infrared ray on the left of robot
Sensor, sensor 2 are the infrared ray sensor on the right side of robot.
(4) it connects the master control borad in material object programming module and robot and starts the load module in master control borad and material object is compiled
The corresponding programmed logic of journey module is downloaded in master control board memory;
Such as Figure 14, first instruction module is connected with master control borad, and load module is located in main control module, is loaded when pressing
After button, system will BootLoader, then load module is by circuit signal, from the programming mould in kind of first connection
BOB(beginning of block), the unique ID being successively read in each programming module in kind, while the network of programming module in kind read
In connection relation storage to CPU memory.Such as correspondence of the table 1 between ID and instruction.
Table 1
(5) robot is run:The instruction ID that is loaded in CPU recognition memories in master control borad is simultaneously performed according to each instruction
Programmed logic.