Three-dimensional visualization method of five-degree-of-freedom hybrid robot
By acquiring active joint data of the robot and combining it with BP neural network and OpenGL rendering technology, high-precision 3D visualization of a five-degree-of-freedom hybrid robot was achieved, solving the problem of insufficient expression of parallel branch motion constraints and improving the real-time monitoring capability and intelligent application of multi-axis linkage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF SCI & TECH
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies cannot effectively achieve 3D visualization of five-degree-of-freedom hybrid robots, especially in expressing the characteristics of parallel branch motion constraints, and cannot meet the needs of real-time monitoring of multi-axis linkage and prediction of processing effects.
By acquiring real-time data of the robot's active joints, combining BP neural networks and inverse kinematics calculations, end-effector pose data is obtained, and combined with OpenGL graphics rendering technology, dynamic visualization of various robot components is achieved.
It achieves high-precision 3D visualization of five-degree-of-freedom hybrid robots, supports synchronous updates and dynamic visualization during multi-axis linkage processes, improves the ability to understand and judge complex motion trajectories, and is suitable for intelligent applications in complex industrial scenarios.
Smart Images

Figure CN122008195A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of robot technology visualization, specifically a three-dimensional visualization method for a five-degree-of-freedom hybrid robot. Background Technology
[0002] 3D visualization is one of the core technological supports for hybrid machining robots, directly determining the depth and breadth of their intelligent applications. 3D visualization can be understood as a technical means of intuitively presenting the motion state, working scene, and component morphology of a hybrid robot through digital modeling and real-time rendering. 3D visualization can generally be divided into two categories: modeling visualization and motion visualization. Motion visualization specifically refers to the real-time visualization of the robot performing multi-axis linkage machining, path planning verification, and machining effect prediction under complex working conditions. For hybrid robots, the degree of motion visualization reflects the multi-axis collaborative control and machining process monitoring capabilities. Operational visualization is crucial in the performance verification and application optimization of hybrid robots. It can intuitively reflect the collaborative state of each motion axis, the rationality of the interpolation path, and the accuracy of the machining effect, and is a key indicator for measuring the robot's intelligence level and actual operational reliability.
[0003] With the increasing demand for real-time monitoring of multi-axis linkages in hybrid robots, the practical application of 3D visualization is gaining attention. Traditional 3D visualization methods involve placing position sensors, such as motor encoders, at the robot's active joints, and then establishing the coordinate systems of each link using methods such as the DH parameter method or URDF description method. This is combined with forward kinematics solutions to achieve pose mapping, thereby enabling real-time updates of the poses of each link and driving the 3D model. However, this method is only suitable for robots with open-loop kinematic chains, such as serial robots and legged robots, and cannot express the motion constraint characteristics of parallel branches in hybrid mechanisms. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a three-dimensional visualization method for a five-degree-of-freedom hybrid robot.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows:
[0006] A three-dimensional visualization method for a five-DOF hybrid robot includes the following steps:
[0007] Acquire real-time joint data collected by position sensors deployed on each active joint of the robot;
[0008] Perform forward kinematics calculations on real-time joint data to obtain the robot's end-effector pose data;
[0009] Perform inverse kinematics calculations on the end-effector pose data to obtain theoretical pose data describing the spatial position and attitude of each component of the robot;
[0010] Acquire and parse the robot's 3D surface model file, and extract the initial geometric data of each component;
[0011] The initial geometric data of each component is deredundant and smoothed to obtain the optimized model data of each component, and the optimized model data of each component is loaded into the video memory of the graphics processing unit through the graphics interface.
[0012] Based on the optimized model data already loaded into video memory, the graphics rendering pipeline is invoked to perform view transformation and lighting calculations, generating rendered image data for each component.
[0013] Theoretical pose data is applied to the graphics rendering pipeline, driving the graphics processing unit to perform spatial transformation and dynamic assembly of the rendered image data of each component based on the theoretical pose data, and synthesizing and outputting a dynamic 3D visualization image of the entire robot.
[0014] Preferably, real-time joint data is acquired, specifically including:
[0015] It receives motor pulse data corresponding to the movement of each active joint, which is collected by the encoder, and transmits it to the main control unit through the industrial bus;
[0016] In the main control unit, the displacement variable is calculated based on the motor pulse data corresponding to the linear active joint, the number of encoder pulses per revolution, and the lead screw.
[0017] The angle variable is calculated based on the motor pulse data corresponding to the rotary active joint and the number of encoder pulses per revolution;
[0018] Displacement and angle variables are used together as real-time joint data.
[0019] Preferably, forward kinematic calculations are performed on real-time joint data, specifically including:
[0020] The displacement variables of the linear active joint are input into a pre-trained BP neural network model to obtain the initial position estimate of the end point of the parallel mechanism;
[0021] The initial position estimate is iteratively refined using the Newton-Raphson iterative method to obtain high-precision end position data of the parallel mechanism;
[0022] By combining the angular variables of the active rotating joints and the geometric parameters of the robot's serial rotating head structure, the end-effector pose data is calculated based on the end-effector position data of the parallel mechanism.
[0023] Preferably, the BP neural network model is trained through the following steps:
[0024] Randomly sample the coordinates of the end point within the workspace of the robot's parallel mechanism;
[0025] The displacement of the linear active joint corresponding to each coordinate position is calculated by inverse kinematics.
[0026] The training sample set is constructed by using the displacement as the input feature and the corresponding coordinate position as the output label.
[0027] Initialize the weights and thresholds of the BP neural network;
[0028] The sparrow search algorithm is used, with the network prediction error on the sample set as the fitness, to iteratively optimize the initial weights and thresholds, and obtain the optimized initial parameters.
[0029] Starting with the optimized initial parameters, the BP neural network is trained under supervision using a sample set until convergence, resulting in a pre-trained BP neural network model.
[0030] Preferably, the parameters of the sparrow search algorithm include: population size, maximum number of iterations, and the ratio of discoverers, joiners, and watchers.
[0031] Preferably, acquiring and parsing the 3D surface model file includes:
[0032] Read STL model files in ASCII format;
[0033] The normal vector data of the triangle face is extracted by identifying the keyword "facetnormal" in the file, and the vertex coordinate data of the triangle face is extracted by identifying the keyword "vertex".
[0034] The total number of triangular faces in the 3D surface model file is determined by the number of lines in the STL model file.
[0035] Preferably, the initial geometric data of each component undergoes redundancy removal and smoothing processing, specifically including:
[0036] Iterate through all vertex coordinate data for each component, merge vertices with the same spatial position, and assign an index to each unique vertex to generate a vertex coordinate array and an index array;
[0037] Based on the index array and the initial surface normal vector data of the corresponding parts, calculate the average normal vector corresponding to each unique vertex, and generate the vertex normal vector array of the corresponding parts.
[0038] The Laplacian smoothing algorithm is used to iteratively adjust the vertex positions in the vertex coordinate array, and the vertex normal vector array of the corresponding component is recalculated based on the adjusted vertex coordinates.
[0039] The optimized model data includes at least the vertex coordinate array, vertex normal vector array, and index array of the corresponding component.
[0040] Preferably, the optimized model data is loaded into the video memory of the graphics processing unit via a graphical interface, specifically including:
[0041] Create and bind a vertex array object for each component, and create at least two vertex buffer objects;
[0042] Store the vertex coordinate array in the optimization model data corresponding to each component into the first vertex buffer object, and store the vertex normal vector array into the second vertex buffer object;
[0043] Configure vertex attribute pointers for the vertex array object to describe the organization format, offset, and step size of the vertex coordinate data and vertex normal vector data, respectively;
[0044] The first vertex buffer object and the second vertex buffer object are associated with the vertex array object and uploaded to the video memory of the graphics processing unit.
[0045] Preferably, the view transformation calculation is performed, specifically including:
[0046] Set the spherical coordinate parameters of the virtual camera, wherein the spherical coordinate parameters include at least the azimuth angle, the pitch angle, and the viewing radius;
[0047] Calculate the three-dimensional position coordinates of the virtual camera in the world coordinate system based on the azimuth angle, elevation angle, and observation radius;
[0048] Using the origin of the robot's coordinate system as the observation target point, and based on the position coordinates of the virtual camera and the observation target point, a view transformation matrix from the world coordinate system to the camera coordinate system is constructed.
[0049] An orthogonal projection method is used, and an orthogonal projection matrix is constructed based on preset projection cube parameters;
[0050] Based on the view transformation matrix and orthogonal projection matrix, the vertex coordinates of each component after transformation by theoretical pose data are converted from the world coordinate system to standardized equipment coordinates.
[0051] Preferably, the algorithm used to perform the lighting calculation is the Phong lighting model algorithm, which specifically includes:
[0052] Calculate the ambient light component acting on each component model;
[0053] Calculate the diffuse reflection light component based on the direction of the light source and the normal vector of the corresponding component model surface;
[0054] Calculate the specular reflection component based on the observer's direction and the direction of the reflected light;
[0055] The ambient light component, diffuse light component, and specular highlight component are superimposed and blended with the surface color of the component model to output the final lighting color of each point on the surface of the component model.
[0056] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0057] This invention achieves closed-loop kinematic chain constraint calculation of the hybrid mechanism through the kinematics of a five-DOF hybrid robot, ensuring accurate description of the pose of each component. By combining OpenGL's graphics rendering capabilities with real-time kinematic calculation data, it realizes synchronous updating and dynamic visualization of the pose of each link during multi-axis linkage of the robot, effectively improving the ability to understand and judge complex motion trajectories during human-computer interaction. It is not only applicable to the synchronous display of 3D models of hybrid robots, but can also be extended to intelligent application fields such as dynamic operation pre-simulation, remote operation and maintenance, and virtual training of this type of robot in complex industrial scenarios, significantly improving the operability and safety of the robot system. Attached Figure Description
[0058] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein:
[0059] Figure 1 This is a flowchart of the hybrid robot 3D visualization method of the present invention;
[0060] Figure 2 This is a schematic diagram of the main components of the five-degree-of-freedom hybrid robot of the present invention;
[0061] Figure 3 This is the main structure of the five-degree-of-freedom hybrid robot of the present invention.
[0062] The following are the labels in the diagram: 1. Drive motor for the first linear joint; 2. Drive motor for the second linear joint; 3. Drive motor for the third linear joint; 4. Drive motor for the first rotary joint; 5. Drive motor for the second rotary joint; 6. Column; 7. Ground rail; 8. Parallel mechanism; 9. A / C rotary head. Detailed Implementation
[0063] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.
[0064] like Figure 1-3 As shown, the five-degree-of-freedom hybrid robot consists of a parallel mechanism 8 and a series A / C swivel head 9, which are fixedly connected to the ground rail 7 via a column 6. It also includes a drive motor 1 for the first linear joint, a drive motor 2 for the second linear joint, a drive motor 3 for the third linear joint, a drive motor 4 for the first rotary joint, and a drive motor 5 for the second rotary joint.
[0065] Horizontal rail 7: The base of the entire machine, providing an absolutely stable reference coordinate system. The robot origin is usually set here.
[0066] Column 6: Connects the ground rail 7 and the parallel mechanism 8, raising the parallel mechanism 8 to the working height and transmitting the fixed support force;
[0067] Parallel Mechanism 8: It realizes one horizontal and two rotational motions, namely planar movement and rotation in two directions. It is the core motion unit of the hybrid mechanism, including 3 linear active joints, and the motion form is linear extension and retraction.
[0068] A / C rotating head 9: Connected in series on the moving platform of the parallel mechanism 8, it realizes two rotational degrees of freedom of the end tool, adapting to precision operations. It includes two active rotational joints, and the motion is rotational motion around the axis.
[0069] The drive motors for the linear joints (3): drive the 3 linear active joints of the parallel mechanism 8 and control the position and attitude of the moving platform of the parallel mechanism 8;
[0070] Two drive motors for rotary joints: drive the two rotary active joints of the A / C swivel head 9 and control the direction of the end tool shaft.
[0071] A three-dimensional visualization method for a five-DOF hybrid robot includes the following steps:
[0072] Step 1: Acquire real-time joint data from position sensors deployed on each active joint of the robot;
[0073] Specifically, the position sensor is an encoder, which can convert the mechanical rotation of the motor into pulse signals. The number of pulses per revolution can reach thousands or even tens of thousands, which can accurately capture the minute movements of the joints. Moreover, the pulse signal has a fast response speed. In conjunction with the EtherCAT bus, it can realize high-frequency acquisition of joint data, thereby adapting to the real-time requirements of multi-axis linkage of robots. It can measure the number of rotations of the motor to indirectly reflect the extension and contraction of linear joints, and it can also measure the rotation angle of the motor to directly reflect the rotation of rotary joints, perfectly matching the hybrid joint layout of robots.
[0074] The position information of servo motors 1, 2, 3, 4, and 5 that drive the active joint movement is obtained through the servo driver, and this information is transmitted to the robot's main control unit through EtherCAT communication.
[0075] The main control unit converts the pulse data from the robot's encoder and the number of pulses corresponding to a single encoder revolution into the joint parameters of the robot's active joints, i.e.:
[0076] ;
[0077] ;
[0078] ;
[0079] in, For the serial number The number of motor rotations, For the serial number The number of pulses in the motor, This represents the number of pulses in a single-turn encoder. For linear joint variables. For rotational joint variables, The lead of the lead screw corresponding to the linear joint
[0080] In the above technology, the physical motion of the robot's five active joints is quantified into computable digital signals, providing accurate and real-time raw data for subsequent pose calculation and dynamic rendering.
[0081] Step 2: Perform forward kinematics calculations on the real-time joint data to obtain the robot's end-effector pose data;
[0082] Specifically, parallel mechanism 8 is a closed-loop kinematic chain. Directly solving for the position of the end point of parallel mechanism 8 analytically requires solving a complex system of nonlinear equations, which is inefficient and prone to errors. By employing a BP neural network to quickly fit the mapping relationship between joint variables and the position of the end point, and optimizing the initial parameters of the network using the Sparrow Search Algorithm (SSA), the fitting accuracy is improved. Details are as follows:
[0083] A large number of samples were collected in the robot's workspace and used to train a backpropagation (BP) neural network. The robot's workspace is cylindrical, and its specific dimensions are shown in the attached figure. Figure 3 As shown, random sampling is performed within this cylinder, and random samples are collected. Coordinate points:
[0084] ;
[0085] in, , and for For orthogonal components in space, the sampling formula for sample points is:
[0086] ;
[0087] in, , , All numbers are random numbers in the range of 0 to 1. For cylindrical workspace The effective height range in the axial direction, i.e. Maximum travel in the axial direction, cylindrical workspace Axis reference height, i.e., workspace The starting position in the axial direction, such as the reference height of the leveling rail 7 or the column 6.
[0088] Furthermore, the above formula was collected. The corresponding active branch length is obtained by inverse kinematics of each coordinate through parallel mechanism 8. , , Then, the length of the active branch chain , , As a feature part of the sample, the corresponding end point P position vector The three orthogonal components , and As a label part of the sample, thus completing This is used to create training samples for the BP neural network.
[0089] The samples were divided into a training set (3500 sets), a test set (1000 sets), and a validation set (500 sets) in a 7:2:1 ratio. Min-Max standardization was used to normalize the sample data, using the following formula:
[0090] ;
[0091] in, This is the original data. For the normalized data, , These are the minimum and maximum values of the original data for this type, respectively.
[0092] Furthermore, a 3-layer BP neural network is constructed, with 3 nodes in the input layer, each corresponding to one of the active joint variables of the parallel mechanism 8. , , The input consists of two hidden layers, each with 15 neurons, and three output layers, corresponding to the coordinate components of the terminal point P of the parallel mechanism. , , The hidden layer uses the sigmoid function as the activation function, that is:
[0093] ;
[0094] The output layer uses the Purelin function as the activation function, that is:
[0095] ;
[0096] The initial weights and threshold of the BP neural network are optimized using the Sparrow Search Algorithm (SSA). The SSA parameters are set as follows:
[0097] Initial population size 100, maximum number of iterations 1000, safety threshold 0.6;
[0098] The upper and lower boundaries of the variable are [−1, 1].
[0099] Discoverers accounted for 0.7%, participants for 0.1%, and vigilants for 0.2%.
[0100] The variable dimension d=348 (including 315 weights and 33 thresholds) is optimized, and the root mean square error between the training set and the test set is used as the fitness function.
[0101] Furthermore, the training of the neural network is now complete, and the active joint variables are input. , , The trained neural network model outputs the position vector of the end point P of the parallel mechanism 8. The Newton-Raphson iterative method is used to refine the solution of this output value to improve the accuracy of the forward kinematics solution of the above parallel mechanism. This is done after obtaining the position vector of the parallel end point P. Based on this, utilize active joint variables , Combined with appendix Figure 2 By analyzing the geometry of the A / C rotating head 9, the position vector of the end effector C of the hybrid robot can be obtained. and the direction vector of the end tool axis .
[0102] Among the above technologies, the pain point that traditional analytical methods cannot handle the closed-loop constraints of parallel mechanisms is overcome by using BP neural networks and Newton-Raphson iteration, achieving high-precision P-point position solution. The coarse solution of the neural network meets the real-time requirements of multi-axis linkage, and the iterative refinement meets the accuracy requirements of industrial visualization.
[0103] Step 3: Perform inverse kinematics calculation on the end-effector pose data to obtain theoretical pose data describing the spatial position and attitude of each robot component;
[0104] Specifically, the position vector of the end point C obtained from the robot's forward kinematics. and the direction vector of the end tool axis The location vector describing the position of each component can be solved using the closed-loop vector method. and the rotation matrix describing the attitude The design specifically integrates the serial motion characteristics of the A / C rotating head 9, and the derivation from the end P of the parallel mechanism 8 to the end C of the whole machine perfectly matches the hybrid structure of the robot's parallel and serial connections, ensuring that the pose data is consistent with the actual robot motion.
[0105] Step 4: Obtain and parse the robot's 3D surface model file, and extract the initial geometric data of each component;
[0106] Specifically, by converting the physical three-dimensional shapes of each robot component into computer-recognizable initial geometric data through standardized model files, raw digital materials are provided for subsequent data optimization, GPU loading, and high-fidelity rendering. The details are as follows:
[0107] STL (Standard Triangle Language) is a standard format in the field of 3D modeling. CAD software (such as SolidWorks and UG) can directly export robot component models as ASCII format, which is compatible with the modeling needs of all components such as static platforms, moving platforms, 3 active branches, passive branches, and A / C 9-inch rotating heads.
[0108] Each core component of the robot, including the ground rail 7, column 6, branches and platforms of the parallel mechanism 8, and A / C turner 9, needs to be modeled in 3D using CAD software and then exported as an independent ASCII STL file. This ensures that the geometric data of each component can be processed separately, ultimately achieving precise assembly.
[0109] Use CAD software to create 3D models of each robot component, and then export the created models as ASCII STL files.
[0110] Furthermore, the file content is read, and the triangle normal vector with 3 components for each triangle face is extracted by recognizing "facetnormal". The vertex coordinates with 9 components for each triangle face are extracted by recognizing "vertex". The number of triangles in the STL file is calculated based on the number of lines in the STL file.
[0111] ;
[0112] in, Indicates the number of triangles. Indicates the number of lines in the file.
[0113] Furthermore, based on the number of triangles in the STL file... To determine the size of the data storage, construct an array with a length of [missing information]. The vertex coordinate array and the array length are An array of triangle normal vectors is generated, ensuring that each vertex corresponds one-to-one with its corresponding normal vector, thereby obtaining the initial geometric data for each component.
[0114] In the aforementioned technology, the physical components modeled in CAD are accurately converted into initial geometric data that can be processed by a computer. Through logic such as ASCII format parsing, keyword recognition, and triangle number calculation, the three-dimensional shape of each component is completely extracted.
[0115] Step 5: Perform redundancy removal and smoothing on the initial geometric data of each component to obtain the optimized model data of each component, and load the optimized model data of each component into the video memory of the graphics processing unit through the graphics interface.
[0116] Specifically, the model data is deredundant by removing duplicate vertices and normals. The Laplacian smoothing algorithm is used to smooth the model surface, reducing the sharp edges between triangles while preserving key features of the mechanism. For complex parts (such as A / C rotating heads), LOD (Levels of Detail) multi-level detail model technology is used to automatically switch between medium and low precision models based on the rendering distance, balancing rendering effect and efficiency.
[0117] Furthermore, a VAO (Vertex Array Object) and two VBOs (Vertex Buffer Objects) are created. The two VBOs are used to store vertex coordinate data and normal vector data, respectively. The array data in the CPU is uploaded to the GPU memory through the OpenGL interface to avoid duplicate data transmission. The vertex attribute pointers of the VAO are configured, and the VAO is used to describe the attributes of the information stored in the two VBOs, so that the GPU can correctly parse the data in the video memory and provide data support for the rendering pipeline.
[0118] In the above technology, the initial geometric data parsed from the STL file is deredundant and smoothed to eliminate invalid data and improve the visual effect of the model. Then, the optimized data is loaded into the GPU memory through the OpenGL graphics interface to provide efficient data support for subsequent high-fidelity and low-latency rendering.
[0119] Step Six: Based on the optimized model data already loaded into video memory, call the graphics rendering pipeline to perform view transformation and lighting calculations to generate rendered image data for each component;
[0120] Specifically, based on the optimized model data already loaded in the GPU memory, the OpenGL rendering pipeline sequentially performs view transformations and lighting calculations, transforming abstract geometric data into pixel-level rendered image data with spatial perspective and lighting texture. This provides a high-quality single-component image foundation for subsequent dynamic assembly of the entire machine. Details are as follows:
[0121] Define the camera coordinate system and create a virtual camera coordinate system. The target point of this virtual machine camera is fixed as the origin of the robot's coordinate system. Based on the principle of user interaction convenience, the camera is positioned around the target point with a radius of... For motion on a sphere, the update formula for the virtual camera is:
[0122] ;
[0123] in, , , For the three position components of the virtual camera, , The azimuth angle parameter represents the camera's motion on the spherical surface.
[0124] Furthermore, based on the camera position and the camera target point, a homogeneous transformation matrix from the world coordinate system to the camera coordinate system is constructed, namely:
[0125] ;
[0126] in, , , Let be the unit direction vector of the coordinate axes in the camera coordinate system. Let be the camera's position vector. This formula is used to transform the 3D model's coordinates from the world coordinate system to the camera coordinate system. The transformation method is as follows:
[0127] ;
[0128] in, , , Let the coordinates of the vertices of the triangle face of the model in the robot coordinate system be the three components. , , The three components are the vertex coordinates of the triangle face of the model in the camera coordinate system.
[0129] Furthermore, to conform to observation standards in engineering practice, orthogonal projection is adopted as the projection transformation method. An orthogonal projection cube aligned with the camera coordinate axes is defined. , These are the position parameters of the left and right end faces of the cuboid. , These are the position parameters of the top and bottom faces of the cuboid. , The position parameters of the near and far end faces of the cuboid are given, and the visible range of the virtual camera is determined using this projected cuboid. Based on the parameters of the projected cuboid, the orthogonal projection matrix S is:
[0130] ;
[0131] The model's 3D coordinates in the camera coordinate system are converted into 2D NDC coordinates based on the projection matrix S, and then the NDC coordinates are processed by the rendering pipeline.
[0132] Furthermore, the lighting model used is the Phong lighting model, which consists of three parts: ambient light, diffuse light, and specular light, and can realistically simulate the lighting effects in the real world.
[0133] For the ambient lighting, a global ambient light intensity is set, which is uniformly applied to every triangular face of the robot model, providing a basic level of brightness so that the model is not completely in darkness. Let the ambient light intensity be... Then its expression is:
[0134] ;
[0135] in, A color vector related to the model surface. , Each of its three components in the RGB color space is represented separately, and the average value of all three is set to 1. This represents the ambient light coefficient.
[0136] Furthermore, regarding the intensity of diffuse reflection light... It is determined by the direction vector of the incident ray. and the surface normal vector of the object The inner product is determined by the following expression:
[0137] ;
[0138] ;
[0139] in, The diffuse reflectance coefficient is... Let be the position vector of the light source. This is the position vector of the model.
[0140] Furthermore, specular reflection light is used to simulate the highlight effect on smooth parts of an object's surface, and the intensity of specular reflection light is adjusted accordingly. The calculation formula is as follows:
[0141] ;
[0142] ;
[0143] in, The specular reflection coefficient, Let be the position vector of the camera relative to the model points. Let be the direction vector of the reflected light. Let be the specular reflection function. This is the roughness coefficient.
[0144] The final model formula for Phong lighting is:
[0145] ;
[0146] in, To utilize the color values output by the Phong lighting model, The color value of the model surface. , , Each of its three components in the RGB color space is represented by a value range set to 1. The Phong lighting model is written into the fragment shader of the rendering pipeline to render a high-fidelity part model of the robot.
[0147] Among the above technologies, 360° observation is supported by view transformation, orthogonal projection ensures the accuracy of the size ratio required for industrial scenes, Phong model simulates real light and shadow, allowing users to distinguish the material, shape and spatial position of parts through rendered images, data is directly called based on GPU memory, and parallel computing process ensures low latency, adapting to the real-time visualization needs of multi-axis robot linkage.
[0148] Step 7: Apply the theoretical pose data to the graphics rendering pipeline, drive the graphics processing unit to perform spatial transformation and dynamic assembly on the rendered image data of each component based on the theoretical pose data, and synthesize and output the dynamic 3D visualization image of the entire robot.
[0149] Specifically, by combining the robot's kinematics and view transformation methods, the update formulas for each component of the robot are as follows:
[0150] ;
[0151] ;
[0152] in, Here is the pose transformation matrix. These are the coordinates of each component.
[0153] By processing high-frequency active joint variables and using robot-related kinematic transformations, the pose transformation relationships of all 3D models are obtained. Then, the rendering pipeline is used to render each part of the robot frame by frame, thereby forming a continuous motion hybrid robot video effect.
[0154] Acquire real-time joint data, specifically including:
[0155] It receives motor pulse data corresponding to the movement of each active joint, which is collected by the encoder, and transmits it to the main control unit through the industrial bus;
[0156] In the main control unit, the displacement variable is calculated based on the motor pulse data corresponding to the linear active joint, the number of encoder pulses per revolution, and the lead screw.
[0157] The angle variable is calculated based on the motor pulse data corresponding to the rotary active joint and the number of encoder pulses per revolution;
[0158] Displacement and angle variables are used together as real-time joint data.
[0159] Specifically, the following example calculation is provided:
[0160] Parameter name symbol Value Encoder pulse count per revolution N 10000 pulses / cycle Linear joint lead screw P 10mm / circle Motor pulse count (linear joint) 15000 pulses Motor pulse count (linear joint) 20000 pulses Motor pulse count (linear joint) 25000 pulses Motor pulse count (rotary joint) 8000 pulses Motor pulse count (rotary joint) 12000 pulses
[0161] The calculation results based on the formula are as follows:
[0162] Joint number pulse count Number of rotations Displacement variables Linear joint 1 15000 pulses <![CDATA[P1 = 15000 / 10000 = 1.5 turns]]> =1.5×10=15mm Linear joint 2 20000 pulses <![CDATA[P2 = 20000 / 10000 = 2.0 turns]]> =2.0×10=20mm Linear joint 3 25000 pulses <![CDATA[P3 = 25000 / 10000 = 2.5 turns]]> =2.5×10=25mm Rotation joint 4 8000 pulses <![CDATA[P4 = 8000 / 10000 = 0.8 turns]]> =0.8×2π=1.6π rad=288∘ Rotation joint 5 12000 pulses <![CDATA[P5 = 12000 / 10000 = 2.5 turns]]> =1.2×2π=2.4π rad=432∘
[0163] Perform forward kinematic calculations on real-time joint data, specifically including:
[0164] The displacement variables of the linear active joint are input into a pre-trained BP neural network model to obtain the initial position estimate of the end point of the parallel mechanism;
[0165] The initial position estimate is iteratively refined using the Newton-Raphson iterative method to obtain high-precision end position data of the parallel mechanism;
[0166] By combining the angular variables of the active rotating joints and the geometric parameters of the robot's serial rotating head structure, the end-effector pose data is calculated based on the end-effector position data of the parallel mechanism.
[0167] Specifically, based on the above examples, the calculation continues:
[0168] Iterative refinement parameters: convergence threshold is ;
[0169] A / C rotor geometry parameters: Length of the connecting rod from the parallel end P to the rotor end C ;
[0170] A / C rotating head geometric parameters: Rotation axis reference direction A-axis is along the robot coordinate system X-axis, C-axis is along the robot coordinate system Z-axis;
[0171] The pre-trained BP neural network input layer consists of three linear joint displacement variables:
[0172] After calculation by the hidden layer (2 layers × 15 neurons, sigmoid activation) and the output layer (Purelin activation), the initial position estimate of the output is:
[0173] ;
[0174] The core of the Newton-Raphson iterative method is to correct the position error using the Jacobian matrix. The iterative formula is as follows:
[0175] ;
[0176] in, The Jacobian matrix of a parallel mechanism reflects the mapping relationship between joint variables and end-effector positions.
[0177] Position error function These are the inverse joint variables corresponding to the current position.
[0178] First iteration:
[0179] enter Calculate the Jacobian matrix and error function, and after correction, obtain:
[0180] ;
[0181] error Continue iterating;
[0182] enter After correction, we get:
[0183] ;
[0184] error Once the accuracy requirements are met, the iteration terminates.
[0185] The A / C rotating head is a series structure, and the pose transformation from point P to point C needs to be described by a homogeneous transformation matrix. The transformation process consists of two steps: rotation around the A-axis. → Rotate around the C-axis →Length L of the translation link:
[0186] Construct the A / C head pose transformation matrix:
[0187] Rotate about the X-axis (A-axis) Rotation matrix:
[0188] ;
[0189] Rotate about the Z-axis (C-axis) Rotation matrix:
[0190] ;
[0191] Total rotation matrix:
[0192] ;
[0193] Homogeneous transformation matrix (including translation L = 100 mm, along the Z-axis):
[0194] ;
[0195] Calculate the position vector of the endpoint C :
[0196] Position transformation formula: ;
[0197] Substitute numerical values into the calculation:
[0198] ;
[0199] Calculate the end tool axis direction vector :
[0200] The tool axis direction is determined by the third column (Z-axis direction) of the total rotation matrix:
[0201] .
[0202] The BP neural network model is trained through the following steps:
[0203] Randomly sample the coordinates of the end point within the workspace of the robot's parallel mechanism;
[0204] The displacement of the linear active joint corresponding to each coordinate position is calculated by inverse kinematics.
[0205] The training sample set is constructed by using the displacement as the input feature and the corresponding coordinate position as the output label.
[0206] Initialize the weights and thresholds of the BP neural network;
[0207] The sparrow search algorithm is used, with the network prediction error on the sample set as the fitness, to iteratively optimize the initial weights and thresholds, and obtain the optimized initial parameters.
[0208] Starting with the optimized initial parameters, the BP neural network is trained under supervision using a sample set until convergence, resulting in a pre-trained BP neural network model.
[0209] The parameters of the sparrow search algorithm include: population size, maximum number of iterations, and the ratio of discoverers, joiners, and watchers.
[0210] Obtaining and parsing 3D surface model files, specifically including:
[0211] Read STL model files in ASCII format;
[0212] The normal vector data of the triangle face is extracted by identifying the keyword "facetnormal" in the file, and the vertex coordinate data of the triangle face is extracted by identifying the keyword "vertex".
[0213] The total number of triangular faces in the 3D surface model file is determined by the number of lines in the STL model file.
[0214] The initial geometric data of each component undergoes redundancy removal and smoothing processes, specifically including:
[0215] Iterate through all vertex coordinate data for each component, merge vertices with the same spatial position, and assign an index to each unique vertex to generate a vertex coordinate array and an index array;
[0216] Based on the index array and the initial surface normal vector data of the corresponding parts, calculate the average normal vector corresponding to each unique vertex, and generate the vertex normal vector array of the corresponding parts.
[0217] The Laplacian smoothing algorithm is used to iteratively adjust the vertex positions in the vertex coordinate array, and the vertex normal vector array of the corresponding component is recalculated based on the adjusted vertex coordinates.
[0218] The optimized model data includes at least the vertex coordinate array, vertex normal vector array, and index array of the corresponding component.
[0219] The optimized model data is loaded into the graphics processing unit's video memory via a graphical interface, specifically including:
[0220] Create and bind a vertex array object for each component, and create at least two vertex buffer objects;
[0221] Store the vertex coordinate array in the optimization model data corresponding to each component into the first vertex buffer object, and store the vertex normal vector array into the second vertex buffer object;
[0222] Configure vertex attribute pointers for the vertex array object to describe the organization format, offset, and step size of the vertex coordinate data and vertex normal vector data, respectively;
[0223] The first vertex buffer object and the second vertex buffer object are associated with the vertex array object and uploaded to the video memory of the graphics processing unit.
[0224] Performing view transformation calculations specifically includes:
[0225] Set the spherical coordinate parameters of the virtual camera. The spherical coordinate parameters should include at least the azimuth angle, pitch angle, and viewing radius.
[0226] Calculate the three-dimensional position coordinates of the virtual camera in the world coordinate system based on the azimuth angle, elevation angle, and observation radius;
[0227] Using the origin of the robot's coordinate system as the observation target point, and based on the position coordinates of the virtual camera and the observation target point, a view transformation matrix from the world coordinate system to the camera coordinate system is constructed.
[0228] An orthogonal projection method is used, and an orthogonal projection matrix is constructed based on preset projection cube parameters;
[0229] Based on the view transformation matrix and orthogonal projection matrix, the vertex coordinates of each component after transformation by theoretical pose data are converted from the world coordinate system to standardized equipment coordinates.
[0230] The algorithm used to perform the lighting calculations is the Phong lighting model algorithm, which specifically includes:
[0231] Calculate the ambient light component acting on each component model;
[0232] Calculate the diffuse reflection light component based on the direction of the light source and the normal vector of the corresponding component model surface;
[0233] Calculate the specular reflection component based on the observer's direction and the direction of the reflected light;
[0234] The ambient light component, diffuse light component, and specular highlight component are superimposed and blended with the surface color of the component model to output the final lighting color of each point on the surface of the component model.
[0235] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.
Claims
1. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot, characterized in that, Includes the following steps: Acquire real-time joint data collected by position sensors deployed on each active joint of the robot; Perform forward kinematics calculations on real-time joint data to obtain the robot's end-effector pose data; Perform inverse kinematics calculations on the end-effector pose data to obtain theoretical pose data describing the spatial position and attitude of each component of the robot; Acquire and parse the robot's 3D surface model file, and extract the initial geometric data of each component; The initial geometric data of each component is deredundant and smoothed to obtain the optimized model data of each component, and the optimized model data of each component is loaded into the video memory of the graphics processing unit through the graphics interface. Based on the optimized model data already loaded into video memory, the graphics rendering pipeline is invoked to perform view transformation and lighting calculations, generating rendered image data for each component. Theoretical pose data is applied to the graphics rendering pipeline, driving the graphics processing unit to perform spatial transformation and dynamic assembly of the rendered image data of each component based on the theoretical pose data, and synthesizing and outputting a dynamic 3D visualization image of the entire robot.
2. The three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 1, characterized in that: Acquire real-time joint data, specifically including: It receives motor pulse data corresponding to the movement of each active joint, which is collected by the encoder, and transmits it to the main control unit through the industrial bus; In the main control unit, the displacement variable is calculated based on the motor pulse data corresponding to the linear active joint, the number of encoder pulses per revolution, and the lead screw. The angle variable is calculated based on the motor pulse data corresponding to the rotary active joint and the number of encoder pulses per revolution; Displacement and angle variables are used together as real-time joint data.
3. The three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 1, characterized in that: Perform forward kinematic calculations on real-time joint data, specifically including: The displacement variables of the linear active joint are input into a pre-trained BP neural network model to obtain the initial position estimate of the end point of the parallel mechanism; The initial position estimate is iteratively refined using the Newton-Raphson iterative method to obtain high-precision end position data of the parallel mechanism; By combining the angular variables of the active rotating joints and the geometric parameters of the robot's serial rotating head structure, the end-effector pose data is calculated based on the end-effector position data of the parallel mechanism.
4. The three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 3, characterized in that: The BP neural network model is trained through the following steps: Randomly sample the coordinates of the end point within the workspace of the robot's parallel mechanism; The displacement of the linear active joint corresponding to each coordinate position is calculated by inverse kinematics. The training sample set is constructed by using the displacement as the input feature and the corresponding coordinate position as the output label. Initialize the weights and thresholds of the BP neural network; The sparrow search algorithm is used, with the network prediction error on the sample set as the fitness, to iteratively optimize the initial weights and thresholds, and obtain the optimized initial parameters. Starting with the optimized initial parameters, the BP neural network is trained under supervision using a sample set until convergence, resulting in a pre-trained BP neural network model.
5. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 4, characterized in that: The parameters of the sparrow search algorithm include: population size, maximum number of iterations, and the ratio of discoverers, joiners, and watchers.
6. The three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 1, characterized in that: Obtaining and parsing 3D surface model files, specifically including: Read STL model files in ASCII format; The normal vector data of the triangle face is extracted by recognizing the keyword "facetnormal" in the file, and the vertex coordinate data of the triangle face is extracted by recognizing the keyword "vertex". The total number of triangular faces in the 3D surface model file is determined by the number of lines in the STL model file.
7. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 6, characterized in that: The initial geometric data of each component undergoes redundancy removal and smoothing processes, specifically including: Iterate through all vertex coordinate data for each component, merge vertices with the same spatial position, and assign an index to each unique vertex to generate a vertex coordinate array and an index array; Based on the index array and the initial surface normal vector data of the corresponding parts, calculate the average normal vector corresponding to each unique vertex, and generate the vertex normal vector array of the corresponding parts. The Laplacian smoothing algorithm is used to iteratively adjust the vertex positions in the vertex coordinate array, and the vertex normal vector array of the corresponding component is recalculated based on the adjusted vertex coordinates. The optimized model data includes at least the vertex coordinate array, vertex normal vector array, and index array of the corresponding component.
8. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 7, characterized in that: The optimized model data is loaded into the graphics processing unit's video memory via a graphical interface, specifically including: Create and bind a vertex array object for each component, and create at least two vertex buffer objects; Store the vertex coordinate array in the optimization model data corresponding to each component into the first vertex buffer object, and store the vertex normal vector array into the second vertex buffer object; Configure vertex attribute pointers for the vertex array object to describe the organization format, offset, and step size of the vertex coordinate data and vertex normal vector data, respectively; The first vertex buffer object and the second vertex buffer object are associated with the vertex array object and uploaded to the video memory of the graphics processing unit.
9. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 1, characterized in that: Performing view transformation calculations specifically includes: Set the spherical coordinate parameters of the virtual camera, wherein the spherical coordinate parameters include at least the azimuth angle, the pitch angle, and the viewing radius; Calculate the three-dimensional position coordinates of the virtual camera in the world coordinate system based on the azimuth angle, elevation angle, and observation radius; Using the origin of the robot's coordinate system as the observation target point, and based on the position coordinates of the virtual camera and the observation target point, a view transformation matrix from the world coordinate system to the camera coordinate system is constructed. An orthogonal projection method is used, and an orthogonal projection matrix is constructed based on preset projection cube parameters; Based on the view transformation matrix and orthogonal projection matrix, the vertex coordinates of each component after transformation by theoretical pose data are converted from the world coordinate system to standardized equipment coordinates.
10. A three-dimensional visualization method for a five-degree-of-freedom hybrid robot according to claim 1, characterized in that: The algorithm used to perform the lighting calculations is the Phong lighting model algorithm, which specifically includes: Calculate the ambient light component acting on each component model; Calculate the diffuse reflection light component based on the direction of the light source and the normal vector of the corresponding component model surface; Calculate the specular reflection component based on the observer's direction and the direction of the reflected light; The ambient light component, diffuse light component, and specular highlight component are superimposed and blended with the surface color of the component model to output the final lighting color of each point on the surface of the component model.