Disclosure of Invention
The purpose of the invention is as follows: in order to solve the problem that the existing mechanical arm track planning method cannot meet the requirements of small calculated amount in the analysis process, accurate calculation result, high reliability and the like at the same time, the invention provides the mechanical arm track planning method based on the improved whale searching method, the method greatly reduces the calculated amount, meets the requirement of high precision at the same time, and can be applied to the track planning of an industrial robot.
The technical scheme is as follows: a mechanical arm track planning method based on an improved whale searching method comprises the following steps:
step 1: acquiring parameters of all connecting rods of the mechanical arm, constructing a three-dimensional model of the mechanical arm and constructing a three-dimensional model of a main body interacting with the motion of the mechanical arm in an actual application scene;
step 2: defining a space coordinate system of each joint of the mechanical arm; wherein the joint i is emptiedEach direction axis of the inter-coordinate system is defined as xi、yi、ziA shaft; thetaiIs xi-1Axial around zi-1The shaft rotates to xiThe angle of the shaft;
and step 3: setting path points between the main body and the manipulator at the tail end of the mechanical arm based on tasks to be completed by the mechanical arm under the space coordinate system in the step 2; the method comprises the steps that tasks are executed through a simulation mechanical arm, and the set pose of a mechanical arm end manipulator corresponding to each path point is obtained;
and 4, step 4: according to task requirements, defining the movement time between two adjacent path points to obtain the total time required for completing the whole task; establishing a mathematical model with optimal mechanical arm movement time based on the total time required for completing the whole task;
and 5: taking the mathematical model established in the step 4 as an objective function of the whale optimization searching method, taking the maximum value of the kinematic parameters of each joint of the mechanical arm as a constraint condition of the whale optimization searching method, and obtaining the optimal movement time by adopting the whale optimization searching method;
step 6: and planning to obtain the motion trail of the mechanical arm based on the optimal motion time.
The method comprises the steps of constructing a three-dimensional model of the mechanical arm in software ROBCAD and constructing a three-dimensional model of a main body interacting with the movement of the mechanical arm in an actual application scene.
Further, step 2 specifically includes:
defining the intersection point of the common perpendicular line of the joints at the two ends of the mechanical arm connecting rod i +1 and the axis of the joint i as an origin, and establishing x along the common perpendicular line and pointing to the direction of the joint i +1iAxis, establishing z along the joint i axisiAxis, determination of y by right techniqueiA shaft.
Further, in step 3, setting a path point between the main body and the end effector of the robot arm specifically includes:
and defining the path point which the manipulator at the tail end of the mechanical arm passes through in the complete task according to the joint motion on the mechanical arm, the speed and the acceleration of the joint motion, the joint axis and the joint motion range.
Further, in step 3, the pose is represented as:
wherein n isx、ny、nzNormal unit vectors describing the coordinate system of the end operator in the x, y and z directions respectively; ox、oy、ozDirection unit vectors describing the coordinate system of the end effector in the x, y and z directions respectively; a isx、ay、azRespectively, a near unit vector describing the coordinate system of the end effector in the x, y and z directions; p is a radical ofx、py、pzPosition vectors describing the end effector coordinate system in the x, y, z directions, respectively.
In the invention, the software ROBCAD directly acquires the pose of the manipulator at the tail end of the mechanical arm at the set path point.
Further, in step 4, the mathematical model for optimizing the motion time of the mechanical arm is represented as:
Ttotal=mint1′+mint′2+mint′3+...... (2)
wherein, t'1、t′2、t′3Respectively representing the running time of the mechanical arm between two adjacent path points.
Further, in
step 5, the kinematic parameters of each joint of the mechanical arm include: angular velocity of each joint of mechanical arm
Angular acceleration of each joint of mechanical arm
And angular acceleration of joints of the arm
The constraint conditions of the whale optimization searching method are represented as follows:
wherein the content of the first and second substances,
is the maximum value of the angular velocity of each joint of the mechanical arm,
is the maximum value of the angular acceleration of each joint of the mechanical arm,
the maximum value of the angular jerk of each joint of the mechanical arm.
Further, in step 5, the whale optimization searching method comprises the following steps:
s100: initializing a non-linear convergence factor
Coefficient vector
Coefficient vector
Parameter l, parameter p, nonlinear inertial weight ω and maximum number of iterations t
max(ii) a Setting the population number N and randomly generating an initial population position;
s200: calculating the fitness value of each whale individual in the population, defining the whale individual with the minimum fitness value as the current optimal individual, and using X*Representing its position vector;
s300: updating nonlinear convergence factors of individual whales
Coefficient vector
Coefficient vector
Parameter l, parameter p, nonlinear inertial weight ω;
s400: judging whether the updated parameters meet the following conditions: p < 0.5 and | A | < 1, if satisfied, updating the location of each individual whale according to the following equation:
if the updated parameters satisfy that p is less than 0.5 and | A | ≧ 1, updating the position of each whale individual according to the following formula, namely the shortest running time solved currently:
if the updated parameters meet that p is more than or equal to 0.5, updating the position of each whale individual according to the following formula, and obtaining the shortest operation time obtained by current solution:
wherein the content of the first and second substances,
is a nonlinear convergence factor;
is a coefficient vector; l is [ -1,1 [ ]]The random number of (2); p is [0,1 ]]The random number of (2);
is [0,1 ]]A random vector of (a); omega is a nonlinear inertial weight; t is t
maxIs the maximum iteration number; mu is a constant coefficient; b is a constant defining the shape of the logarithmic spiral.
S500: judging iterationWhether the number of times reaches the maximum iteration number t
maxIf not, returning to S200; if so, outputting the current optimal individual and the position vector X thereof
*And obtaining the optimal exercise time. Nonlinear convergence factor in whale searching method
The convergence rate is nonlinear, and the convergence rate in the early stage is fast and the convergence rate in the later stage is relatively slow.
Has the advantages that: compared with the prior art, the invention has the following advantages:
(1) the improved whale searching method is applied to track optimization of the mechanical arm, optimal track planning of the movement time of the mechanical arm is achieved, the calculation result has higher precision, and the optimization time is shortened;
(2) according to the invention, the pose of the manipulator tail end corresponding to each path point is obtained through the ROBCAD software, so that the calculation amount of matrix transformation is reduced.
Detailed Description
The technical solution of the present invention will be further explained with reference to the accompanying drawings and examples.
Referring to fig. 8, in the embodiment, a trajectory planning method for a mechanical arm based on an improved whale search method is adopted to plan a trajectory of the mechanical arm for performing a task of clamping raw materials; fig. 3 is a schematic diagram of a robotic arm performing the task of grasping raw meal, as shown in fig. 3, the task being performed by a body comprising: the device comprises a machining center 1, a material taking point 2, a mechanical arm 3, a bin 4 and a raw material point 5; the processing center 1 and the bin 4 are respectively arranged at two sides of the mechanical arm 3, the raw material point 5 is positioned at any position of the bin 4, and the material taking point 2 is positioned at the processing center 1; the end-of-arm manipulator grips the raw meal at the raw meal point 5, moves to the machining center, places the raw meal at the take off point 2, and then returns to the initial position, which is a take off movement.
Now, with reference to this task, the steps of the planning method used in this embodiment are described, including the following steps:
step 1: importing a three-dimensional model: acquiring main parameters of each connecting rod of the mechanical arm, wherein the main parameters comprise the size, the material density, the centroid position, the connection mode and the like of each connecting rod including the base, and importing three-dimensional models of the mechanical arm and other main bodies related to the mechanical arm in an actual application scene into software ROBCAD; see fig. 1;
step 2: referring to fig. 2, a space coordinate system of the six-degree-of-freedom structural body of the robot arm is established, wherein each directional axis of the space coordinate system of the joint i is respectively defined as xi、yi、ziA shaft; thetaiIs xi-1Axial around zi-1The shaft rotates to xiAngle of the shaft: defining a base coordinate system {0} and a space coordinate system of each joint of the mechanical arm by a standard D-H parameter method; the method specifically comprises the following steps: defining the intersection point of the common perpendicular line of the joints at the two ends of the connecting rod i +1 and the axis of the joint i as an origin, and establishing x along the common perpendicular line and pointing to the direction of the joint i +1iShaft, along which joint axis z is establishediAxis, determining y by right-hand ruleiA shaft;
and step 3: defining model motion parameters, and acquiring a pose: based on step 2, defining the path points of the moving mechanism (including joint motion, joint motion speed and acceleration, joint axis, motion range and the like) and the mechanical arm end manipulator to complete specific tasks in the ROBCAD software, which will be based on the following stepsDefining the secondary passing path point as P0、P1、P2、P1、P3、P4、P3、P0Wherein P is0At an initial position of the end-of-arm manipulator, P1Is at any position on the storage bin close to the raw material point, P2At the location of the charging point, P3Is at any position on the machining center close to the material taking point, P4Is the position of a material taking point. Simulating the process that the mechanical arm clamps raw materials in an actual application scene, moves in a machining center, and then returns to an initial position, wherein the software ROBCAD can directly acquire the pose of the mechanical arm end operator corresponding to each set path point:
and 4, step 4: time-optimal modeling: defining the motion time between two adjacent path points according to the practical application requirement, namely t'1、t′2、t′3、t′4、t′5、t′6、t′7Then the total time required to complete the entire specific task is:
Ttotal=mint′1+mint′2+mint′3+mint′4+mint′5+mint′6+mint′7
and 5: defining a constraint condition: adding and researching angular velocity of each joint of mechanical arm
Angular acceleration
Sum angular jerk
And (3) taking the maximum value of the isokinetic parameters as a constraint condition of the optimized search of the improved whale:
in the present embodiment, the constraint conditions of each joint are set as follows:
step 6: planning a track: taking the mathematical model in the step 4 as an objective function of the method, and carrying out trajectory planning on the mechanical arm based on the constraint conditions defined in the step 5 and an improved whale searching method, wherein the improved whale searching method comprises the following calculation steps:
(1) setting the number of the populations to be N-30, and randomly generating the positions of the initial populations; initialization parameters
l, p, ω and t
maxWherein:
wherein the content of the first and second substances,
is a nonlinear convergence factor;
is a coefficient vector; l is [ -1,1 [ ]]The random number of (2); p is [0,1 ]]The random number of (2);
is [0,1 ]]A random vector of (a); omega is a nonlinear inertial weight; t is t
maxThe maximum number of iterations is 500 in this example; mu is a constant coefficient, and the value in the embodiment is 0.01 after multiple simulation experiments.
(2) Calculating the fitness value of each whale individual (namely a search agent) in the population, selecting the whale individual with the smallest fitness value, defining the whale individual as the current optimal individual, and using X*Represents its position vector:
(3) once per iteration, the relevant parameters for each search agent are updated:
l, p, ω. If p < 0.5 and | A | < 1, the location update for each search agent is calculated as in equation (8):
otherwise, if p is less than 0.5 and | A | ≧ 1, the calculation is performed according to equation (9):
if p is greater than or equal to 0.5, the position is updated according to equation (10):
(4) and comparing the individuals in the population after the position is updated, and determining the globally optimal individual and the current position.
(5) If the iteration times reach the maximum value, namely the termination condition of the loop part in the WOA is reached, outputting a result, namely the optimal movement time; otherwise, returning to the step (2) and continuing to calculate until the termination condition is met.
In order to verify the convergence performance of the improved whale optimization algorithm, the improved whale optimization algorithm is calculated based on a standard test function and compared with the convergence performance of other three commonly used intelligent optimization algorithms, and fig. 4 is a diagram of an embodiment based on a standard test function F1(x) The improved whale optimization search and other three commonly used intelligent optimization methods are used for comparing the convergence rate; standard test function F1(x) Expressed as:
FIG. 5 shows an exemplary embodiment of a standard-based test function F2(x) The improved whale optimization search and other three commonly used intelligent optimization methods are used for comparing the convergence accuracy; standard test function F2(x) Expressed as:
as shown in fig. 4 and 5,. The improved whale optimization algorithm is better than a genetic algorithm GA, a particle swarm algorithm PSO and a basic whale optimization algorithm WOA in convergence speed and convergence precision through simulation experiment result analysis.
The optimal movement time of the mechanical arm obtained by the searching method in the embodiment is shown in the following table and fig. 6, and the final result of the trajectory planning is shown in fig. 7.
The mechanical arm trajectory planning result which is obtained by the method of the embodiment and aims at time optimization meets the requirements of small calculated amount, reliable calculated result and high precision.