Timeout Probem

Supporting 2.7 and 3.2+
Post Reply
Maxorzoom
Fresh meat
Posts: 2
Joined: Thu Mar 10, 2022 10:17 am
Contact:

Timeout Probem

Post 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
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Timeout Probem

Post 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)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 17 guests