In my code even though I have defined a variable "guctutforD1" it says "UnboundLocalError: cannot access local variable 'guctutforD1' where it is not associated with a value".
the part where the code give error:
when writing code within CoppeliaSim, you need to follow the suggested script structure when attaching a new script to an object. For Python, this is typically:
#python
def sysCall_init():
sim = require('sim')
# do some initialization here
#
# Instead of using globals, you can do e.g.:
# self.myVariable = 21000000
def sysCall_actuation():
# put your actuation code here
pass
def sysCall_sensing():
# put your sensing code here
pass
def sysCall_cleanup():
# do some clean-up here
pass
# See the user manual or the available code snippets for additional callback functions and details
#python
def sysCall_init():
sim = require('sim')
# Put some initialization code here
# sim.setStepping(True) # enabling stepping mode
#
# Instead of using globals, you can do e.g.:
# self.myVariable = 21000000
def sysCall_thread():
# Put your main code here, e.g.:
#
# while not sim.getSimulationStopping():
# p = sim.getObjectPosition(objHandle, -1)
# p[0] += 0.001
# sim.setObjectPosition(objHandle, -1, p)
# sim.step() # resume in next simulation step
pass
# See the user manual or the available code snippets for additional callback functions and details