Python Scripts not Working as Intended

Typically: "How do I... ", "How can I... " questions
Post Reply
Cplan082
Posts: 3
Joined: 18 Sep 2022, 16:42

Python Scripts not Working as Intended

Post by Cplan082 »

Hello,
I am trying to get the controlledViaScript.ttt scene (found in "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\scenes\controlTypeExamples") to work with the built-in python script. Two of the Three robots work as they should (the two Lua ones), but the python-controlled robot keeps backing up and turning forever. From what I gather, it is only supposed to backup turning for 3 seconds when it detects something in front of it. I've even removed the obstacle in front of it, but it still keeps backing up.
I have updated my default python interpreter in the "usrset.txt" file (I found the path to my default python interpreter by opening IDLE and entering
>> import os
>> import sys
>> os.path.dirname(sys.executable)).
I had also installed cbor and pyzmq with pip as I was prompted to do by the software (Python controlled robot did nothing before I did this). Any help would be greatly appreciated as I am a beginner with
Coppeliasim.

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

Re: Python Scripts not Working as Intended

Post by coppelia »

Hello,

can you try with CoppeliaSim V4.4, that was just uploaded? There was a bug in that scene previously...

Cheers

Cplan082
Posts: 3
Joined: 18 Sep 2022, 16:42

Re: Python Scripts not Working as Intended

Post by Cplan082 »

Thank you for replying,

I have now replaced my version of CoppeliaEdu with 4.4, but now I cannot find the "userset.txt" file anymore (used to be in "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\system"), so I cannot set the default python interpreter. How would I do that with V4.4?

Thanks

Cplan082
Posts: 3
Joined: 18 Sep 2022, 16:42

Re: Python Scripts not Working as Intended

Post by Cplan082 »

I copied the changes in the python script from V4.4 to V4.3, and it works now. Thank you!

Cheers

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

Re: Python Scripts not Working as Intended

Post by coppelia »

Cplan082 wrote: 25 Sep 2022, 19:46 ...I have now replaced my version of CoppeliaEdu with 4.4, but now I cannot find the "userset.txt" file anymore (used to be in "C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu\system"), so I cannot set the default python interpreter. How would I do that with V4.4?...
In CoppeliaSim V4.4 and later, the usrset.txt file in located in a system-specific application folder, e.g. c:/users/userName/AppData/Roaming/CoppeliaSim/. You can find out about that location by typing following in the statusbar console:

Code: Select all

sim.getStringParam(sim.stringparam_usersettingsdir)
Cheers

Post Reply