I just tried to reset simulation, but pycharm reported this error to me. I did not set anything about the position. I just used a negative speed value on the motor, but there was no problem before reset. Please tell me. what do I do?
from controller import Supervisor
robot = Supervisor()
keyboard = robot.getKeyboard()
timestep = int(robot.getBasicTimeStep())
keyboard.enable(timestep)
while robot.step(timestep) != -1:
key = keyboard.getKey()
if key == ord('1'):
# keyboard.disable()
robot.simulationReset()
print("Reset performed.")
keyboard.enable(timestep)
elif key == ord('2'):
motor_1 = robot.getDevice("motor1")
motor_1.setPosition(float("inf"))
motor_1.setVelocity(-1.0)
elif key == ord('3'):
break
This code will not cause problems, but when using my reinforcement learning code, an error will be reported