For many applications, a precise knowledge of the model of the robot is necessary for accurate and stable control. However, it is not always feasible or desirable to perform from scratch an in-depth study of the robot model, especially if it is not an element of concern for the respective application. In this article we present a methodology for identifying motor parameters of a robotic manipulator. We discuss the mathematical model and introduce an extensible toolbox with velocity-control based methodology for a fast identi cation of individual motor parameters. The results show that we can identify individual parameters even for joints that are commercialised as of the same type. Keywords: identi cation for control, UR5 robot, ROS, robots manipulators 1. INTRODUCTION Robotic manipulators are widely adopted in the automa- tion of industrial production. They are able to perform in harsh conditions, or in repetitive, tedious work that would otherwise hinder resources and raise costs. Technical innovations allow expansive in uence of robots in other territories, with service robotics, medical devices, agricul- ture, and logistics actively being developed [K.I.Goryanina et al., 2018]. Many of their use-cases require knowledge of the robot model, either to eciently perform simulations before employing the real manipulator or for the develop- ment of model-based control. Modelling of physical systems for control purposes is re- quired to capture the main features of the system, while being mathematically tractable [Garulli et al., 2009]. To derive the model of a robotic manipulator we need the inertial parameters (such as mass and moments of inertia), and the parameters of the motors (friction, motor dynam- ics etc.). While mass parameters are often provided by the manufacturer, there is usually little to no information on the parameters of the motors of the robot. Assuming a rigid connection, these consist mainly of the torque-current characteristic of the motors and the friction coecients between the elements of the joints. The friction description depends on several characteristics: the geometry and roughness of contact surface, materials used, type of lubricant, velocity, humidity, temperature, wear, etc [Andersson et al., 2007]. Many friction models have been proposed in order to e ectively de ne the friction dynamics, from the most common Coulomb model, to the addition of Stribeck function, to more complex state dependent models like Dahl, LuGre models [van Ge en, 2009]. A more detailed friction representation will add complex nonlinearities in the overall dynamic model. This could lead to a lengthier process in both the design and in theactual runtime of the simulation, o ering a higher model accuracy while taking away time that could be used for application architecture and experiments. Concurrently, any model-based controller would have a more convoluted con guration. One of the de ning characteristics of a motor is the torque- current coecient. It is speci c to the motor's design, including its magnetic strength, number of wire turns, armature length etc. The relation between current and torque is di erent, depending on whether the motor is a DC or an AC one, and can introduce several additional nonlinearities in the model. The robot's full dynamic model incorporates the motor's aspects presented above. The motor can have other dy- namics of its own, but a simpli cation may prove ac- ceptable if the robot control is robust, be it the default implemented controllers of the robot itself or a newly designed one. The kinetic and behavioural aspects of a robotic manip- ulator are expressed in the dynamic model, which relates joint torques to the robot motion. This model can vary in complexity, depending on the purpose it is used for. Identi cation of the dynamic parameters of the model can be approached from multiple angles [Madsen et al., 2020]: Disassembly of each link and joint in order to directly evaluate mass, moments of inertia, joint friction etc. However this process is a tedious one, with time consumed for the manual operations, and it needs reiteration if any hardware changes occur. Computer Aided Design (CAD) allows the dynamic parameters of each link to be found using nominal geometric and material characteristics. Nonetheless, the CAD parts may not be identical to the physical correspondents and thus the accuracy of the parame- ters is decreased. Furthermore, the motor parameters are not available. System identi cation strategies, which analyse the input-output behaviour of the robot, are preferred due to their exibility, reliability, and availability. Various models are implemented in literature, using the Lagrangian, Newton-Euler or Kane formulations as a starting point [Sciavicco et al., 1995, Jubien et al., 2014, Ni et al., 2019, Madsen, 2020] . From that, several other additions may be introduced, for a more accurate model: taking into consideration the exibility of the joints [Mad- sen et al., 2020, Madsen, 2020, Zollo et al., 2014], selecting an appropriate friction model [Khan et al., 2016, Madsen, 2020], adding action of external forces, modelling distur- bances, favoring the nonlinear motor torque coecient over an approximation and other similar decisions. This article presents the methodology used for a fast and accessible identi cation of torque-current and friction coef- cients in a set of motors. We derived a simpli ed dynamic model that can be generalised to other types of robotic manipulators, and implemented an identi cation toolbox that can be used out-of-the-box. For the purpose of demon- strating and assessing the identi cation of motor parame- ters under simpli cation hypotheses, we conducted exper- iments on a UR5 (Universal Robots, Odense, Denmark). The UR5 robotic arm belongs to a family of collaborative robots with great exibility, designed speci cally for safe operation near humans. This speci c robotic manipulator accommodates integrated strain wave gearboxes, brushless AC permanent magnet synchronous motors (PMSM), po- sition sensors, and brakes. The article is structured as following: Section 2 expands on the mathematical equations of the UR5, discussing some modelling variations, while section 3 explains the method- ology reasoning and implementation of the identi cation process. The experiments' results are provided in section 4. Finally, section 5 discusses the implications and validity of the experiments and the accessibility of the method compared to other approaches. 2. MATHEMATICAL MODEL The UR5 robot is a six degree of freedom robot with six revolute joints, each with a range of ( 2;2) with velocities up to rad/s. Fig. 1 displays the physical depiction of the robot. Fig. 1. The UR5 robot. The blue straws represent the positive direction of the axes of rotation of the joints. The joint coordinates are de ned as q, whereq= [q1;q2;q3;q4;q5;q6]T, andqirepresents the angle value cor-responding to the i-th joint. Likewise, the joints velocities, accelerations and torques are de ned as vectors _ q;q; . The forward kinematics allow computation of the pose of a robot's end-e ector, given the state of the joints. The UR5 kinematic model is constructed using the standard Denavit-Hartenberg parameters [Denavit and Hartenberg, 1955, 1965] already provided by the manufacturer, sum- marized in table 1. Using this convention, each link has four parameters assigned to it, depending on its own and subsequent frames of coordinates: link length r, link rota- tion angle , joint angle and link o set d. Table 1. D-H parameters for the UR5 Linki[rad]di[m]ri[m] i[rad] 1q1 0.1519 0 =2 2q2 0 -0.425 0 3q3 0 -0.39225 0 4q4 0.10915 0 =2 5q5 0.09465 0 - =2 6q6 0.0823 0 0 Table 2. Mass properties of the UR5 Link Mass[kg] Center of Mass Position[m] 1 3.7 [0,-0.02561, 0.00193] 2 8.393 [0.2125, 0, 0.11336] 3 2.33 [0.15, 0, 0.0265] 4 1.219 [0, -0.0018, 0.01634] 5 1.219 [0, 0.0018, 0.01634] 6 0.1879 [0, 0, -0.001159] The dynamic model takes into consideration the forces and torques acting on the robot, as well as the kinetic properties of the manipulator (mass, moments of inertia, center of masses, joint elasticity, friction, etc). The mass properties of the UR5 are collected in table 2, as declared by the manufacturer. Each of the robots in the UR series have these parameters available. Moreover, the user of the identi cation toolbox has the freedom to edit them corresponding to their own robot. In order to discuss the dynamic modelling and its sim- pli cation, we formulate a general system of equations as such: M(q)q+C(q;_q) _q+G(q) = m ext dist f(1) whereMis the inertia matrix, Cthe matrix of centrifugal and Coriolis forces, Gthe vector of gravitational torque or force. The right side of the equation is composed of the motor torque m, external torques ext, a disturbance term distand the friction torques fthat act on the joint. The dynamics involved in the joints are portrayed in (1) and depend on position, velocity, and acceleration. The experiment has been thought to not have any external forces acting on the robot, in order to simplify the work- ow. The disturbances will not be modelled, based on the assumption that the experiment's movements are simple and isolated, and that the identi cation process will issue generally valid parameters. In the case of DC motors, the torque-current characteristic is proportional: m=kcti (2) whereirepresents the currents sent to the motors. That is not the case with AC motors, where the torque current characteristic is nonlinear and dicult to model [Rusnicki et al., 2015, Restrepo and Gautier, 1995]. How- ever, Restrepo and Gautier [1995] showed that kctcan be approximated with two methods: taking mean or median value of the ratio Em=_qm- whereEmand _qmare the am- plitude of sinusoidal emf (DC electromotive force voltage) between 2 phases, respectively the rotor velocity; or using an equivalent DC motor methodology to represent the AC con guration. Both cases allow the treatment of kctas a constant. In order to have variables that are easy to measure and as few as possible in the robotic model, the function of the motor torque will therefore be a linear one as in (2). Joint friction is another nonlinearity that has been dis- cussed in literature and proved to have an acceptable simpli cation for robotics application consisting of only the Coulomb and viscous friction [F.Marques et al., 2016], that is f=kfcsign( _q) +kfv_q; (3) where thesign function is de ned as sign(x) = +1; x> 0 1; x< 0(4) Putting together (1), (2), (3), and taking into consider- ation aforementioned simpli cations, the general relation used to describe the dynamics becomes: kcti=kfcsign( _q) +kfv_q+M(q)q+C(q;_q) _q+G(q) (5) The identi cation process will use this robot model for the parameter analysis. 3. PARAMETER IDENTIFICATION EXPERIMENT AND METHODOLOGY 3.1 Model used for the identi cation Parameter identi cation has been generally approached by computing a set of base parameters as a linear combination of dynamic coecients, employing search algorithms from least square method [Atkenson et al., 1986] to genetic algorithms, arti cial bee colony algorithms [Ding et al., 2015], weighted maximum likelihood estimation [J.Swevers et al., 2007] and other methods that use a regressor matrix. These methods would demand experiments with a speci c optimised trajectory [Swevers et al., 1997] that also has to be calculated according to the base parameters. To reduce the time consumed on experiments and the identi cation process, the identi cation algorithm searches just for the torque-current( kct) and friction( kfc;kfv) coef- cients, considering the other parameters (mass, inertia) known from the manufacturer speci cations. Furthermore, the experiments will consist of trajectories of constant velocities, thus eliminating a degree of variability with the joint acceleration term. This feature changes (5) into:kcti=kfcsign( _q) +kfv_q+C(q;_q) _q+G(q) (6) The gravity term Gis computed automatically depend- ing on the state and mass properties of the robot, using the Recursive Newton Euler Algorithm [J.Y.S.Luh et al., 1980] without taking acceleration terms into account. The centrifugal matrix Cis derivated from the Euler-Lagrange formulation of the dynamic model [Spong and Vidyasagar, 2006].GandC_qare computed with regards to all the joints' measured position and velocity, ending up being column vectors. However, since each motor undergoes the identi cation procedure separately, only the element cor- responding to that joint will be taken into consideration. We performed measurements of current, position, and ve- locity for each joint independently to identify and analyse the torque-current( kct) and friction( kfc;kfv) parameters, based on (6). This takes into account the individuality of each of the joints' parameters, but can also serve as a valid comparison between di erent joints of the same type. The procedure allows for fewer cross-correlated joint disturbances in the measurements. Fig. 2 depicts a sample measurement. Fig. 2. Sample measurement of a joint moving under con- stant velocity. The position (red), velocity (yellow), and current (blue) are visible for the duration of the measurement Considering a movement of constant _ q, (6) can be written in terms of the measured current for each joint: ij=kfcjsign( _qj) +kfvj_qj+Gj(q) +Cj;j(q;_q) _qj kctj(7) withj=f1;::;6g. Currentij, positionsq, and velocities _ q are all varying with time. 3.2 Experiment preparations Some details need attention in order for the identi cation algorithm to properly work. The mounting of the robot in uences the gravity forces that act on it. In our case the robot was mounted with the axis of rotation of the rst joint parallel to the gravitational eld, the gravity term for that joint was therefore zero. This makes (6) redundant, and we cannot identify kct,kfvandkfcat the same time. We choose therefore to use a prede ned value for the torque-current coecient (e.g. approximated from the other two joints of the same type), so the search would be run only for the friction coecients. To avoid having a zero gravity term for the last joint as well, we attached a mass o the axis of rotation of joint 6. To have more uniform and accurate results, we attached the same mass to the robot while performing the identi cation on the smaller joints (4th, 5th and 6th). A photo of the added mass can be seen in Fig. 3. Fig. 3. Added mass o the axis of rotation, used for the identi cation of joint 4, 5, and 6 3.3 Identi cation procedure For each joint, the parameter identi cation consists of three stages: (1) The identi cation of torque-current coecient kctand the total friction torque f (2) The identi cation of viscous kfvand Coulomb friction parameters kfc (3) The analysis of all acquired data to nd a triple (kct;kfv;kfc) as the conclusive parameters for each joint. For a single joint, the data from one experiment can be written in the next matriceal form: 2 664im1 im2 ... imn3 775=2 664sign( _qm) _qmG(q1) +C(q1;_qm) _qm sign( _qm) _qmG(q2) +C(q2;_qm) _qm ......... sign( _qm) _qmG(qn) +C(qn;_qm) _qm3 775"kfc=kct kfv=kct 1=kct# (8) imn,qncorrespond to the nthtimestep from measurement m, whileqmis the velocity used for the respective mea- surement. The system does not have a solution because the matrix from (8) does not have full rank. This comes as a conse- quence of the rst two columns that are linearly depen- dent, having the same values all through, since velocity qmis xed. To overcome this, we combine the friction terms into f=kfcsign( _qm) +kfv_qm, obtaining: imn= f+Gmn+Cmn_qm kct(9) for which a solution can be found.The rst stage (identi cation of kctand f) is executed on iterations of the same velocity, using the Nelder-Mead minimization [Nelder and Mead, 1965] for the tting of the current. The second stage (identi cation of kfvandkfc) takes the pairs of _ qand ffrom all measurements of di erent velocities and uses (8) for a new tting. Fig. 4 presents the tting results respective to the measure- ment from Fig. 2 as a comparison between the measured and estimated current, with parameters kct= 12:0167 and f=7:3853. Fig. 4. Sample of current tting 3.4 Software implementation aspects The software package that aids in the identi cation process is making use of both the Robot Operating System (ROS) utilities [Stanford Arti cial Intelligence Laboratory et al., 2018] and an analysis tool of preference between [MAT- LAB, 2020] and Python [Rossum and F.L.Drake, 2009]. ROS is an open-source framework designed for robot software applications. The robotic arms from the Universal Robots company bene t from community support and an already implemented ROS driver. While connected to ROS, the UR5 can perform di erent pre-de ned tasks, coded speci cally for the identi cation work ow, and provide enough real-time data to be later investigated and interpreted. We used two controllers from the Universal robots ROS driver , provided by Universal Robots: a trajectory position controller , that is used to position the robot in the initial state before a measurement, and the joint group velocity controller that is used to perform the motions for the identi cation process. Initial joint positions, distance of travel, velocities, and number of iterations are all read from an input le that the user lls in with desired values prior to a round of experiments. For the identi cation process, the user may choose between the provided MATLAB and Python applications, depend- ing on their own setup and experience. It can easily be con- ducted using the provided application and its documenta- tion, found at [https://gitlab.utcluj.ro/true-rehab/robot- identi cation]. The measurements are employed from ROS and are automatically collected in bag les once the ex- periment starts. The user then has to import those les in the identi cation toolbox and select the type of robot he is working with, after which the identi cation process is commenced. 4. RESULTS The rst identi cation stage from the experiments deliv- ered results concerning the torque-current constant kct. Fig. 5 and 6 present the characteristic of the torque-current relationship with respect to velocity, grouped by type of motor. By reasons of safety, the second and third joint were analysed in the (-1,1)[rad/s] range. Fig. 5. Joint 2, joint 3 torque-current coecient com- parison. Each box expands between the 1st and 3rd quartile of the torque-current coecient for a speci c velocity. An additional line is positioned at the me- dian. The whiskers show the data below and above the 1st and 3rd quartile respectively. Fig. 6. Boxplots summarising the torque-current coe- cients for joint 4, joint 5, and joint 6 The friction coecients, kfvandkfchave been found by rst taking the means of the torque-current coecient for each velocity and then using those values in a second tting stage. A batch of measurements for the friction identi cation consists of one measurement for each velocity in the chosen range. Fig. 7 and 8 show the distribution of the friction coecients. For each joint an average is made to use in the model. The resulting coecients are presented in table 3. The kfc andkfvvalues are uniquely determined for each joint in the second stage, while the kct nal value is obtained by averaging the coecients found for all the velocities. Fig. 7. Friction term comparison for joint 1, 2 and 3. While the dotted points represent the calculated full friction term ffrom the rst step of the identi cation with regards to velocity, the lines are drawn using (3) with thekfvandkfcthat were identi ed. Fig. 8. Friction term comparison for joint 4, 5 and 6 Table 3. Final results for the torque-curent, viscous and Coulomb coecients Jointkctkfvkfc 1 12.3 8.1272 12.3141 2 12.6351 7.7891 11.881 3 12.0383 6.9762 10.7667 4 7.7366 2.4405 1.8286 5 7.9228 2.6265 1.2794 6 7.4723 3.6058 0.8921 5. DISCUSSION Fig. 5 and 6 show that for each velocity used in the experiments, the torque-current values resulting from dif- ferent measurements exhibit low variability for each joint. However joints of the same type present a di erence in the mean of the coecient, which may further a ect the identi cation of friction coecients and ultimately the parity between the model and the real robot. The nal values ofkct,kfvandkfcindicate the particularity of each joint, even if the rst three and the last three adhere to the same type of motor. This highlights further the need for a joint-by-joint identi cation both for the torque-current and friction coecients. The friction model we used in the identi cation adopted only the viscous and Coulomb friction terms expressed in relation (3), without other nonlinear characteristics. This implies the existence of a slope proportional to the joint velocity and an o set conditioned by the sign of the same velocity. However, the system is in fact a exible joint manipulator robot, with the joint torques and friction depending on both the link and rotor angular positions. Furthermore, more complete friction models of robot joints have been described in literature [Andersson et al., 2007], [F.Marques et al., 2016]. Nevertheless, our results indicate that the simple friction formulation can capture most of the system's behaviour. The additional accuracy that would come from modelling the joints as exible ones would also imply the cost of twice the number of generalized coordinates [Madsen, 2020], hence a more complicated identi cation process. Furthermore, the direct assessment of rotor positions may not be available or would require heavy preparation. Determination of joint-speci c motor parameters may in- crease accuracy in simulations and behaviour analysis of the system, but it could also help in model-based control design for speci c manipulator robots. The simple and precise model that results from our proposed identi cation methodology can cut back on time and resources in rst stages of robot application implementation, allowing users to focus on the target application. ACKNOWLEDGMENT This work was supported by a grant of the Romanian Ministry of Education and Research, CNCS - UEFIS- CDI, project number PN-III-P1-1.1-TE-2019-1975, within PNCDI III.