joints being moved from different sources simulateously.

Report crashes, strange behaviour, or apparent bugs
Post Reply
BDG
Posts: 4
Joined: 30 Jul 2015, 03:07

joints being moved from different sources simulateously.

Post by BDG »

Hello, Copellia.

This issue is probably more my fault than somehting you need ot fix, but I think it is worth making it known.

I had a very simple way of tracking an object through space and printing the results.

tempPos = simGetObjectPosition(tracker, trackerBase)
simAddStatusbarMessage(tostring(tempPos[1]).." "..tostring(tempPos[2]).." "..tostring(tempPos[3]))

I set some joints (X,Y,Z) to motion mode to move the object around space. To my surprise the X position readout remained unchanged despite the object clearly moving. At this point I realized that I still had an external program calling simxsetjointposition setting X to 0. So the position of the joint was being constantly set to 0 from an external command whilst the joint was in motion mode. The command simGetObjectPosition seemed to be using the externally set position of the joint, whilst the visual representation seemed to be using the motion mode of the joint.

Sorry if this sounds complicated. Here are some steps that would help you recreate the problem.

Set up a new scene with a cuboid at the origin. Attach a joint in motion mode to it and another object on the end. When running use simxsetjointposition to constantly set the joint to 0. Print out simGetObjectPosition and see if it matches what is shown in the screen.

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

Re: joints being moved from different sources simulateously.

Post by coppelia »

Hello,

yes, if you try to control a joint from different locations, you might get a strange behaviour. Actually, the different controllers might apply their values at different execution time (e.g. in the actuation section or sensing section of a simulation step).

The motion mode of a joint was very confusing for many people since it happens in a hidden fashion, and it has been removed in last V-REP release. The same behaviour however can still be achieved via a child script that will allow for much more flexible and precise control of a joint (or a path) than with the motion mode. Have also a look at this post that explains the alternative approach (the post illustrates this for a path, but for a joint it is very similar).

Cheers

Post Reply