Hi,
Frequently I have problems with the red motors: when programmed (in Python using ftrobopy) to run a straight line, they run into a left curve. This is the code for running in a straight line:
Motor_rechts.setSpeed(256)
Motor_links.setSpeed(256)
Motor_fan.setSpeed(-512)
Motor_rechts.setDistance(500, syncto=Motor_links)
Motor_links.setDistance(500, syncto=Motor_rechts)
Since the error doesn't always happen, could this be because of a motor malfunction?
hvn
Frequent problems with red TXT motors
Forumsregeln
Bitte beachte die Forumsregeln!
Bitte beachte die Forumsregeln!
Re: Frequent problems with red TXT motors
Hi hvn,
ftrobopy provides a way to ensure synchrony of TXT commands with the "SyncData" functions:
txt.SyncDataBegin()
Motor_rechts.setDistance(500, syncto=Motor_links)
Motor_links.setDistance(500, syncto=Motor_rechts)
Motor_rechts.setSpeed(256)
Motor_links.setSpeed(256)
Motor_fan.setSpeed(-512)
txt.SyncDataEnd()
The commands between SyncDataBegin() and SyncDataEnd() will be communicated to the TXT at the same time.
Kind regards,
Torsten
@forum-admins: I would recommend to move this thread to "Robo Pro / Computing / Software".
I think this problem is not related to a motor malfunction but rather to a synchronisation problem in your python program: the python thread that exchanges (motor-, output- and input-) data between the TXT and the python program is called every 10ms. (This is the same when using the TXT with ROBOPro). In your example code it may happen, that the command "Motor_rechts.setSpeed(256)" and the synchronisation commands ("...syncto=...") are not communicated to the TXT at the same time. Thus the motors run out of sync.hvn hat geschrieben:Hi,
Frequently I have problems with the red motors: when programmed (in Python using ftrobopy) to run a straight line, they run into a left curve. This is the code for running in a straight line:
Motor_rechts.setSpeed(256)
Motor_links.setSpeed(256)
Motor_fan.setSpeed(-512)
Motor_rechts.setDistance(500, syncto=Motor_links)
Motor_links.setDistance(500, syncto=Motor_rechts)
Since the error doesn't always happen, could this be because of a motor malfunction?
hvn
ftrobopy provides a way to ensure synchrony of TXT commands with the "SyncData" functions:
txt.SyncDataBegin()
Motor_rechts.setDistance(500, syncto=Motor_links)
Motor_links.setDistance(500, syncto=Motor_rechts)
Motor_rechts.setSpeed(256)
Motor_links.setSpeed(256)
Motor_fan.setSpeed(-512)
txt.SyncDataEnd()
The commands between SyncDataBegin() and SyncDataEnd() will be communicated to the TXT at the same time.
Kind regards,
Torsten
@forum-admins: I would recommend to move this thread to "Robo Pro / Computing / Software".
Re: Frequent problems with red TXT motors
Hallo!
Ich habe das Thema nun verschoben.
Gruß
Sven
Ich habe das Thema nun verschoben.
Gruß
Sven
Dieses Posting gibt ganz allein meine persönliche Meinung wieder!
Re: Frequent problems with red TXT motors
Hi Torsten,
Thank you for this solution.
hvn
Thank you for this solution.
hvn