ftrobopy / ftrobopy Goto Github PK
View Code? Open in Web Editor NEWfischertechnik TXT python
License: MIT License
fischertechnik TXT python
License: MIT License
ftrobopy - a python module for the fischertechnik TXT controller runs with python2 (>2.7) and python3 manual.pdf is available in german only
We have several of the RoboTXT controllers from Fischertechnik in use with the Training Factory 4.0 and we are using ftrobopy to control the individual components of the production stations connected to the controllers. There are also some switches connected to the ports C1 to C4. Is there support by ftrobopy to read the values of the input devices connected to these ports? If so, how does this work?
i think it should be:
if self._use_TransferAreaMode
and not:
if self._use_TransferArea
Thank you for the great work! I would like to ask whether the VGR is supported by the ftrobopy so I can program it in Python. Any insight?
It seems, that TxtControlMain has to be executed at least once after switching on the TXT in order to initialise the TXT motor shield correctly (?)
Can you please add some more basic examples? How to setup a single input to read an analog value? How to set a single output port to e.g. switch a lamp on and off?
There seem to be several ways to achieve this. Examples showing the easiest and simplest way would be great.
Is it possible to call the camera tread with different resolution and fps parameters?
The coding suggests so
def startCameraOnline(self, width=320, height=240, fps=15):
However, wenn I am trying to modify the present values, I do not get a successful camera thread.
Hey,
if a button is pressed at the time of connection (ftrobopy.ftrobopy('auto',use_extension=True) when the extension is used, the method getCurrentInput will always return 1.
If the button input isn't pressed at the time of connection everything will run fine.
The documentation says that the object begin returned has a method value()
. But in the code it is called voltage()
.
If I try to play a second sound while the first one is still playing I got this:
Traceback (most recent call last):
File "/home/raphael/ftcommunity-TXT/output/target/usr/lib/python3.5/site-packages/serial/serialposix.py", line 464, in read
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/raphael/ftcommunity-TXT/output/target/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
File "/home/raphael/ftcommunity-TXT/output/target/usr/lib/python3.5/site-packages/ftrobopy.py", line 1562, in run
File "/home/raphael/ftcommunity-TXT/output/target/usr/lib/python3.5/site-packages/serial/serialposix.py", line 475, in read
serial.serialutil.SerialException: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Hi Dears,
I'm trying to open a live view for the connected camera with TXT using ftrobopy.
The possible thing that I've found is to take captures as screenshots from the cam.
So, first of all, is it possible with ftrobopy? and second, if possible; what commands should I start with?
Any help will be appreciated.
Kind regards
My program runs quite normal for at least 1-2mins without any problems. But then I get following Traceback (the version of ftrobopy is the standard on the community-firmware on 0.9.2-3 or rather 0.98):
Traceback (most recent call last):
File "script.py", line [...], in [...]
sensor = self.io.input(n).state()
File "[...]/ftrobopy.py", line 1663, in input
self.updateConfig()
File "[...]/ftrobopy.py", line 432, in updateConfig
buf = struct.pack('<Ihh B B 2s BBBB BB2s BB2s BB2s BB2s BB2s BB2s BB2s BB2s B3s B3s B3s B3s 16h', *fields)
struct.error: short format requires (-0x7fff - 1) <= number <= 0x7fff
The communication to the TXTs IOs is put into execution via following lines:
self.io = ftrobopy.ftrobopy("127.0.0.1",65000)
sensor = self.io.input(1).state()
Direct modes seems to behave differently than the client mode wrt. the following methods:
motor.isFinished()
This seems never true in direct mode, even if the desired distance is reached (getCurrentDistance()
is equal the previously set distance).
txt.stopAll()
This does not seem to reset the counter, so a manual txt.incrCounterCmdId(0)
seems needed in direct mode.
Wenn ich getPower oder getTemperatur im direct Modus ausführe bekomme ich folgende Meldung:
Connected to TXT direct firmware version not detected
Traceback (most recent call last):
File "/home/ftc/direct-test2.py", line 7, in
temperatur = txt.getTemperature()
File "/usr/lib/python3.9/site-packages/ftrobopy.py", line 1630, in getTemperature
AttributeError: 'ftrobopy' object has no attribute '_use_TransferMode'
Habe in der ftrobopy '_use_TransferMode' für getPower und getTemperatur in '_use_TransferAreaMode' geändert.
Nun bekomme ich keine Fehlermeldung mehr, aber ich bekomme für beide Werte nur eine 0 zurück.
Hier mein Code:
import ftrobopy
txt=ftrobopy.ftrobopy('auto')
temperatur = txt.getTemperature()
print(temperatur)
spannung = txt.getPower()
print(spannung)
Hi!
I'm running into an error when using ftrobopy on the txt controller with a bt remote.
my code is:
import time
import ftrobopy
import threading
txt=ftrobopy.ftrobopy('auto')
joystick1 = txt.joystick(0,1,1)
joystick2 = txt.joystick(1,1,1)
Motor1 = txt.motor(1)
Motor1.setDistance(0)
Motor2 = txt.motor(2)
Motor2.setDistance(0)
txt.updateWait()
def infiniteloop1(): # this controls Motor1 and Motor2 via a BT-Remote
while True:
Motor1.setSpeed(joystick1.updown() * 512)
Motor2.setSpeed(joystick1.updown() * 512)
thread1 = threading.Thread(target=infiniteloop1)
thread1.start()
and it returns this error
Positive values going forward work fine. While going backwards with negative values its working for like 1-2 seconds and then stops with the above error. The error occurs on both cfw default and beta version ftrobopy.
Whats weird is that it works fine with leftright() but not updown():
ie this is perfectly fine in both directions:
Motor1.setSpeed(joystick1.leftright() * 512)
Motor2.setSpeed(joystick1.leftright() * 512)
instead of
Motor1.setSpeed(joystick1.updown() * 512)
Motor2.setSpeed(joystick1.updown() * 512)
which causes the error as soon as you go backwards.
EDIT: Just did some trial and error: it works fine until motor setspeed 508 after which it will throw the above error (only if resulting motor speed is negative value)
so these always work fine:
Motor1.setSpeed(joystick1.updown() * 508)
Motor2.setSpeed(joystick1.updown() * -508)
Not too important, but confusing. setup.py
does not install the current git version but an old one from github.
I have two fischertechnik ROBO TX Controller. Is ist possible to run ftrobopy with the TX Controller or only with the ROBOTICS TXT Controller? Is any support for the TX Controller planned or are there other possibilities to program the TX Controller with python?
Thanks for your help
Hello,
How am i supposed to run a (".rpp") program written with robopro directly from it's module or the serial module?
Thanks, appreciated the help, have a nice day
I could not yet get the analog inputs (voltage, resistor) working in 'direct' mode, when running under the community firmware. With the original ft firmware this works.
The sound support introduced with the direct mode is unstable. After playing a few random sounds for about half a minute no audio is generated anymore. The txtsndcat based programs then alyo don't work. But starting the original gui via launcher restores audio functionality.
E.e.g the following brickly program plays the "car horn" sound whenever the fire button is pressed:
Program
After a few seconds constantly hitting the fire button audio stops working.
Is it possible to use I2C sensors and actuators, like in RoboPro? I couldn't find anything in the documentation or the source files.
I didn't find anything about I2C in Fischertechnik's TXT-C-Programming-Kit-4-1-6
, so maybe there is no documentation on how I2C can be implemented?
After the stop there is a problem when you try use a motor in a normal way.
At the end the commands for ending the extended motor situation are missing.
Add
Motor_rechts.setDistance(0, syncto=None)
Motor_links.setDistance(0, syncto=None)
just before
Motor_rechts.stop()
Motor_links.stop()
See also the TA description in the fischertechnik C/C++ files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.