Object Orientation

Typically: "How do I... ", "How can I... " questions
Post Reply
Rizzi
Posts: 1
Joined: 19 Apr 2017, 16:09

Object Orientation

Post by Rizzi » 19 Apr 2017, 16:26

Hi,
I am new in VREP and I am having troubles with a remote API simulation.
I have simulated a vehicle dynamics to retrieve its position and orientation as time goes on (with a different software).
Afterward, I am using a Python script to set the position and orientation of the vehicle inside vrep.
Although orientation increases monotonically (from 0 degree to around 7 degrees), the vehicle (modeled as a simple cuboid) starts rotating and does many turns around the z-axis.

I tried removing the dynamic engine in order to simulate only the kinematics and I made the object not respondable and not dynamic, but the problem persists... Here there is the small piece of code where I loop over the position and orientation:
(Ts=0.5 sec)

Code: Select all

for i in range(n):
    vrep.simxSynchronousTrigger(clientID)
    err_pos = vrep.simxSetObjectPosition(clientID, Vehicle_handle, -1, [x_pos[i], y_pos[i], 0],
                                         vrep.simx_opmode_oneshot)
    err_or = vrep.simxSetObjectOrientation(clientID, Vehicle_handle, -1, [0, 0, yaw[i]], vrep.simx_opmode_oneshot)
    vrep.simxGetPingTime(clientID)
    time.sleep(Ts)
Many thanks for the help!

coppelia
Site Admin
Posts: 6185
Joined: 14 Dec 2012, 00:25

Re: Object Orientation

Post by coppelia » 21 Apr 2017, 07:33

Hello,

what happens if you try to do the same things via the V-REP user interface? Do you have the same kind of problems?
You code is basically only modifying the rotation amount around the object's Z-axis. That should work without problem. But keep in mind that the angles the API is expecting are expressed in radians, not degrees.

Cheers

Post Reply