CN111258240A - Method and device for controlling holder - Google Patents

Method and device for controlling holder Download PDF

Info

Publication number
CN111258240A
CN111258240A CN201811459431.9A CN201811459431A CN111258240A CN 111258240 A CN111258240 A CN 111258240A CN 201811459431 A CN201811459431 A CN 201811459431A CN 111258240 A CN111258240 A CN 111258240A
Authority
CN
China
Prior art keywords
task
real
time
instruction
message queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811459431.9A
Other languages
Chinese (zh)
Inventor
刘玉林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201811459431.9A priority Critical patent/CN111258240A/en
Publication of CN111258240A publication Critical patent/CN111258240A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25314Modular structure, modules

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Studio Devices (AREA)

Abstract

The application discloses a method and a device for controlling a cloud deck, which can meet different control requirements in the process of controlling the cloud deck loaded with a camera. The method comprises the following steps: after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form; after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished; after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form; and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.

Description

Method and device for controlling holder
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for controlling a pan/tilt head.
Background
The cloud platform camera can be the camera that has the cloud platform, the cloud platform can be equipped with and bear the camera and carry out the rotating device of level and two vertical directions, come control motor through MCU (Microcontroller Unit, little the control Unit) and rotate, thereby drive the cloud platform and rotate, and then can be according to the demand of difference, make the camera carry out image acquisition with a plurality of angles, can also control camera core (for short the core) through MCU, for example the flexible etc. of camera, so as to satisfy different image acquisition demands.
Generally, a control instruction for a pan/tilt head can have two time limit requirements, which can be a real-time instruction immediately executed after receiving the control instruction and a delay instruction executed after waiting for a period of time after receiving the control instruction; different requirements can be made for the priority, for example, a higher priority is required for the control command of the movement, and the like.
In the prior art, a pan-tilt usually executes different tasks in a sequential arrangement manner, that is, as long as a control instruction for the pan-tilt is received, the control instruction is written into a message queue and sequentially executed in sequence, however, some tasks with higher priority cannot be executed in time, and the execution timeliness of other tasks is also influenced for the task requiring time delay. For example, a task with a higher priority can only be queued at the end of a queue, and it is only time for the task to execute after the execution of other tasks is completed, and the task is timed and no other task is executed during the waiting process. Therefore, whether the control on the pan tilt meets different task execution requirements such as time limit and priority becomes an urgent problem to be solved, so a scheme needs to be provided, and different control requirements can be met in the process of controlling the pan tilt with a camera.
Disclosure of Invention
The embodiment of the application provides a method for controlling a pan-tilt, which is used for meeting different control requirements in the process of controlling the pan-tilt loaded with a camera.
In order to solve the above technical problem, the embodiment of the present application is implemented as follows:
the embodiment of the application adopts the following technical scheme:
a method of controlling a pan/tilt head, comprising:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
Preferably, determining a delay instruction for the pan/tilt head includes:
receiving a delay instruction aiming at the holder; or
And generating a delay instruction aiming at the holder according to the preset.
Preferably, after determining the delay instruction for the pan/tilt head, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished, including:
after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction;
and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
Preferably, if the target timing task is a periodic task, after the target timing task is written into the message queue in a real-time task manner, the method further includes:
and resetting the residual time length of the target timing task in the task chain table.
Preferably, the method further comprises:
when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task;
determining whether the pan/tilt head is rotated from the first position sensor to the second position sensor within the expected time interval;
and if the rotating object does not rotate, restarting a motor of the holder, and executing the rotating task again.
The embodiment of the application provides a device for controlling a cloud platform, which is used for meeting different control requirements in the process of controlling the cloud platform loaded with a camera.
An apparatus for controlling a pan/tilt head, comprising: a task writing module, and a task executing module, wherein,
the task writing module is used for:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and the task execution module is used for reading and executing the real-time tasks from the message queue in sequence and deleting the real-time tasks which are successfully executed.
Preferably, the task writing module is specifically configured to:
after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction;
and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
Preferably, the apparatus further comprises a task determining module, configured to:
when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task;
determining whether the pan/tilt head is rotated from the first position sensor to the second position sensor within the expected time interval;
and if the rotating object does not rotate, restarting a motor of the holder, and executing the rotating task again.
According to the technical scheme provided by the embodiment, after the real-time instruction for the pan-tilt is received, the real-time instruction can be written into the last bit in the message queue in the form of a real-time task; after the delay instruction is determined, a timing task can be established, and when the timing is finished, the delay instruction is written into a message queue in a real-time task form; after receiving the priority command, the priority command can be written into the first position in the message queue in a real-time task form, so that the pan-tilt loaded with the camera can sequentially read the tasks in the message queue and execute the tasks in real time. Compared with the prior art that no matter what kind of control instructions with requirements are received, the control instructions are written into the message queue and are executed in sequence, so that the requirements of time limit and priority cannot be met, the embodiment of the application writes the instructions into the message queue in a real-time task mode at a proper time and at a proper position according to different execution requirements, and the pan-tilt does not need to judge the execution requirements of the tasks any more, and can meet different control requirements by executing the instructions in sequence directly.
Drawings
In order to more clearly illustrate the embodiments or prior art solutions of the present application, the drawings needed for describing the embodiments or prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and that other drawings can be obtained by those skilled in the art without inventive exercise.
Fig. 1 is a schematic flowchart of a method for controlling a pan/tilt head according to an embodiment of the present disclosure;
fig. 2 is a hardware structure diagram of a pan-tilt provided in the embodiment of the present application;
FIG. 3 is a diagram illustrating writing a task to a message queue according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating adding a timed task to a task chain table according to an embodiment of the present application;
fig. 5 is a schematic diagram illustrating writing a timing task in a task chain table into a message queue according to an embodiment of the present application;
FIG. 6 is a diagram illustrating a task read from a message queue according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an apparatus for controlling a pan/tilt head according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following embodiments and accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
As mentioned above, in the prior art, the pan-tilt usually performs different tasks in a sequential manner, and as long as a control command for the pan-tilt is received, the control command is written into a message queue and sequentially performed in sequence. For example, if a rotation instruction 1 delayed by 5 seconds is received first, the instruction is written into a message queue, and then a real-time rotation instruction 2 is received, the instruction is written into the message queue, and at this time, the rotation instruction 1 is executed after waiting for 5 seconds, and then the rotation instruction 2 is executed. In practice, however, the motivation for sending the real-time rotation command 2 is to be executed immediately rather than waiting, so that the manner of controlling the pan-tilt head of the prior art cannot meet the requirement of task execution. Based on the defect, the embodiment provides a method for controlling a pan-tilt, which can meet different control requirements in the process of controlling the pan-tilt loaded with a camera. The main execution body of the method can be a holder, and a specific flow diagram of the method is shown in fig. 1 and comprises the following steps:
step 102: and after receiving the real-time instruction aiming at the holder, writing the real-time instruction into the last bit in the message queue of the holder in a real-time task form.
In an actual cradle head control scene, the cradle head can be connected with the client, so that the client can send a control instruction to the cradle head according to a control requirement. The hardware structure of the pan-tilt can be as shown in fig. 2, wherein the main control can be used for receiving the control instruction sent by the client and sending the control instruction to the MCU for execution, specifically, the MCU can drive the horizontal or vertical motor to realize pan-tilt rotation, and can also drive the movement (camera movement) to extend and retract, thereby realizing image zooming and focusing, and determining the angle of the pan-tilt through the position sensor.
Therefore, in this step, the main control in the cradle head can receive real-time instructions, such as a rotation instruction, a motor start instruction, a motor stop instruction, and the like, from the client to the cradle head. The real-time instructions can be executed immediately after the pan-tilt receives the real-time instructions without waiting, so that the received real-time instructions can be written into a message queue of the pan-tilt in a real-time task form, and the pan-tilt can execute the real-time tasks immediately after reading the real-time tasks. Since there may be other real-time tasks in the message queue, the task may be written to the last bit in the message queue, which may be used to temporarily store the task to be executed.
Specifically, the real-time instruction for the pan/tilt head can be received by the main control unit and sent to the MCU, and the real-time instruction is written into the last bit of the message queue of the pan/tilt head by the MCU in the form of a real-time task. As shown in fig. 3, in order to write a task into a message queue, it may be determined whether the message queue of the MCU is full, and if not, the interrupt may be turned off to suspend any operation, so that the MCU may write a real-time task into the message queue efficiently and stably, and after the writing is completed, the interrupt may be turned on to resume a normal operation mode. The interrupt can represent the highest priority, i.e., suspend other operations to efficiently and stably perform the task write operation.
The control instruction for the holder can be of various types, such as a holder rotation instruction, a motor start-stop instruction, a movement zooming instruction and the like. In practical applications, in order to improve the stability of executing instructions and reduce the error rate, different processing programs may be preset for different types of instructions, for example, the processing program 1 may be dedicated to execute a rotation instruction, the processing program 2 may be dedicated to execute a motor instruction, the processing program 3 may be dedicated to execute a zoom instruction of a movement, and the like. In order to further improve the stability of the executed instruction and reduce the error rate, the control instruction may be written into the message queue by the handler corresponding to the type of the instruction and executed by the message queue, that is, for a certain type of control instruction, the control instruction may be written into the message queue by the corresponding handler and executed by the handler. Therefore, in an embodiment, after receiving the real-time command for the pan/tilt head, writing the real-time command to the last bit in the message queue of the pan/tilt head in the form of a real-time task may include: and after receiving the real-time instruction aiming at the holder, writing the real-time instruction into the last bit in the message queue of the holder in a real-time task form by using a processing program corresponding to the type of the real-time instruction.
Step 104: and after the delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into a message queue in a real-time task form when the timing is finished.
As described above, in the prior art, after the pan tilt receives the delay instruction, the delay instruction is written into the message queue, so that the pan tilt can execute the delay instruction, but a manner of waiting for the delay to end and then executing is adopted, so that the execution timeliness of other real-time instructions is affected.
In one embodiment, determining the delay instruction for the pan/tilt head may include: receiving a delay instruction aiming at the holder; or generating a delay instruction aiming at the holder according to the preset. Specifically, the delay instruction may be sent by the client, or may be generated by the cradle head according to a preset setting. For example, the client may send the delay instruction according to different requirements, and the cradle head may generate the control instruction according to preset triggering, specifically, such as regular motor restart, regular focusing, motor hibernation after overheating, and the like, which may be preset and generated by the cradle head itself. The delay instruction may include a one-time delay instruction and may also include a periodic instruction, for example, if the instruction is executed once after 5s, the instruction may belong to a one-time delay instruction, and if the instruction is executed once every 5s, the instruction belongs to a periodic instruction.
In order to reduce interference to the message list, the timing task may be managed by a task chain table, and specifically, in an embodiment, when a delay instruction for the pan/tilt head is determined, the timing task is established, and when the timing is finished, the delay instruction is written into the message chain in a form of a real-time task, which may include: after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction; and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
Further, a task linked list and an idle linked list can be created, the idle linked list can have a plurality of idle task blocks, and each task block can be used for storing a timing task. As shown in fig. 4, for a schematic diagram of adding a timed task to a task linked list, after a delay instruction for a pan-tilt is determined, a task block may be taken out from an idle linked list, and assigned according to a parameter of the timed task and a remaining duration of the timed task, and then the assigned task block may be added to the task linked list, where the task block may be a storage area for storing tasks, and after each task block is occupied by the timed task, it cannot be occupied by other tasks, that is, the idle task block is assigned and added to the task linked list, and cannot be used by other tasks.
As shown in fig. 5, for a schematic diagram of writing a timing task in a task chain table into a message queue, each task block in the task chain table may have a corresponding task parameter and a remaining duration, each task block may be traversed from a head of the task chain table, after each unit time elapses, the remaining duration in each task block is reduced by 1 unit duration, and after a target (timing) task whose remaining duration is 0 occurs, the target task in the task block whose remaining duration is 0 is written into the message queue in a manner of calling a callback function. The assignments in the task block may then be cleared and added to the free-linked list. That is, a plurality of idle task blocks in the idle linked list can add timing tasks in an assignment manner, the assigned task blocks can be added into the task linked list, and after the tasks corresponding to the task blocks in the task linked list are taken out (and written into the message queue), the task blocks which are idle are emptied again, and then the task blocks can be added into the idle linked list again, so that the task blocks can be utilized by other timing tasks again.
As already mentioned above, the timing instruction may be a periodic instruction, so that when assigning values to the task blocks, a periodic flag may also be added. Then, in an embodiment, when the target task is a periodic task, after writing the target timed task into the message queue in a real-time task manner, the method may further include: and resetting the residual time length of the target timing task in the task chain table. Specifically, as shown in fig. 5, after the timed task is written into the message queue in the form of a real-time task by calling the callback function, it may be determined whether periodic execution is required or not, that is, whether the timed task corresponds to a periodic instruction or not, and if so, the remaining duration of the task block may be reset, so as to be executed again in the following. If not, the assignments in the task block may be cleared as described above and added to the free linked list.
As described above, different processing programs may be preset for different types of instructions, and in this step, after determining a delay instruction for the pan/tilt head, a timing task is established, and when the timing is finished, the delay instruction is written into the message queue in the form of a real-time task, which may include: and after the delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into a message queue in a real-time task form by using a processing program corresponding to the type of the delay instruction when the timing is finished.
In this step, the delay instruction is written into the message queue in the form of a real-time task, the delay instruction may be written into the first bit of the message queue in the form of a real-time task so as to be preferentially executed, the delay instruction may be written into the last bit of the message queue in the form of a real-time task so as to be sequentially executed, or the delay instruction may be written into a random bit of the message queue.
Step 106: and after receiving a priority instruction for the pan-tilt, writing the priority instruction into a non-last bit in the message queue in a real-time task mode.
The priority instruction may refer to an instruction with a higher priority, such as a highest priority, a second highest priority, and the like, specifically, a zoom instruction for the movement, or a rotation instruction with a higher priority, and the like. In order to enable the priority command to be preferentially executed so as to meet the requirement on the priority, the priority command can be written into the non-last bit in the message queue in a real-time task form after the priority command for the pan-tilt is received. In particular, the non-last bit may be other orders than the last bit, such as for a highest priority instruction, the first bit of the message queue may be written, for a next highest priority instruction, the second bit of the message queue may be written, and so on.
As already described above, different processing procedures may be preset for different types of instructions, and in this step, after receiving a priority instruction for a pan/tilt head, writing the priority instruction into a non-last bit in a message queue in the form of a real-time task may include: and after receiving a priority instruction for the pan-tilt, writing the priority instruction into a non-last bit in a message queue in a real-time task mode by using a processing program corresponding to the type of the priority instruction.
Step 108: and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
In the foregoing step, the real-time command, the delay command, and the priority command are written into the message queue of the cradle head in the form of a real-time task, so that in this step, the MCU in the cradle head can sequentially read the real-time tasks from the message queue. Because the tasks are all real-time tasks, whether the tasks need to be executed immediately or delayed is not needed to be judged, so that the judging steps are reduced, the probability of task accumulation is reduced, and the probability of errors of the pan-tilt is reduced to a certain extent. As shown in fig. 6, in order to read a task from a message queue, it may be determined whether the message queue of the MCU is empty, and if not, the interrupt may be turned off to suspend any operation, so that the MCU may efficiently and stably read a real-time task from the message queue, and after the reading is completed, the interrupt may be turned on to resume a normal operation mode, and the real-time task may be executed.
When the real-time task is successfully executed, the successfully executed real-time task may be deleted, so as to resume reading from the message queue and executing the remaining tasks. Whether the judgment is successful or not can be judged in various ways, such as reading operation records, or judging according to the rotation result of the holder.
In one embodiment, in order to more accurately determine whether the rotation command is successfully executed, the method may further include: when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task; judging whether the cradle head rotates from the first position sensor to the second position sensor within a preset time interval or not; and if the rotating task does not arrive, restarting a motor of the holder, and executing the rotating task again. Specifically, the rotation angle of the cradle head can be determined through a position sensor in the cradle head, and in practical application, a plurality of position sensors can be provided for judging whether the cradle head is at a required angle, so that when a rotation task is executed, a predicted time interval of a first position sensor and a second position sensor can be determined according to angular velocity and angle parameters in the rotation task, in the execution process, whether the cradle head can rotate from the first position sensor to the second position sensor within the predicted time interval is judged, if the predicted time interval is reached, the rotation task is successfully executed, if the predicted time interval is not reached, the rotation task is failed to be executed, at the moment, a motor of the cradle head can be restarted, and the rotation task is re-executed, so that whether the subsequent re-judgment is successful or not. In practical application, if the number of execution failures exceeds the preset number of failures, a failure prompt may be sent to the client.
As described above, in order to improve the stability of executing instructions and reduce the error rate, different processing programs are usually preset for different types of instructions, and in this step, reading from the message queue, executing real-time tasks, and deleting the real-time tasks that are successfully executed in sequence may include: and sequentially reading the real-time tasks from the message queue, executing the real-time tasks by utilizing the processing program corresponding to the type of the real-time tasks, and deleting the real-time tasks which are successfully executed.
It should be noted that the above steps do not have a fixed sequence, and may be executed at the same time, or may be executed first in steps 102, 104, and 106 and then in step 108, or may be executed first in step 102 and step 104, then in step 108 and then in step 106, and so on.
According to the method provided by the embodiment, after the real-time instruction for the pan-tilt is received, the real-time instruction can be written into the last bit in the message queue in the form of a real-time task; after the delay instruction is determined, a timing task can be established, and when the timing is finished, the delay instruction is written into a message queue in a real-time task form; after receiving the priority command, the priority command can be written into the first position in the message queue in a real-time task form, so that the pan-tilt loaded with the camera can sequentially read the tasks in the message queue and execute the tasks in real time. Compared with the prior art that no matter what kind of control instructions with requirements are received, the control instructions are written into the message queue and are executed in sequence, so that the requirements of time limit and priority cannot be met, the embodiment of the application writes the instructions into the message queue in a real-time task mode at a proper time and at a proper position according to different execution requirements, and the pan-tilt does not need to judge the execution requirements of the tasks any more, and can meet different control requirements by executing the instructions in sequence directly.
Example 2
Based on the same conception, embodiment 2 of the present application provides a device for controlling a pan/tilt, which can meet different control requirements in the process of controlling a pan/tilt loaded with a camera. The schematic structural diagram of the device is shown in fig. 7, and the device comprises: a task writing module 202, and a task executing module 204, wherein,
a task writing module 202 operable to:
after receiving a real-time instruction for the holder, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, a timing task is established, and when the timing is finished, the delay instruction is written into a message queue in a real-time task form;
after receiving a priority instruction for the pan-tilt, writing the priority instruction into a non-last bit in a message queue in a real-time task form;
and the task execution module is used for reading and executing the real-time tasks from the message queue in sequence and deleting the real-time tasks which are successfully executed.
In one embodiment, the task writing module 202 may be configured to:
receiving a delay instruction aiming at the holder; or
And generating a delay instruction aiming at the holder according to the preset.
In one embodiment, the task writing module 202 may be configured to:
after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction;
and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
In one embodiment, the target timed task is a periodic task, then the task write module 202,
can also be used for:
and after the target timing task is written into the message queue in a real-time task mode, resetting the residual time length of the target timing task in the task chain table.
In one embodiment, the apparatus further includes a task determination module operable to:
when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task;
judging whether the holder rotates from the first position sensor to the second position sensor within a preset time interval or not;
and if the rotating shaft does not rotate, restarting a motor of the holder, and executing the rotating task again.
For example, when the device is arranged in the MCU, the device can receive an instruction from the main control (the main control receives the instruction from the client and then sends the instruction to the MCU), and write the instruction into a message queue of the pan-tilt in a real-time task form, so that the device can read and execute the real-time task in the message queue of the MCU. When the tasks are respectively set in the main control and the MCU, the task writing module 202 in the main control may receive an instruction from the client and send the instruction to the MCU, and the task writing module 202 in the MCU may perform the task writing operation.
As can be seen from the apparatus provided in the above embodiment, after receiving the real-time instruction for the pan/tilt head, the real-time instruction may be written to the last bit in the message queue in the form of a real-time task; after the delay instruction is determined, a timing task can be established, and when the timing is finished, the delay instruction is written into a message queue in a real-time task form; after receiving the priority command, the priority command can be written into the first position in the message queue in a real-time task form, so that the pan-tilt loaded with the camera can sequentially read the tasks in the message queue and execute the tasks in real time. Compared with the prior art that no matter what kind of control instructions with requirements are received, the control instructions are written into the message queue and are executed in sequence, so that the requirements of time limit and priority cannot be met, the embodiment of the application writes the instructions into the message queue in a real-time task mode at a proper time and at a proper position according to different execution requirements, and the pan-tilt does not need to judge the execution requirements of the tasks any more, and can meet different control requirements by executing the instructions in sequence directly.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. On the hardware level, the electronic device comprises a processor and optionally an internal bus, a network interface and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (peripheral component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 5, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the device for controlling the holder on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
The method executed by the device for controlling the pan/tilt head according to the embodiment shown in fig. 7 of the present application may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further perform the functions of the apparatus for controlling a pan/tilt head provided in the embodiment shown in fig. 7 in the embodiment shown in fig. 8, which are not described herein again in this embodiment of the present application.
An embodiment of the present application further provides a computer-readable storage medium storing one or more programs, where the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to perform a method performed by an apparatus for controlling a pan/tilt head in the embodiment shown in fig. 7, and are specifically configured to perform:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method of controlling a pan/tilt head, comprising:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
2. The method of claim 1, wherein determining a delay instruction for a pan-tilt comprises:
receiving a delay instruction aiming at the holder; or
And generating a delay instruction aiming at the holder according to the preset.
3. The method of claim 1, wherein establishing a timing task after determining a delay instruction for the pan/tilt head, and writing the delay instruction into the message queue in a real-time task form when timing is over, comprises:
after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction;
and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
4. The method of claim 3, wherein the target timed task is a periodic task, and after writing the target timed task to the message queue in a real-time task, the method further comprises:
and resetting the residual time length of the target timing task in the task chain table.
5. The method of claim 1, further comprising:
when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task;
determining whether the pan/tilt head is rotated from the first position sensor to the second position sensor within the expected time interval;
and if the rotating object does not rotate, restarting a motor of the holder, and executing the rotating task again.
6. A device for controlling a head, comprising: a task writing module, and a task executing module, wherein,
the task writing module is used for:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and the task execution module is used for reading and executing the real-time tasks from the message queue in sequence and deleting the real-time tasks which are successfully executed.
7. The apparatus of claim 6, wherein the task writing module is specifically configured to:
after a delay instruction for the pan-tilt is determined, adding a timing task and corresponding remaining time length in a task chain table according to the delay instruction;
and when a target timing task with the residual time length of zero exists in the task chain table, writing the target timing task into the message queue in a real-time task mode.
8. The apparatus of claim 6, the apparatus further comprising a task determination module to:
when the executed real-time task is a rotating task aiming at the cloud deck, determining a predicted time interval for the cloud deck to rotate from a first position sensor to a second position sensor according to task parameters of the rotating task;
determining whether the pan/tilt head is rotated from the first position sensor to the second position sensor within the expected time interval;
and if the rotating object does not rotate, restarting a motor of the holder, and executing the rotating task again.
9. An electronic device, comprising:
a processor; and
a memory arranged to store computer-executable instructions that, when executed, cause the processor to:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task form;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task form when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a non-last bit in the message queue in a real-time task form;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
10. A computer-readable storage medium storing one or more programs that, when executed by an electronic device including a plurality of application programs, cause the electronic device to:
after a real-time instruction for the holder is received, writing the real-time instruction into the last bit in a message queue of the holder in a real-time task mode;
after a delay instruction for the holder is determined, establishing a timing task, and writing the delay instruction into the message queue in a real-time task mode when the timing is finished;
after a priority instruction for the pan-tilt is received, writing the priority instruction into a first non-last bit in the message queue in a real-time task mode;
and sequentially reading and executing the real-time tasks from the message queue, and deleting the real-time tasks which are successfully executed.
CN201811459431.9A 2018-11-30 2018-11-30 Method and device for controlling holder Pending CN111258240A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811459431.9A CN111258240A (en) 2018-11-30 2018-11-30 Method and device for controlling holder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811459431.9A CN111258240A (en) 2018-11-30 2018-11-30 Method and device for controlling holder

Publications (1)

Publication Number Publication Date
CN111258240A true CN111258240A (en) 2020-06-09

Family

ID=70953676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811459431.9A Pending CN111258240A (en) 2018-11-30 2018-11-30 Method and device for controlling holder

Country Status (1)

Country Link
CN (1) CN111258240A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163442A (en) * 2020-09-29 2021-01-01 杭州海康威视数字技术股份有限公司 Graphic code recognition system, method and device
CN112256647A (en) * 2020-09-29 2021-01-22 上海艾融软件股份有限公司 File processing method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1241752A (en) * 1998-07-15 2000-01-19 北京多思科技工业园股份有限公司 Command control sorting method and device
CN1584757A (en) * 2004-05-21 2005-02-23 杨桂臣 Self-calibrating synchronous timing timer
CN1828541A (en) * 2006-04-07 2006-09-06 浙江大学 Implementation method for timing task in Java operating system
CN201336693Y (en) * 2008-12-08 2009-10-28 内蒙古电子信息职业技术学院 Mobile phone monitoring system and platform therein
CN102299833A (en) * 2010-06-25 2011-12-28 Tcl集团股份有限公司 Intelligent remote household control system and method
CN202404402U (en) * 2011-12-23 2012-08-29 航天时代电子技术股份有限公司 Parameter programmable delay relay based on bus command
CN105929851A (en) * 2016-04-07 2016-09-07 广州盈可视电子科技有限公司 Method and device for controlling Pan-Tilt device by using rocking bar equipment
CN108780331A (en) * 2017-12-21 2018-11-09 深圳市大疆创新科技有限公司 Cloud platform control method and equipment, holder and unmanned plane

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1241752A (en) * 1998-07-15 2000-01-19 北京多思科技工业园股份有限公司 Command control sorting method and device
CN1584757A (en) * 2004-05-21 2005-02-23 杨桂臣 Self-calibrating synchronous timing timer
CN1828541A (en) * 2006-04-07 2006-09-06 浙江大学 Implementation method for timing task in Java operating system
CN201336693Y (en) * 2008-12-08 2009-10-28 内蒙古电子信息职业技术学院 Mobile phone monitoring system and platform therein
CN102299833A (en) * 2010-06-25 2011-12-28 Tcl集团股份有限公司 Intelligent remote household control system and method
CN202404402U (en) * 2011-12-23 2012-08-29 航天时代电子技术股份有限公司 Parameter programmable delay relay based on bus command
CN105929851A (en) * 2016-04-07 2016-09-07 广州盈可视电子科技有限公司 Method and device for controlling Pan-Tilt device by using rocking bar equipment
CN108780331A (en) * 2017-12-21 2018-11-09 深圳市大疆创新科技有限公司 Cloud platform control method and equipment, holder and unmanned plane

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163442A (en) * 2020-09-29 2021-01-01 杭州海康威视数字技术股份有限公司 Graphic code recognition system, method and device
CN112256647A (en) * 2020-09-29 2021-01-22 上海艾融软件股份有限公司 File processing method and device
CN112163442B (en) * 2020-09-29 2022-05-06 杭州海康威视数字技术股份有限公司 Graphic code recognition system, method and device
CN112256647B (en) * 2020-09-29 2022-12-09 上海艾融软件股份有限公司 File processing method and device

Similar Documents

Publication Publication Date Title
KR102340223B1 (en) Blockchain consensus method and device
CN109064327B (en) Intelligent contract processing method, device and equipment
JP6876806B2 (en) Blockchain Consensus Formation Methods and Devices
RU2735156C1 (en) Method and device for sending transaction information and for checking consensus
CN110659988B (en) Parallel processing method and device for block chain consensus and execution and electronic equipment
CN110648136B (en) Consensus and transaction synchronous parallel processing method and device and electronic equipment
JP2009087332A (en) Apparatus, system, method and program for collecting dump data
CN109379299B (en) Method, device and system for limiting data flow
CN109033814B (en) Intelligent contract triggering method, device, equipment and storage medium
CN111258240A (en) Method and device for controlling holder
CN109582398B (en) State processing method and device and electronic equipment
EP3933639B1 (en) Transaction processing method, apparatus, and electronic device for blockchain
CN109634989B (en) HIVE task execution engine selection method and system
CN108108126B (en) Data processing method, device and equipment
CN111682981A (en) Check point interval setting method and device based on cloud platform performance
CN110648125B (en) Packaging transaction method and device, electronic equipment and storage medium
CN108829498B (en) Service data access method and device
CN111882322A (en) Method and device for packaging transactions in sequence and electronic equipment
CN111694639A (en) Method and device for updating address of process container and electronic equipment
CN110764930A (en) Request or response processing method and device based on message mode
CN110308934B (en) HPET driving method and device, readable storage medium and electronic equipment
CN111831408A (en) Asynchronous task processing method and device, electronic equipment and medium
WO2014101892A1 (en) Resource adjustment method and device
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN111080447B (en) Rotation method and system for neutral node in block chain system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200609