Page 1 of 1

sim.setObjectPosition and sim.setObjectOrientation through user-interface issue

Posted: 19 Aug 2022, 05:04
by cleu892
Hello, I am having trouble with getting sim.setObjectPosition and sim.setObjectOrientation to work properly. Attached along with this question is my scene file, because it’s a lot easier to explain what is going wrong that way!

Basically, if you run the scene and then click “Open Loop Control Course” upon the Custom UI starting, and then “Starting Position”, the robot will not be in the right position / be in the right orientation as described in my script. If you stop the scene and run again, this time pressing “Angle Control Course”, you’ll see the same sort of behaviour. If I pause the simulation and manually move the robot to our positions / orientations specified in the script using the Object Item / Shift and Object / Item Rotate buttons, it moves to our desired place properly - so I must be implementing something incorrectly, but I just can’t seem to figure out what, and have been stuck on this for a very long time!.

All of the functions have been written in the “Script” dummy object. If the code does not make sense, please let me know! Any help would be very very gratefully accepted.

Cheers

https://drive.google.com/file/d/1KPAlRB ... sp=sharing

Re: sim.setObjectPosition and sim.setObjectOrientation through user-interface issue

Posted: 19 Aug 2022, 16:09
by coppelia
Hello,

your scene is extremely large (you absolutely need to simplify the meshes you import!), and we cannot go through your code to debug it. Please post a minimalistic scene that illustrates your problem.

My guess is that you are trying to set the position/orientation of a dynamic model. This would be like teleportation of the base of the robot. You'll mess up things. Have a look at the demo scene scenes/teleportDynamicModel.ttt

Cheers

Re: sim.setObjectPosition and sim.setObjectOrientation through user-interface issue

Posted: 01 Sep 2022, 00:55
by cleu892
Hello,

Thank you for the reply! I checked out the scene you suggested, and changed from sim.setObjectPosition and sim.setObjectOrientation to sim.setObjectPose. However, I still seem to be getting the same issue...

I made a much more simpler scene (attached below) to demonstrate the problem. Basically, once the user starts the simulation and clicks "Distance Control Course" on the UI, the robot should move to the white starting area of the distance track. However, for some reason the robot moves off strangely and doesn't go to the desired position. Please let me know if the scene file is too big still or the code is still complicated - I've added comments such that hopefully the "Script" object makes a bit more sense. The issue is within the function called distanceClick(ui,id).

https://drive.google.com/file/d/1TxpKd9 ... sp=sharing

Cheers

Re: sim.setObjectPosition and sim.setObjectOrientation through user-interface issue

Posted: 01 Sep 2022, 14:42
by coppelia
Did you have a look at the teleport scene?
Make sure to also read this topic, which explains what might be going on in your scene.

Cheers