Page 1 of 1

Python Scripts not Working as Intended

Posted: 20 Sep 2022, 23:30
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.

Re: Python Scripts not Working as Intended

Posted: 22 Sep 2022, 20:23
by coppelia
Hello,

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

Cheers

Re: Python Scripts not Working as Intended

Posted: 25 Sep 2022, 19:46
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

Re: Python Scripts not Working as Intended

Posted: 25 Sep 2022, 20:08
by Cplan082
I copied the changes in the python script from V4.4 to V4.3, and it works now. Thank you!

Cheers

Re: Python Scripts not Working as Intended

Posted: 26 Sep 2022, 16:04
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