Giter VIP home page Giter VIP logo

ftrobopy's Introduction

ftrobopy - a python module for the fischertechnik TXT controller

runs with python2 (>2.7) and python3

manual.pdf is available in german only

ftrobopy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ftrobopy's Issues

Reading C1-C4 from RoboTXT Controller

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?

Vacuum Gripper Robot support

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?

More examples, please

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.

Camera with minimum resolution but maximum fps

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.

getCurrentInput returns always 1

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.

When trying to play two sounds at one time ftrobopy prints errors

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?)

Opening Live View for Camera with TXT

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

ftrobopy crashing after undefined time

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()

discrepancy between direct and client mode

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.

Keine Werte bei getPower und getTemperatur

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)

ubyte format requires 0 <= number <= 255

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

image

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)

Support for ROBO TX Controller

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

start internal file

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

Sound support in direct mode is unstable

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.

Support for I2C

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?

Example SimpleDemoExplorer.py

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.