Page 1 of 1

Timeout Probem

Posted: Thu Mar 10, 2022 10:20 am
by Maxorzoom
Im making a robot that has 4 brushless motors for the wheels and whenever I would launch the program the wheels do not start at once. Then I keep getting the error of Phidget timeout. please look at the code below for it

fl = BLDCMotor()
bl = BLDCMotor()
br = BLDCMotor()
fr = BLDCMotor()


fl.setHubPort(1)
bl.setHubPort(2)
br.setHubPort(4)
fr.setHubPort(3)


fl.openWaitForAttachment(1500)
fr.openWaitForAttachment(1500)
bl.openWaitForAttachment(1500)
br.openWaitForAttachment(1500)

fl.setTargetVelocity(1)
fr.setTargetVelocity(-1)
bl.setTargetVelocity(1)
br.setTargetVelocity(-1)

try:
input("Press Enter to Stop\n")
except (Exception, KeyboardInterrupt):
pass

position=fl.getPosition()
print(position)


fl.close()
bl.close()
fr.clos()
br.close()

The area where the phidget times out is when the br is set to -1 for the velocity

Re: Timeout Probem

Posted: Thu Mar 10, 2022 11:00 am
by mparadis
I think the first step would be to set an attach handler that prints out the hub port so you can tell which channels successfully open and when.

Code: Select all

def onAttach(self):
	print("Attach on port " + str(self.getHubPort()))

	
(in main)
fl.setOnAttachHandler(onAttach)
fr.setOnAttachHandler(onAttach)
bl.setOnAttachHandler(onAttach)
br.setOnAttachHandler(onAttach)