Visual representation of the direct problem of kinematics of an industrial robot ABB IRB 140 using CoppeliaSim and Qt

In industrial robotics, there are two main tasks of kinematics: forward and reverse (inverse). The purpose of solving which is to determine the parameters of related flexible objects to achieve the required position, orientation and location of these objects [1, 2]… The theoretical results obtained must be confirmed in a practical way. The use of a real industrial robot for these purposes is not always possible. The best option is to use programs for simulation of robotic systems.

One of the tools for modeling robotic systems is the software package CoppeliaSimused in industry, education and research. Has a free (CoppeliaSim Player), educational (CoppeliaSim Edu) and paid (CoppeliaSim Pro) version. At the time of this writing, version 4.2.0 was available for download.

Simulator CoppeliaSim with an integrated development environment based on a distributed control architecture: each object / model can be controlled individually using a built-in script, plugin, nodes ROS / ROS2, knots BlueZERO, remote API clients, or custom solution. Supports work with different programming languages: Lua (used by default) Python, C / C ++, Java, Matlab, Octave, Urbi [3]…

The software package contains various models of ready-made robots, it also allows you to easily import your own, or, using basic primitives, create a robot model directly in it. To build complex models of robots, it is recommended to use specialized software, for example, such as SolidWorks, Autodesk Inventor etc.

Within the framework of this article, we will consider a robot model ABB IRB 140

ABB IRB 140 is a compact and efficient industrial robot with six degrees of mobility, capable of working with a load of up to 6 kg in a working area of ​​810 mm [4]…

Add a robot model ABB IRB 140 to the stage. To do this, in the model viewer in the tree robots need to choose no-mobile and drag industrial robot ABB IRB 140 to the stage. Industrial robot model ABB IRB 140 is shown in Figure 1.

Figure 1 - Model of an industrial robot ABB IRB 140
Figure 1 – Model of an industrial robot ABB IRB 140

Next, you need to remove unnecessary objects from the scene hierarchy, as shown in Figure 2.

Figure 2 - Scene hierarchy after removing unnecessary objects
Figure 2 – Scene hierarchy after removing unnecessary objects

For all hinges (IRB140_joint1 … IRB140_joint6) in the window Scene Object Properties in the tab Joint in field Mode meaning Torque / force mode needs to be changed to Passive mode

Next, we will consider the structure of a non-threaded child script for controlling a robot (programming language Lua).

Lua – extension programming language, designed to support general procedural programming with the ability to describe data [5]…

The general structure of the control script is shown in Figure 3.

Figure 3 - General structure of the control script
Figure 3 – General structure of the control script

The script in this example has four main functions, namely [6]:

sysCall_init () – initialization function. The initialization function is called when the simulation starts. It is called only once and is usually used to initialize variables, user interface, etc. Function sysCall_init () always called before the function sysCall_actuation ()

sysCall_actuation () – activation function. The activation function is executed cyclically during the simulation. It is the main function for controlling the robot.

sysCall_sensing () – sensor function. This function is designed to poll the state of the sensors during the simulation, and is performed at each stage of the simulation.

sysCall_cleanup () – cleaning function. This function is called when the simulation is stopped. The function is responsible for restoring the original configuration of the robot, clearing the states of the sensors, etc.

CoppeliaSim suggests creating a custom user interface (custom user interfaces) using the built-in plugin Qt… When creating the user interface, a special XML syntax. The syntax example is best displayed in the tutorial scene. customUI.ttt located in the root of the folder scenes at the installation location of the program.

Next, let’s start developing the control script.

For function sysCall_init ()let’s write the following code:

function sysCall_init()
    simJoints={0,0,0,0,0,0}
    for i=1,6,1 do
        simJoints[i]=sim.getObjectHandle('IRB140_joint'..i)
    end
    xml="<ui title="Forward Kinematics" closeable="true" on-close="closeEventHandler" resizable="false">"..[[
    <label text="Forward Kinematics for ABB IRB 140 using CoppeliaSim and Qt"/>
    <group layout="hbox">
    <label text="J1" id="11" />
    <hslider id="21" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="31" on-editing-finished="jointEntry" />
    </group>
    <group layout="hbox">
    <label text="J2" id="12"/>
    <hslider id="22" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="32" on-editing-finished="jointEntry" />
    </group>
    <group layout="hbox">
    <label text="J3" id="13"/>
    <hslider id="23" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="33" on-editing-finished="jointEntry" />
    </group>
    <group layout="hbox">
    <label text="J4" id="14"/>
    <hslider id="24" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="34" on-editing-finished="jointEntry" />
    </group>
    <group layout="hbox">
    <label text="J5" id="15"/>
    <hslider id="25" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="35" on-editing-finished="jointEntry" />
    </group>
    <group layout="hbox">
    <label text="J6" id="16"/>
    <hslider id="26" minimum="-500" maximum="500" on-change="sliderChange" />
    <edit value="0" id="36" on-editing-finished="jointEntry" />
    </group>
    </ui>
    ]]
    ui=simUI.create(xml)
end

For function sysCall_cleanup () let’s write the following code:

function sysCall_cleanup()
simUI.destroy(ui)    
end

When the simulation is stopped using the command simUI.destroy (ui) we destroy the user interface.

Let’s also add one more function closeEventHandler ():

function closeEventHandler()
simUI.hide(ui)
end

Function closeEventHandler () responsible for handling the events of the “close” button of the user interface.

Slider event handling function:

function sliderChange(ui,id,newVal)
   for i=1,6,1 do
	  if (id==20+i) then
         simUI.setLabelText(ui,10+i,string.format('J' ..i))
         simUI.setEditValue(ui,30+i,string.format(newVal))
         sim.setJointPosition(simJoints[i],newVal*math.pi/180)
		 break
	  end
   end
end

Function for handling events of editable fields:

function jointEntry(ui,id,newVal)
   if (tonumber(newVal)==nil) then
	  print("Error: could not convert number")
	  return
   end
   for i=1,6,1 do
	  if (id==30+i) then
		 simUI.setLabelText(ui,10+i,string.format('J'..i))
         simUI.setEditValue(ui,30+i,string.format(newVal))         
         sim.setJointPosition(simJoints[i],newVal*math.pi/180)
		 break
	  end
   end
end

Let’s start the simulation. The industrial robot can now be controlled using the user interface. The user interface window is shown in Figure 4. By setting the angles of rotation in degrees for each hinge, you can visually observe the change in the position of its links in coordinates XYZ, and having solved the direct problem of kinematics according to the known kinematic scheme – to check the results in a practical way.

Figure 4 - User interface window
Figure 4 – User interface window

The source file of the project is located on the GitHub service at the following link

Thus, the use of a simulator of robotic systems in education, research and industry has a number of advantages: virtual simulation is available to everyone and does not require significant financial costs; there is no possibility of causing material harm (damage to parts and components of the robot), due to possible human error; there is no danger to human life or health, due to the same possible human error. CoppeliaSim Is one such open source software suite that can be used to simulate any robots without much difficulty.

Literature

1. Direct kinematics. – Text: electronic // Wikipedia: [сайт]… – URL: http://ru.wikipedia.org/wiki/Direct_kinematics (date of access: 10/15/2021).

2. Inverse kinematics. – Text: electronic // Wikipedia: [сайт]… – URL: http://ru.wikipedia.org/wiki/Inverse_kinematics (date of access: 10/15/2021).

3. CoppeliaSim User Manual. – Text: electronic // Coppelia Robotics: [сайт]… – URL: https://www.coppeliarobotics.com/helpFiles/index.html (date accessed: 15.10.2021).

4. Industrial robot IRB 140. – Text: electronic // DeltaSvar: [сайт]… – URL: https://www.deltasvar.ru/katalog/abb/Industrial-robots-abb/Industrial-robot-irb-140 (date of access: 16.10.2021).

5. Lua 5.3 Manual. – Text: electronic // Lua: [сайт]… – URL: https://lua.org.ru/contents_ru.html (date accessed: 16.10.2021).

6. CoppeliaSim 实例 分析 系列 -ABB IRB140 (二). – Text: electronic // CSDN: [сайт]… – URL: https://blog.csdn.net/feima9999/article/details/111070411 (date accessed: 15.10.2021).

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *