Method for planning mechanical arm task based on HTN planning
1. A method for planning a task of a mechanical arm based on HTN planning is characterized by comprising the following steps:
establishing a basic task transfer network according to a preset execution logic between basic tasks and a preset basic task library, wherein the basic tasks refer to tasks executed by a mechanical arm once;
determining initial state information and target state information of a mechanical arm, and establishing an initial task planning network according to the initial state information and the target state information, wherein the initial task planning network comprises basic tasks and non-basic tasks;
decomposing the non-basic tasks layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, wherein the basic task sequence is composed of multiple layers of basic tasks;
and updating the initial task planning network according to the basic task sequence to obtain an updated task planning network, wherein the updated task planning network is a layered task network.
2. The method of claim 1, wherein prior to updating the initial mission plan network according to the base sequence of tasks, further comprising:
determining at least one accompanying event corresponding to each basic task in the basic task sequence, wherein the accompanying event refers to an event which occurs concomitantly in the process of executing the basic task;
binding the at least one accompanying event with the corresponding basic task according to a preset time sequence logic between the accompanying events and the basic task to obtain a bound basic task;
and updating the basic task sequence according to the bound basic task to obtain an updated basic task sequence.
3. The method of claim 2, wherein before updating the base task sequence according to the bound base task, further comprising:
determining a first time interval for executing the basic tasks in the bound basic tasks according to a preset time sequence relation between the basic tasks, and determining a second time interval for executing each accompanying event according to a preset time sequence relation between accompanying times;
judging whether a conflict exists between the first time interval and the second time interval;
and if so, adjusting and optimizing the bound basic task according to a preset adjusting and optimizing rule.
4. The method of claim 3, wherein the preset tuning optimization rules comprise:
adjusting the first time interval or adjusting the second time interval until no conflict exists between the adjusted first time interval and the second time interval; or
Adjusting an execution logic relationship between the base task and the companion event until no conflict exists.
5. The method of claim 4, wherein after updating the base task sequence according to the bound base task, further comprising:
determining a third time interval corresponding to the bound basic task according to the adjusted first time interval and the adjusted second time interval;
judging whether a third time interval corresponding to any two adjacent bound basic tasks has conflict or not;
and if so, adjusting the third time interval until no conflict exists between the third time intervals corresponding to any two adjacent bound basic tasks.
6. The method of claim 5, wherein updating the initial mission plan network according to the base mission sequence comprises:
determining a fourth time interval of the mechanical arm movement according to the adjusted third time interval;
determining motion state information of a component related to the motion of the mechanical arm in the fourth time interval, wherein the component comprises a solar panel, an antenna or a movable cabin section;
and determining a collision-free space corresponding to the mechanical arm according to the fourth time interval and the motion state information, and updating the initial task planning network according to the collision-free space and the basic task sequence.
7. The method according to any one of claims 1 to 6, wherein decomposing the non-base task layer by layer based on a hierarchical task network planner HTN and the base task transfer network to obtain a base task sequence comprises:
determining an initial state and a target state corresponding to the non-basic task, searching layer by layer in the basic task transfer network according to the HTN, the initial state and the target state, determining a plurality of basic tasks transferred from the initial state to the target state, and obtaining the basic task sequence according to the plurality of basic tasks.
Background
The space station mechanical arm is the most main extravehicular movable part in the space station construction and in-orbit operation processes, has integrated space sensing, maneuvering and operating capabilities, can undertake space station tasks of in-orbit assembly, observation and inspection, fault module replacement, in-orbit filling, consumed load replacement and supplement, orbit cleaning, orbit transfer and the like of a spacecraft in an in-orbit operation mode, ground teleoperation mode or autonomous operation mode, and can assist a spacecraft in going out of a cabin to carry out remote transportation on the spacecraft and finish various extravehicular tasks.
Because the space station mechanical arm executes a plurality of types of tasks and the conversion between different tasks is complex, in order to facilitate the mechanical arm to convert between different tasks, the tasks of the mechanical arm generally need to be planned, and the task planning of the mechanical arm is not only related to target task information but also related to environmental information. At present, the traditional mechanical arm task planning has few interference factors, and is generally researched under the background of structured application environment and deterministic tasks, the mechanical arm generally executes tasks according to a planned sequence, but the mechanical arm mainly works in a place with high dynamic and flexibility, and not only the task planning needs to be considered in the task planning process, but also the reasonable planning needs to be performed by combining with the actual environment. Therefore, the prior art has poor flexibility in the task planning of the mechanical arm.
Disclosure of Invention
The technical problem that this application was solved is: aiming at the problem that the flexibility of the task planning of the mechanical arm in the prior art is poor. According to the scheme provided by the embodiment of the application, the task planning is carried out on the mechanical arm through the hierarchical network planner HTN, the task of the mechanical arm can be planned in real time according to the actual situation, the flexibility of the task planning is improved, and the task planning is more suitable for the actual situation.
In a first aspect, an embodiment of the present application provides a method for planning a task of a mechanical arm based on HTN planning, where the method includes:
establishing a basic task transfer network according to a preset execution logic between basic tasks and a preset basic task library, wherein the basic tasks refer to tasks executed by a mechanical arm once;
determining initial state information and target state information of a mechanical arm, and establishing an initial task planning network according to the initial state information and the target state information, wherein the initial task planning network comprises basic tasks and non-basic tasks;
decomposing the non-basic tasks layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, wherein the basic task sequence is composed of multiple layers of basic tasks;
and updating the initial task planning network according to the basic task sequence to obtain an updated task planning network, wherein the updated task planning network is a layered task network.
In the scheme provided by the embodiment of the application, a basic task transfer network is established according to the preset execution logic between basic tasks and the preset basic task library, then determining initial state information and target state information of the mechanical arm, establishing an initial task planning network according to the initial state information and the target state information, then decomposing the non-basic tasks layer by layer based on a layered task network planner HTN and the basic task transfer network to obtain a basic task sequence, updating the initial task planning network according to the basic task sequence to obtain an updated task planning network, therefore, the task planning is carried out on the mechanical arm through the hierarchical network planner HTN, the task of the mechanical arm can be planned in real time according to the actual situation, the flexibility of the task planning is improved, and the task planning is more suitable for the actual situation.
Optionally, before updating the initial mission planning network according to the basic mission sequence, the method further includes:
determining at least one accompanying event corresponding to each basic task in the basic task sequence, wherein the accompanying event refers to an event which occurs concomitantly in the process of executing the basic task;
binding the at least one accompanying event with the corresponding basic task according to a preset time sequence logic between the accompanying events and the basic task to obtain a bound basic task;
and updating the basic task sequence according to the bound basic task to obtain an updated basic task sequence.
Optionally, before updating the basic task sequence according to the bound basic task, the method further includes:
determining a first time interval for executing the basic tasks in the bound basic tasks according to a preset time sequence relation between the basic tasks, and determining a second time interval for executing each accompanying event according to a preset time sequence relation between accompanying times;
judging whether a conflict exists between the first time interval and the second time interval;
and if so, adjusting and optimizing the bound basic task according to a preset adjusting and optimizing rule.
Optionally, the preset adjustment optimization rule includes:
adjusting the first time interval or adjusting the second time interval until no conflict exists between the adjusted first time interval and the second time interval; or
Adjusting an execution logic relationship between the base task and the companion event until no conflict exists.
Optionally, after updating the basic task sequence according to the bound basic task, the method further includes:
determining a third time interval corresponding to the bound basic task according to the adjusted first time interval and the adjusted second time interval;
judging whether a third time interval corresponding to any two adjacent bound basic tasks has conflict or not;
and if so, adjusting the third time interval until no conflict exists between the third time intervals corresponding to any two adjacent bound basic tasks.
Optionally, updating the initial mission planning network according to the basic mission sequence includes:
determining a fourth time interval of the mechanical arm movement according to the adjusted third time interval;
determining motion state information of a component related to the motion of the mechanical arm in the fourth time interval, wherein the component comprises a solar panel, an antenna or a movable cabin section;
and determining a collision-free space corresponding to the mechanical arm according to the fourth time interval and the motion state information, and updating the initial task planning network according to the collision-free space and the basic task sequence.
Optionally, decomposing the non-basic task layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, including:
determining an initial state and a target state corresponding to the non-basic task, searching layer by layer in the basic task transfer network according to the HTN, the initial state and the target state, determining a plurality of basic tasks transferred from the initial state to the target state, and obtaining the basic task sequence according to the plurality of basic tasks.
In a second aspect, an embodiment of the present application provides an apparatus for task planning of a mechanical arm based on HTN planning, where the apparatus includes:
the system comprises an establishing unit, a task processing unit and a task processing unit, wherein the establishing unit is used for establishing a basic task transfer network according to a preset execution logic between basic tasks and a preset basic task library, and the basic tasks refer to tasks executed by a mechanical arm once;
the system comprises a determining unit, a task planning unit and a task planning unit, wherein the determining unit is used for determining initial state information and target state information of the mechanical arm and establishing an initial task planning network according to the initial state information and the target state information, and the initial task planning network comprises basic tasks and non-basic tasks;
the decomposition unit is used for decomposing the non-basic tasks layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, wherein the basic task sequence is composed of multiple layers of basic tasks;
and the updating unit is used for updating the initial task planning network according to the basic task sequences and the execution time sequence of each basic task sequence to obtain an updated task planning network, wherein the updated task planning network is a layered task network.
Optionally, the determining unit is further configured to: determining at least one accompanying event corresponding to each basic task in the basic task sequence, wherein the accompanying event refers to an event which occurs concomitantly in the process of executing the basic task; binding the at least one accompanying event with the corresponding basic task according to a preset time sequence logic between the accompanying events and the basic task to obtain a bound basic task; and updating the basic task sequence according to the bound basic task to obtain an updated basic task sequence.
Optionally, the determining unit is further configured to: determining a first time interval for executing the basic tasks in the bound basic tasks according to a preset time sequence relation between the basic tasks, and determining a second time interval for executing each accompanying event according to a preset time sequence relation between accompanying times; judging whether a conflict exists between the first time interval and the second time interval; and if so, adjusting and optimizing the bound basic task according to a preset adjusting and optimizing rule.
Optionally, the preset adjustment optimization rule includes: adjusting the first time interval or adjusting the second time interval until no conflict exists between the adjusted first time interval and the second time interval; or adjusting the execution logic relationship between the base task and the companion event until no conflict exists.
Optionally, the determining unit is further configured to: determining a third time interval corresponding to the bound basic task according to the adjusted first time interval and the adjusted second time interval; judging whether a third time interval corresponding to any two adjacent bound basic tasks has conflict or not; and if so, adjusting the third time interval until no conflict exists between the third time intervals corresponding to any two adjacent bound basic tasks.
Optionally, the updating unit is specifically configured to: determining a fourth time interval of the mechanical arm movement according to the adjusted third time interval; determining motion state information of a component related to the motion of the mechanical arm in the fourth time interval, wherein the component comprises a solar panel, an antenna or a movable cabin section; and determining a collision-free space corresponding to the mechanical arm according to the fourth time interval and the motion state information, and updating the initial task planning network according to the collision-free space and the basic task sequence.
Optionally, the decomposition unit is specifically configured to: determining an initial state and a target state corresponding to the non-basic task, searching layer by layer in the basic task transfer network according to the HTN, the initial state and the target state, determining a plurality of basic tasks transferred from the initial state to the target state, and obtaining the basic task sequence according to the plurality of basic tasks.
In a third aspect, the present application provides a computer device, comprising:
a memory for storing instructions for execution by at least one processor;
a processor for executing instructions stored in a memory to perform the method of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon computer instructions which, when run on a computer, cause the computer to perform the method of the first aspect.
Drawings
Fig. 1 is a schematic flowchart of a method for task planning of a robot arm based on HTN planning according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a basic task transfer network according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an apparatus for task planning of a robot arm based on HTN planning according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In the solutions provided in the embodiments of the present application, the described embodiments are only a part 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.
In order to better understand the technical solutions, the technical solutions of the present application are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features in the embodiments and examples of the present application are detailed descriptions of the technical solutions of the present application, and are not limitations of the technical solutions of the present application, and the technical features in the embodiments and examples of the present application may be combined with each other without conflict.
The method for mechanical arm task planning based on HTN planning provided in the embodiments of the present application is described in further detail below with reference to the accompanying drawings, and a specific implementation manner of the method may include the following steps (a flow of the method is shown in fig. 1):
step 101, establishing a basic task transfer network according to a preset execution logic between basic tasks and a preset basic task library, wherein the basic tasks refer to tasks executed by a mechanical arm once.
Specifically, in the scheme provided in the embodiment of the present application, the basic task transfer network refers to a relationship network for transferring basic tasks. For example, referring to fig. 2, a schematic structural diagram of a basic task transfer network provided in an embodiment of the present application is shown. In fig. 2, the basic tasks include Base, AdptA, AdptB, AdptC, TV, MV, EMM, OM, and EM, wherein the Base task Base can be transferred to AdptA and AdptC, mutual transfer between AdptA and AdptB, mutual transfer between AdptA and AdptC, mutual transfer between AdptB and EMM, mutual transfer between AdptB and OM, and mutual transfer between AdptB and EM, MV, and TV.
Step 102, determining initial state information and target state information of the mechanical arm, and establishing an initial task planning network according to the initial state information and the target state information, wherein the initial task planning network comprises basic tasks and non-basic tasks.
Specifically, the initial state information refers to a state presented before the mechanical arm executes the task to be executed, and the target state information refers to a state presented after the mechanical arm executes the task to be executed.
And 103, decomposing the non-basic tasks layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, wherein the basic task sequence is composed of multiple layers of basic tasks.
Specifically, in the solution provided in the embodiment of the present application, there are various ways of decomposing the non-basic task layer by layer based on the hierarchical task network planner HTN and the basic task transfer network to obtain the basic task sequence, and a preferred way is taken as an example for description below.
In a possible implementation manner, decomposing the non-basic task layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence includes: determining an initial state and a target state corresponding to the non-basic task, searching layer by layer in the basic task transfer network according to the HTN, the initial state and the target state, and determining a transfer path from the initial state to the target state; and decomposing the non-basic task according to the transfer path to obtain the basic task sequence.
For ease of understanding, the principles of the hierarchical task network planner (HTN) are briefly introduced below.
The description of the tasks by the HTN planner is divided into 3 types, namely a basic task, a target task and a compound task, wherein the basic task refers to the task which can be directly completed by the mechanical arm through a preset action, the target task and the compound task refer to the task which can not be directly completed by the mechanical arm through the preset action, and the target task and the compound task are both called non-basic tasks.
The HTN planner represents a planning problem in terms of the following triplets:
<S,T,D>
wherein, S is a task initial state and represents the state of the system when planning starts; t represents an initial task network for completing the target task, the initial task network comprises a composite task and a basic task which are in sequential logic relation,k represents the number of subtasks in the initial task network,representing a set of constraints; d is domain knowledge.
Further, D is represented in the HTN planner by the following doublet:
D=<OP,Me>
wherein OP represents a basic task library, and OP ═ O1,O2,…,On) (ii) a Me denotes a method library for decomposing a compound task into basic tasks, Me ═ (e)1,e2,…,em)。
Further, different tasks in the HTN planner are connected by a task network, which is a combination of tasks and task constraints, for example, assuming that there are k tasks in the task network, the task network is represented as follows:
T=((n1:α1),…,(nk:αk),φ)
wherein T represents a task network; alpha is alphakRepresents the kth task; n iskA tag representing a kth task; phi denotes a set of constraints.
Specifically, in the solution provided in the embodiment of the present application, there are various ways to determine the planning field of the HTN plan, and a preferred way is described as an example below.
In one possible implementation, determining a planning domain for hierarchical task network planner HTN planning includes: acquiring environment state information in real time, wherein the environment state information comprises first position and posture information and grabbing state information of the mechanical arm end effector and second position and posture information of at least one object in the environment; judging whether the environmental state information meets the preset precondition for reaching the target task; if so, transforming the environment state information to obtain transformed environment state information, and obtaining an operator set according to the transformed environment state information, wherein the operator set is used for representing the relationship between the basic task and the environment state information; and determining the planning domain according to the calculation set and the input method set.
Further, in a possible implementation manner, the determining whether the environmental status information satisfies a preset precondition for reaching the target task includes: expressing the environment state information in a matrix form, performing AND operation on the environment state information and a preset condition mask matrix to obtain a first calculation result, and performing AND operation on the condition mask matrix and a preset condition matrix of operator influence effect to obtain a second calculation result; and judging whether the first calculation result is equal to the second calculation result.
Further, in a possible implementation manner, the anding the environment state information with a preset conditional mask matrix to obtain a first calculation result includes:
obtaining the first calculation result according to the following formula:
Q=S&M
wherein Q represents a first calculation result; s represents the environmental state information; m denotes a preset conditional mask matrix,
in a possible implementation manner, transforming the environmental status information to obtain transformed environmental status information includes:
obtaining the transformed environmental status information according to the following formula:
wherein S isnewRepresenting the transformed environment state information, and S' represents a condition matrix of the preset operator influence effect;representing the matrix resulting from the inversion of the M matrix.
Specifically, in the solution provided in the embodiment of the present application, the HTN planner only analyzes the logical relationship before and after the object is operated in the environment in the task profile analysis layer without considering the shape and size of the object, so that the object in the environment is abstracted into an operation interface vector, the pose at the end of the mechanical arm matches with the object interface vector to operate the object, and the movement of the object is abstracted into the change of the interface vector.
For example, if there are 1 arm, k objects in the environment, the environment state information S can be expressed as:
wherein S is0Representing first attitude information and grasping state information of the robot arm end effector in a Cartesian coordinate system, S1,…,SkThe second pose information representing k objects in a Cartesian coordinate system; Θ ═ x y z α β γ]TRepresenting pose information, Θ, of a robot arm or an object in a Cartesian coordinate system0First position information representative of the robotic arm end effector; theta1,…,ΘkThe second attitude information representing K objects in a Cartesian coordinate system; g ═ g0,…,gk]Indicating the state of the robot arm gripping the object.
Further, there are two cases for g:
1) when the mechanical arm is in an unloaded state, g is equal to 0, namely g0,…,gkEach of which is 0.
2) The mechanical arm holds the ith object, then g0=1,g0,…,gkMiddle only giEach of the other items is 0.
Further, a preset conditional mask matrix is defined And defining a condition matrix S' of preset operator influence effect. Before and after a certain task is executed, whether the current environment state reaches the precondition or the target state of the task needs to be judged, the target state usually only focuses on certain objects in the environment or certain specific attributes of the objects, and the values of other parameters are not restricted. And judging whether the environmental state information meets the preset precondition for reaching the target task or not according to the current environmental state information S, the condition state S' and the condition mask matrix M. If S'&M=S&M, determining that the current environment state information meets the preset precondition for reaching the target task, and if the current environment state information meets the preset precondition for reaching the target task, judging whether the current environment state information meets the preset precondition for reaching the target task or notIf the element is 0, the corresponding element in S is 0, and if the element in M is 1, the corresponding element in S is unchanged; otherwise, determining that the current environment state information does not meet the preset precondition for reaching the target task. And if the current environment state information meets the preset precondition for reaching the target task, carrying out conversion processing on the current environment state information.
And 104, updating the initial task planning network according to the basic task sequence to obtain an updated task planning network, wherein the updated task planning network is a layered task network.
Specifically, after the non-basic task is decomposed layer by layer based on the hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, the initial task planning network needs to be updated according to the basic task sequence.
In a possible implementation manner, before updating the initial mission planning network according to the basic task sequences and the execution timing of each basic task sequence, the method further includes: determining at least one accompanying event corresponding to each basic task in the basic task sequence, wherein the accompanying event refers to an event which occurs concomitantly in the process of executing the basic task; binding the at least one accompanying event with the corresponding basic task according to a preset time sequence logic between the accompanying events and the basic task to obtain a bound basic task; and updating the basic task sequence according to the bound basic task to obtain an updated basic task sequence.
Further, in a possible implementation manner, before updating the basic task sequence according to the bound basic task, the method further includes: determining a first time interval for executing the basic tasks in the bound basic tasks according to a preset time sequence relation between the basic tasks, and determining a second time interval for executing each accompanying event according to a preset time sequence relation between accompanying times; judging whether a conflict exists between the first time interval and the second time interval; and if so, adjusting and optimizing the bound basic task according to a preset adjusting and optimizing rule.
Further, in a possible implementation manner, the preset adjustment optimization rule includes: adjusting the first time interval or adjusting the second time interval until no conflict exists between the adjusted first time interval and the second time interval; or adjusting the execution logic relationship between the base task and the companion event until no conflict exists.
Further, in a possible implementation manner, after updating the basic task sequence according to the bound basic task, the method includes: determining a third time interval corresponding to the bound basic task according to the adjusted first time interval and the adjusted second time interval; judging whether a third time interval corresponding to any two adjacent bound basic tasks has conflict or not; and if so, adjusting the third time interval until no conflict exists between the third time intervals corresponding to any two adjacent bound basic tasks.
In the solution provided in the embodiment of the present application, there are various ways to update the initial task planning network according to the basic task sequence, and a preferred way is taken as an example for description below.
In one possible implementation, updating the initial mission plan network according to the basic mission sequence includes: determining a fourth time interval of the mechanical arm movement according to the adjusted third time interval; determining motion state information of a component related to the motion of the mechanical arm in the fourth time interval, wherein the component comprises a solar panel, an antenna or a movable cabin section; and determining a collision-free space corresponding to the mechanical arm according to the fourth time interval and the motion state information, and updating the initial task planning network according to the collision-free space and the basic task sequence.
Specifically, the robot arm generally performs tasks in a serial manner, and the planning problem is sequential, so the task profile analysis is essentially the task simplification and conflict handling strategy planning process. To facilitate understanding of the robotic arm task profile analysis process, the following steps of task profile analysis are briefly described.
Step 1, extracting tasks from an initial task planning network in sequence;
step 2, if the task is a non-basic task, searching a corresponding Me in the planning domain and replacing the non-basic task, and searching a method of Me, namely comparing an effect mask of the task with effect masks of all tasks in a Me set, if the 1 item of the latter contains the former, the Me can be used for simplifying the task, and the step 1 is switched;
and step 3: comparing the current environment state information with the task post condition, and deleting the task from the task network if the current state accords with the task post condition and indicates that the task does not need to be executed;
step 4, if the current environment state information meets the precondition of the task, refreshing the current state by utilizing the post condition of the task operator, and turning to the step 1;
step 5, if the current state can not meet the precondition of the task, searching the task which can meet the precondition in the planning domain, and adding the task;
step 6, updating and simplifying the initial task planning network to obtain an updated task planning network
To facilitate understanding of the above-described mission planning simulation process, a brief description thereof follows.
In the scheme provided by the embodiment of the application, a modular mechanical arm is taken as an object, and a task planning process implementation example is introduced. The eight-degree-of-freedom modular mechanical arm is used as an object, 8 degrees of freedom of the whole arm are composed of 8 modular rotating joints, and the tail end of the whole arm is an integrated clamp holder. The parameters of the robot arm are shown in table 1.
TABLE 1
In particular, alphai(rad) denotes along XiAxis from ZiThe shaft being rotated to Zi+1The angle of (d); a isi(mm) denotes an edge XiAxis from ZiMovement of the shaft to Zi+1The distance of (d); thetai(rad) denotes along ZiAxis from Xi-1The shaft being rotated to XiThe angle of (d); di(mm) denotes along ZiAxis from Xi-1The shaft being moved to XiThe distance of (c).
Specifically, the environment of the simulation process is set as follows: the object in the environment comprises a mechanical arm M, a spherical barrier O with the radius of 50mm and an operated object X, wherein the initial position of the barrier O is E (t is 0) [ -0.59M, 0.52M, 0.315M [ -0.59M [ ]]The speed of the obstacle O doing uniform linear motion along the-y axis is 6mm/s, and the position of the obstacle O after 10s is E (t is 10) [ -0.59m, 0.46m, 0.315m [ -0.59m [ ]]. The operation interface position information with the initial condition of X is a [ -0.59m, 0.45m, 0.18m, 127.92 °, -79.65 °, -177.88 ° ]]TThe initial configuration of M is [16 °, 18.1 °, 67.6 °, 56.2 °, 21.9 °, -29.5 °, -41.4 °, 0 ° ]]T(ii) a The planning domain of the task planner includes three basic task operators, and a "transfer" compound task, which is expressed as follows:
(trans(x,v,t),(n1:do[capture(x),t],n2:do[move(v),t],
n3:do[release(x),t],(n1,n2,n3)),noncontact(O))
where trans (X, v, t) denotes moving the object X from the current position to the position v using t times, and X and v and t denote arguments. n is1,n2,n3Three task networks are represented.
noncontact (O) is a constraint indicating that the robot arm cannot collide with the obstacle O. The task target is designed to transfer X to the position C [ -0.59m, 0.55m, 0.18m, 127.92 °, -79.65 °, -177.88 °]T。
The basic task library of the mechanical arm is as follows: (move (A), move (C), move (U), move (V)). Wherein, U [ -0.59m, 0.58m, 0.18m, 127.92 °, -79.65 °, -177.88 ° ]]T,V=[-0.59m,0.45m,0.45m,127.92°,-79.65°,-177.88°]T。
The basic task transfer network of the mechanical arm comprises a basic task move (U) to move (A), a move (V) to move (A) and a move (A) to move (C).
In accordance with the task requirements described above, the target task network may be described as (achieve (trans (X, C))) having end effector coordinates B [ -0.59M, 0.58M, 0.45M, 127.92 °, -79.65 °, -177.88 ° -calculated by spatial robotic arm kinematics positive solution according to the initial configuration of the robotic arm M]T. Thus, the environment initial state is
If the target task network only contains one task and is not a basic task, searching the corresponding Me in the planning domain, namely replacing trans (X, C, t) by the following formula:
((n1:do[capture(X),t1],n2:do[move(C),t2],
n3:do[release(X),t3],(n1,n2,n3)),noncontact(O))
then, traverse the task network again, n1For basic tasks, the state criterion is used for comparing the current state with the precondition of a capture (X) operator:mask with inconsistent state isWherein I ═ 0, 1, 1, 0, 0, 0]TThen, the planning field [ move (A) ], t ═ 10s is searched]The operator can eliminate the difference between the current state and the capture (X) precondition.
Further, the minimum distance between the mechanical arm and the obstacle O in the move (a) executing process is calculated to be 24.2m and smaller than the radius 50m of the obstacle O, that is, the constraint condition is not met, and the planning field needs to be retrieved again [ move (v), t ═ 10s]And [ move (A) ]t 10s]The combining operator can eliminate the current state from before capture (X)Setting the difference between the conditions, and calculating to obtain that the minimum distance between the mechanical arm and the obstacle O in the motion process is 135m and is larger than the radius of 50m of the obstacle O, namely the minimum distance meets the constraint condition at the moment, so n in the task network1Preceding by n4:do[move(V),t4]And n5:do[move(A),t5],t4=10s,t510 s. -verifying. The task network constraints become simultaneously: (n)4,n5,n1,n2,n3). Finally, the task network is traversed again, and the initial stateWarp n4And n5Operator conversion toWarp n1Operator conversion toWarp n2Operator conversion toWarp n3Operator conversion to
So far, the task network has no conflict any more, and the basic task sequence given by the planner is as follows: move (V) → move (A) → capture (X) → move (C). After the row of the basic task release (X) is performed, the object X is successfully transferred to C.
Further, in order to facilitate understanding of accompanying events and a sequential reasoning process in the solution provided in the embodiment of the present application, a process of sequential reasoning for a crawling task of a spatial robot is briefly introduced below with respect to the spatial robot.
The crawling task planning takes the crawling motion of the mechanical arm as a main line, and takes the occupation relationship of events, actions and related resources of other objects as accompanying events. The events of other objects comprise camera operation, holder operation, sensor operation, motor operation and other events; the motions of other objects comprise motions such as camera pan-tilt motion; the related resources include resources such as an available channel interval. Meanwhile, the mechanical arm needs to be ensured to move without collision with moving parts such as a solar panel, an antenna, a movable cabin section and the like.
The starting time and the ending time of the crawling mission plan must be within the range of the available channel interval. The known available channel interval is ts1=0s,te1=100s]、[ts2=200s,te2=300s]And [ ts3=350s,te3=550s]First, the starting time of crawling task planning is determined as ts1。
The starting time of the mechanical arm to execute the crawling motion must be after the completion of the execution of events such as camera preparation, pan-tilt preparation, sensor preparation and motor preparation. Time of camera preparation is t1The time for the pan/tilt head preparation is t 10s2The time for sensor preparation is t 10s3The time for motor preparation is t 10s4When the crawling motion is performed by the mechanical arm, the starting time t is 10ss1+t1+t2+t3+t4=40s。
The basic task sequence of the robot arm crawling motion given by the task planner is move (a) → move (b) → move (c). Wherein the move (A) duration is ta40s, move (B) duration tb60s, move (C) duration tc=60s。
The moment when the mechanical arm finishes move (A) is ts1+t1+t2+t3+t4+ta<te1The time constraint for the first interval of the available channels is satisfied for 100 s. Meanwhile, the mechanical arm is verified to have no collision with moving parts such as a solar panel, an antenna, a movable cabin section and the like in the move (A) executing process.
The mechanical arm continues to execute move (B), and the time when the move (B) is finished is ts1+t1+t2+t3+t4+ta+tb=140s>te1And if the time constraint of the first interval of the available channel is not met, adjusting the time interval of the mechanical arm for executing move (B) to be the second interval of the available channel.The time sequences of the mechanical arms move (A) and move (B) are discontinuous, the mechanical arms are required to be set in a standby state with the lowest power consumption, and the standby time of the camera is t5The stand-by time of the tripod head is t 2s6The standby time of the sensor is t 2s7The standby time of the motor is t 2s82 s. The moment when the mechanical arm completes move (A) and the accompanying event is ts1+t1+t2+t3+t4+ta+t5+t6+t7+t8=88s<te1The time constraint of the first interval of the available channels is satisfied.
Before the mechanical arm continues to execute move (B), the mechanical arm needs to be set in a normal working state, and the restart time of the camera is t9The restart time of the tripod head is t 2s10The sensor is restarted for a time t of 2s11The restart time of the motor is t 2s122 s. The starting time of the mechanical arm to execute move (B) is ts2+t9+t10+t11+t12At 208s, t is the time when move (B) is completeds2+t9+t10+t11+t12+tb=268s<te2And satisfying the time constraint of the second interval of the available channels. Meanwhile, the mechanical arm is verified to have no collision with moving parts such as a solar panel, an antenna, a movable cabin section and the like in the move (B) executing process.
The mechanical arm continues to execute move (C), and the time when the move (C) is finished is ts2+t9+t10+t11+t12+tb+tc=328s>te2And if the time constraint of the second interval of the available channel is not met, adjusting the time interval of the mechanical arm for executing move (C) to be the third interval of the available channel. The time sequences of the mechanical arms move (B) and move (C) are discontinuous, the mechanical arms are required to be set in a standby state with the lowest power consumption, and the time when the mechanical arms finish move (B) and the accompanying events is ts2+t9+t10+t11+t12+tb+t5+t6+t7+t8=276s<te1And satisfying the time constraint of the second interval of the available channels.
Before the mechanical arm continues to execute move (C), the mechanical arm needs to be set in a normal working state, and the starting time of the mechanical arm executing move (C) is ts3+t9+t10+t11+t12At 358s, t is the time point when move (C) is completeds3+t9+t10+t11+t12+tc=418s<te3The time constraint of the third interval of the available channel is satisfied, but the time interval [ t ] of the mechanical arm executing move (C)s3=358s,tm=370s]The inner part collides with moving parts such as a solar panel, an antenna, a movable cabin section and the like. Adjusting the starting time of the mechanical arm to move (C) to tm+t9+t10+t11+t12=438s<te3The time when move (C) is completed is tm+t9+t10+t11+t12+tc=438s<te3And satisfying the time constraint of the third interval of the collision-free space and the available channel.
After the mechanical arm finishes crawling motion, events such as camera power-off, cradle head resetting, power supply power-off and the like need to be carried out. The time of power-off of the camera is t5The time for the tripod head to reset is t 10s6The power supply is powered off for t 10s710s, the end time of the mechanical arm crawling motion is tm+t9+t10+t11+t12+tc+t5+t6+t7=468s<te3. The time constraint of the third interval of the available channels is satisfied.
Therefore, through time series reasoning, the time intervals of the mechanical arm for executing the crawling task are planned to be [0s, 88s ], [200s, 276s ] and [370s, 468s ]. The time interval of the mechanical arm executing the crawling motion move (A) is [40s, 80s ], the time interval of the crawling action move (B) is [208s, 268s ], and the time interval of the crawling action move (C) is [378s, 438s ].
In the scheme provided by the embodiment of the application, a basic task transfer network is established according to the preset execution logic between basic tasks and the preset basic task library, then determining initial state information and target state information of the mechanical arm, establishing an initial task planning network according to the initial state information and the target state information, then decomposing the non-basic tasks layer by layer based on a layered task network planner HTN and the basic task transfer network to obtain a basic task sequence, updating the initial task planning network according to the basic task sequence to obtain an updated task planning network, therefore, the task planning is carried out on the mechanical arm through the hierarchical network planner HTN, the task of the mechanical arm can be planned in real time according to the actual situation, the flexibility of the task planning is improved, and the task planning is more suitable for the actual situation.
Based on the same inventive concept as the method shown in fig. 1, the present application provides an apparatus for mechanical arm task planning based on HTN planning, referring to fig. 3, the apparatus includes:
the establishing unit 301 is configured to establish a basic task transfer network according to a preset execution logic between basic tasks and a preset basic task library, where the basic task is a task that is executed by a mechanical arm at a single time;
a determining unit 302, configured to determine initial state information and target state information of a mechanical arm, and establish an initial task planning network according to the initial state information and the target state information, where the initial task planning network includes a basic task and a non-basic task;
a decomposition unit 303, configured to decompose the non-basic task layer by layer based on a hierarchical task network planner HTN and the basic task transfer network to obtain a basic task sequence, where the basic task sequence is formed by multiple layers of basic tasks;
an updating unit 304, configured to update the initial task planning network according to the basic task sequences and the execution timing sequence of each basic task sequence, so as to obtain an updated task planning network, where the updated task planning network is a hierarchical task network.
Optionally, the determining unit 302 is further configured to: determining at least one accompanying event corresponding to each basic task in the basic task sequence, wherein the accompanying event refers to an event which occurs concomitantly in the process of executing the basic task; binding the at least one accompanying event with the corresponding basic task according to a preset time sequence logic between the accompanying events and the basic task to obtain a bound basic task; and updating the basic task sequence according to the bound basic task to obtain an updated basic task sequence.
Optionally, the determining unit 302 is further configured to: determining a first time interval for executing the basic tasks in the bound basic tasks according to a preset time sequence relation between the basic tasks, and determining a second time interval for executing each accompanying event according to a preset time sequence relation between accompanying times; judging whether a conflict exists between the first time interval and the second time interval; and if so, adjusting and optimizing the bound basic task according to a preset adjusting and optimizing rule.
Optionally, the preset adjustment optimization rule includes: adjusting the first time interval or adjusting the second time interval until no conflict exists between the adjusted first time interval and the second time interval; or adjusting the execution logic relationship between the base task and the companion event until no conflict exists.
Optionally, the determining unit 302 is further configured to: determining a third time interval corresponding to the bound basic task according to the adjusted first time interval and the adjusted second time interval; judging whether a third time interval corresponding to any two adjacent bound basic tasks has conflict or not; and if so, adjusting the third time interval until no conflict exists between the third time intervals corresponding to any two adjacent bound basic tasks.
Optionally, the updating unit 304 is specifically configured to: determining a fourth time interval of the mechanical arm movement according to the adjusted third time interval; determining motion state information of a component related to the motion of the mechanical arm in the fourth time interval, wherein the component comprises a solar panel, an antenna or a movable cabin section; and determining a collision-free space corresponding to the mechanical arm according to the fourth time interval and the motion state information, and updating the initial task planning network according to the collision-free space and the basic task sequence.
Optionally, the decomposition unit 303 is specifically configured to: determining an initial state and a target state corresponding to the non-basic task, searching layer by layer in the basic task transfer network according to the HTN, the initial state and the target state, determining a plurality of basic tasks transferred from the initial state to the target state, and obtaining the basic task sequence according to the plurality of basic tasks.
Referring to fig. 4, the present application provides a computer device comprising:
a memory 401 for storing instructions for execution by at least one processor;
a processor 402 for executing instructions stored in memory to perform the method described in fig. 1.
A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of fig. 1.
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, 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.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.