Issue setting new Pioneer object position calling server function

Typically: "How do I... ", "How can I... " questions
Post Reply
Posts: 1
Joined: 11 Oct 2019, 22:38

Issue setting new Pioneer object position calling server function

Post by lostgoatonhill »


V-REP Edu using Python (legacy API). After many challenges attempting to set new object position for Pioneer P3DX (robot explodes, wheels get left behind), and pouring over available similar forum posts, I took a new apporach, as suggest by Coppelia.

I looked at the example server-side script remoteApiCommandServer, and attached this as non-threaded child script to dummy object in simple scene. I proved call from client side Python to this server script with the displayText function - all good.

I then within my Python script called executeCode_function with the following:

code = "simSetObjectPosition(" + str(self.robot.handle) + ", -1, {-1.2445,-5.3750,0.1388})"

It too moves the Pioneer body but leaves the wheels behind.

If I put the same command in the init() function of the serverside remoteApiCommandServer, the setting of new object position for the robot works perfectly:

function sysCall_init()
sim.setObjectPosition(handle, -1, {-1.2445, -5.3750, 0.1388})

Grateful for help as pulling my hair out for hours on this, and now seem so very close!

Thanks ever so much.

Site Admin
Posts: 7911
Joined: 14 Dec 2012, 00:25

Re: Issue setting new Pioneer object position calling server function

Post by coppelia »


the problem is that you are trying to instantaneously move a dynamically enabled model. It is similar to if you would instantaneously move a car by a few meters: the body might move, but the wheels and all the rest will break because of the inertia.

So what you need to do is following:
This is telling the physics engine to remove all those objects from its dynamic representation.

It is important that above setps are executed inside the same simulation step. This means that if you are doing this from a threaded child script, you'll have to enclose above code inside of:

Code: Select all

... (above code)

Post Reply