## Center of sim.setObjectOrientation

Typically: "How do I... ", "How can I... " questions
SitStudent
Posts: 12
Joined: 05 May 2020, 12:07

### Center of sim.setObjectOrientation

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

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

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

### Re: Center of sim.setObjectOrientation

Hello,

have a look at following API functions:
Cheers

SitStudent
Posts: 12
Joined: 05 May 2020, 12:07

### Re: Center of sim.setObjectOrientation

I didn't know those functions.
Aren't there remote API functions ?

I couldn't find simxGetRotationAxis and simxRotateAroundAxis.

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

### Re: Center of sim.setObjectOrientation

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

SitStudent
Posts: 12
Joined: 05 May 2020, 12:07

### Re: Center of sim.setObjectOrientation

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,

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

### Re: Center of sim.setObjectOrientation

Have a look at some of the examples in programming/remoteApiBindings/python/python or in programming/b0RemoteApiBindings/python, which call simxCallScriptFunction.

Cheers

SitStudent
Posts: 12
Joined: 05 May 2020, 12:07

### Re: Center of sim.setObjectOrientation

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.

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,

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

### Re: Center of sim.setObjectOrientation

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

SitStudent
Posts: 12
Joined: 05 May 2020, 12:07

### Re: Center of sim.setObjectOrientation

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,

fferri
Posts: 687
Joined: 09 Sep 2013, 19:28

### Re: Center of sim.setObjectOrientation

You have to use sim.setJointTargetPosition if the joint controller is enabled.