Rigid body dynamic properties
Posted: 28 Aug 2022, 16:31
Hi,
I am trying to simulate pick and place with two different objects (a cube) imported into coppelia sim differently.
a. Manual Import
b. Using API sim.importShape()
In case of option a, I am setting the Rigid body dynamic properties in the scene where the body is set to be respondable and the properties below are
Local respondable mask - > [x] [x] [x] [x] [] [] [] []
Global respondable mask -> [x] [x] [x] [x] [x] [x] [x] [x]
In case of option b, Imported using the API, I used the following lines of code,
In this case, the Rigid body dynamic properties in the scene are Body is Respondable
Local respondable mask - > [] [] [] [] [x] [x] [x] [x]
Global respondable mask -> [x] [x] [x] [x] [x] [x] [x] [x]
1. My question is how to make the set the local respondable mask in the case of 2, as same as case 1.
Does this any way affect the pick and place? (I read the documentation, however, if I'd really appreciate if you can give me a simpler explanation if possible please? )
2. Should this be called before or after setting/changing the physics properties via API?
3. Final question. I have to set Principal Moments of inertia / mass properties via API. At the moment, I am successfully able to send the values from my external script to Coppelia sim. I divide the Principal Moments of inertia with the mass of the object before sending to coppeliasim.
By using this as reference https://forum.coppeliarobotics.com/view ... tia#p36278, I tried to set the Principal Moments of inertia / mass properties. Please find the code from my script below (same to the object mentioned in question 1).
My question the values, printed are different to those seen in the GUI. Can you tell how to set the values please?
Thanks for you time in Advance
I am trying to simulate pick and place with two different objects (a cube) imported into coppelia sim differently.
a. Manual Import
b. Using API sim.importShape()
In case of option a, I am setting the Rigid body dynamic properties in the scene where the body is set to be respondable and the properties below are
Local respondable mask - > [x] [x] [x] [x] [] [] [] []
Global respondable mask -> [x] [x] [x] [x] [x] [x] [x] [x]
In case of option b, Imported using the API, I used the following lines of code,
Code: Select all
importObject = sim.importShape(0,"location",32,0,0.001)
objectRespondable = sim.convexDecompose(importObject,8,{1,2000,200,4,0,100000,20,4,4,200},{0.1,30,0.25,0.0,0.0,0.0,0.0,0.0,0.0,0.0})
sim.setObjectInt32Param(objectRespondable,3004,1)
sim.setObjectFloatParam(objectRespondable,3005,objectMass)
sim.setObjectInt32Param (objectRespondable,3019,65520)
sim.setObjectInt32Param(objectRespondable,3003,0)
sim.setObjectInt32Param(objectRespondable,10,256)
sim.setObjectParent(importObject, objectRespondable, true)
sim.resetDynamicObject(objectRespondable)
Local respondable mask - > [] [] [] [] [x] [x] [x] [x]
Global respondable mask -> [x] [x] [x] [x] [x] [x] [x] [x]
1. My question is how to make the set the local respondable mask in the case of 2, as same as case 1.
Does this any way affect the pick and place? (I read the documentation, however, if I'd really appreciate if you can give me a simpler explanation if possible please? )
2. Should this be called before or after setting/changing the physics properties via API?
Code: Select all
sim.resetDynamicObject(objectRespondable)
3. Final question. I have to set Principal Moments of inertia / mass properties via API. At the moment, I am successfully able to send the values from my external script to Coppelia sim. I divide the Principal Moments of inertia with the mass of the object before sending to coppeliasim.
Code: Select all
PInertiaX = 6.2768122006673e-05
PInertiaY = 6.3094194047153e-05
PInertiaZ = 6.2768122006673e-05
[sandboxScript:info] Simulation suspended.
[sandboxScript:info] Simulation resumed.
[sandboxScript:info] simulation stopping...
[sandboxScript:info] Simulation stopped.
Code: Select all
local transf=sim.getObjectMatrix(objectRespondable,-1)
local mass=objectMass
sim.setShapeInertia(objectRespondable,{inertialPropertyX, 0, 0, 0, inertialPropertyY, 0, 0, 0, inertialPropertyZ},transf)
Thanks for you time in Advance