Page 1 of 1

Center of sim.setObjectOrientation

Posted: 08 May 2020, 18:22
by SitStudent
Hi.

Is it possible to rotate this cuboid around this sphere using sim.setObjectOrientation?
As you can see this img, I tried simulation test, but this cuboid rotated around its frame.
I expected it rotate around sphere because I specified sphere as relativeToObjectHandle

please, your advice.

Image
https://d.kuku.lu/839016fcae

Re: Center of sim.setObjectOrientation

Posted: 11 May 2020, 05:55
by coppelia
Hello,

have a look at following API functions:
Cheers

Re: Center of sim.setObjectOrientation

Posted: 11 May 2020, 12:06
by SitStudent
Thank you for your reply.
I didn't know those functions.
Aren't there remote API functions ?

I couldn't find simxGetRotationAxis and simxRotateAroundAxis.

Re: Center of sim.setObjectOrientation

Posted: 12 May 2020, 13:16
by coppelia
Mentioned functions are regular API functions. If you need to call them from an external application, then place them inside of a script function, and call that script function from your external application.

Cheers

Re: Center of sim.setObjectOrientation

Posted: 12 May 2020, 15:51
by SitStudent
Is it simxCallScriptFunction?
For instance, When I want to call sim.setObjectMatrix, where should I place the function to call it?
I have one Non-threaded Child Script for remoteAPI in the scene .

Best regards,

Re: Center of sim.setObjectOrientation

Posted: 14 May 2020, 05:35
by coppelia
Have a look at some of the examples in programming/remoteApiBindings/python/python or in programming/b0RemoteApiBindings/python, which call simxCallScriptFunction.

Cheers

Re: Center of sim.setObjectOrientation

Posted: 15 May 2020, 07:22
by SitStudent
OK, Thank you.

I solved it using other method bcause b0-based API has few reference data...
I calculated the center position of cylinder based on sphere position from rotation matrix, and I used simxSetObjectPosition and simxSetObjectQuaternion. However, there is another problem.

Please watch these videos.

https://youtu.be/92WbkzZdQSA
https://youtu.be/r7jGpqFfG14

The first is the simulation all shapes dynamics is not working.
The second is the simulation UpperArm and ForeArm Shapes dynamics is working.

I want to control the model keeping like the first video, and keeping model dynamics(Mass of shapes).

Is there any way to stabilize the movement of the model while turning on the model dynamics?

Best regards,

Re: Center of sim.setObjectOrientation

Posted: 18 May 2020, 07:41
by coppelia
Then you will have to use revolute joints instead of spherical joints, and actuate them individually. Each joint will then need a controller, e.g. in order to move to a specified angular position. Have a look at how the various demo models in the model library were made to get an idea.

Cheers

Re: Center of sim.setObjectOrientation

Posted: 21 May 2020, 12:57
by SitStudent
If I use revolute Joints as controller, is sim.setJointPosition the only way to rotate the joint?

There is a serious problem in using IMU, so I can't specify the position of the joints.
I want to use quaternion and Rotation Matrix.

Is it difficult?

Best regards,

Re: Center of sim.setObjectOrientation

Posted: 21 May 2020, 13:45
by fferri
You have to use sim.setJointTargetPosition if the joint controller is enabled.