## Confusion about some parameter setting

Typically: "How do I... ", "How can I... " questions
kjh
Posts: 8
Joined: 09 Feb 2020, 06:25

### Confusion about some parameter setting

hi

I am doing some simulatioins with the UR5 robot model provided in CoppeliaSim and now have some problems with it. I would like to ask you some questions.

First,based on my personal understanding, every object has it own shape reference frame and the origin of it is the center of the mass of the object. And the principal moments of inertia / mass of the object is relative to the shape reference frame. But in the UR5 model provided, the origin of the shape reference frame is not the real center of the mass of the UR5 robot in reality. I try to change the shape reference frame of the links in the model but it did not work. I can change the orientation only and can not change the position. I have the inertia matrix related to the center of the mass according to the real UR5 robot but it can not apply to the UR5 model provided because their referece frames are different. How can I solve the problem? Try to change the frame of the model or make the matrix transformation from the real robot frame to model provided?

Also, I am using the remote API with python script to control the robot. I want to start the simulation from the python cilent rather than start the simulation by clicking the button so that the server and client can work simultaneously
. What can I do to achieve it?

coppelia
Posts: 7706
Joined: 14 Dec 2012, 00:25

### Re: Confusion about some parameter setting

Hello,

in CoppeliaSim a shape's reference frame is always the geometric center (not center of mass): while you can change the orientation of the frame, you can't decide of its position relative to the shape. But you can always use a dummy attached to your shape, to indicate a specific position/orientation relative to the shape.

The inertia and center of mass of a shape is expressed relative to the shape's reference frame as described above. Understandably this can be annoying, for that reason you have the possibility to express them relative to the world reference frame via the Set inertia matrix and COM relative to absolute frame button.

If you need to set the inertia and COM relative to another reference frame than the world, you can temporarily move your shape onto the desired reference frame, then set the inertia and COM relative to the absolute reference frame, then move your shape back.

About starting the simulation from your remote API client, you can use simxStartSimulation (legacy remote API) and simxStartSimulation (B0-based remote API).

Cheers

kjh
Posts: 8
Joined: 09 Feb 2020, 06:25

### Re: Confusion about some parameter setting

Sorry I post it twice and can not delete the first one!
Really sorry for it!!!
Last edited by kjh on 03 Mar 2020, 16:03, edited 1 time in total.

kjh
Posts: 8
Joined: 09 Feb 2020, 06:25

### Re: Confusion about some parameter setting

coppelia wrote:
28 Feb 2020, 10:22
Hello,

in CoppeliaSim a shape's reference frame is always the geometric center (not center of mass): while you can change the orientation of the frame, you can't decide of its position relative to the shape. But you can always use a dummy attached to your shape, to indicate a specific position/orientation relative to the shape.

The inertia and center of mass of a shape is expressed relative to the shape's reference frame as described above. Understandably this can be annoying, for that reason you have the possibility to express them relative to the world reference frame via the Set inertia matrix and COM relative to absolute frame button.

If you need to set the inertia and COM relative to another reference frame than the world, you can temporarily move your shape onto the desired reference frame, then set the inertia and COM relative to the absolute reference frame, then move your shape back.

About starting the simulation from your remote API client, you can use simxStartSimulation (legacy remote API) and simxStartSimulation (B0-based remote API).

Cheers
Hi,

Thank you for your reply and it really helps me a lot. And now I have set all the values of the inertia and mass of every link according to the actual UR5 robot. Also, I try to input a Sinusoidal signal as the position input of every joint and want to measure the torque of the joints with the Vortex engine. But this time I get some other problems.

As you can see, there is something wrong with the joint1 and joint5. The output of these two joints are so strange. So I try to measure the position,velocity and the torque of them. It seems that the output of the position is normal but the velocity and torque are unusual. I have no idea with it. So could you please tell me the reason.

Also, even if I use the simxStartSimulation in legacy remote API I can not start the simulation in the python client.

Here are my scene and python code.
https://github.com/kejianhong/UR5

coppelia
Posts: 7706
Joined: 14 Dec 2012, 00:25

### Re: Confusion about some parameter setting

If you want to start the simulation from your remote API client, make sure that your remote API sevrer service is already running. In your case, you are starting a remote API server service on port 20000 only at simulation start, so that can't work.

Try using the default remote API server service that is always running on port 19997, and then you will be able to start a simulation from your client.

Cheers

kjh
Posts: 8
Joined: 09 Feb 2020, 06:25

### Re: Confusion about some parameter setting

coppelia wrote:
04 Mar 2020, 06:57
If you want to start the simulation from your remote API client, make sure that your remote API sevrer service is already running. In your case, you are starting a remote API server service on port 20000 only at simulation start, so that can't work.

Try using the default remote API server service that is always running on port 19997, and then you will be able to start a simulation from your client.

Cheers
Hi,

Recently I am doing something about the UR5 robot and find something wrong. I want to measure the torque of all joints. But I found that when I maesure the torque along the Z-axis, I always got strange result. So I made a simple test with only one link.
I made a cylinder and the mass of it is 10kg and the acceleration is +2*pi/25. According to the calculation, the result of the joint should be 0.5*1.25e-3*10*2*pi/25=+0.00315. But when I measure in the secene, the result is about -0.0025. What confused me is that the calculation result is plus while the simulation result is minus. This also happened to the first joint of UR5 robot during simulation. I check many times for my setting but still can not solve the problem.

Here is the scene and the code with the name of 'single_link.ttt' and 'single_link.py' .
https://github.com/kejianhong/UR5

coppelia
Posts: 7706
Joined: 14 Dec 2012, 00:25

### Re: Confusion about some parameter setting

So if I understand you correctly, you are trying to measure the torque needed to accelerate your cylinder? It would be helpful to have a self-contained scene that doesn't rely on external controllers.
Are the results the same with all 4 physics engines?
Are you sure the cylinder doesn't touch the floor?

Cheers

kjh
Posts: 8
Joined: 09 Feb 2020, 06:25

### Re: Confusion about some parameter setting

coppelia wrote:
26 Mar 2020, 09:06
So if I understand you correctly, you are trying to measure the torque needed to accelerate your cylinder? It would be helpful to have a self-contained scene that doesn't rely on external controllers.
Are the results the same with all 4 physics engines?
Are you sure the cylinder doesn't touch the floor?

Cheers
Hi，

Thanks for your reply. Well I want to measure the torque of the joint in simulation, and compare the simulation result with the calculation result.

According to your answer, I raised the cylinder and tried with 4 engines but still have the same problem whether in Python client or in Lua script. The simulation result is minus and the calculation result is plus.

The raidus of the cylinder is 0.05m and the mass is 10kg. Also I set the position of the joint by the function sim.simxSetJointTargetPosition and make the joint forward-rotate.The position function is a quadratic function so the acceleration is a constant ,about + 14.5 degree/s^2, which can be seen from the acceleration graph. It seems so starnge that in simulation the torque is minus(-0.0019) but according to calculation the torque should be plus(+0.00315) because the joint is forward-rotating.

Why they have different sign really confused me for several days!!!

I hope you can understand what I said and wait for your advice.

coppelia
Posts: 7706
Joined: 14 Dec 2012, 00:25

### Re: Confusion about some parameter setting

you should create a minimalistic scene that shows your problem, this means do first try to identify the problem in a self-contained simulation scene, that does not rely on an external controller and communication between them, since that makes identifying the problem much more difficult.

For tests, use a very simple script, e.g.:

Code: Select all

function sysCall_init()
h=sim.getObjectHandle('joint')
sim.setJointTargetVelocity(h,50*math.pi/180)
end

function sysCall_sensing()
print(sim.getJointForce(h))
end
Make sure that your joint is in force/torque mode, motor enabled, but controller disabled. Set a maximum torque around e.g. 0.1 and watch the output: you'll see that in the acceleration phase of the cylinder, the measured torque is negative and constant (negative since the cylinder inertia tends to hold the rotation in place, and the actuation tends to rotate the cylinder along positive direction).

Cheers