john-38787364 / antifier

Convert the output from USB Tacx turbo trainers into ANT+ signals
MIT License
52 stars 20 forks source link

Raspberry pi #10

Open JamesBudge opened 7 years ago

JamesBudge commented 7 years ago

Hello John,

Thanks for all your help so far.

I am using a raspberry pi 2 model B running the newest version of raspbian. trainer fortitus. ant stick 1008

Now picks up stick and trainer after your advice re creating .rules file.

try to perform rundown test only get approx 3 sec each time.

then start script, note the following pop up in on the terminal:

pi@raspberrypi:~ $ sudo python /home/pi/antifier/antifier.py --debug > out.log Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754, in run self.target(*self.args, **self.__kwargs) File "/home/pi/antifier/antifier.py", line 500, in run pc_dict = trainer.parse_factors(power_curve)#get power curve dictionary File "/home/pi/antifier/trainer.py", line 116, in parse_factors temp = open(filename,'r').read().split('\n') IOError: [Errno 2] No such file or directory: 'power_calc_factors_fortius.txt'

little in the debug file: Assuming fixed resistance return value from trainer get ant stick get trainer 0x1932 Found variable resistance return value from trainer

Try finding the trainer in zwift on my laptop and nothing comes up.

Any thoughts?

Thanks

James

john-38787364 commented 7 years ago

Hi James you're lacking some necessary files.: No such file or directory: 'power_calc_factors_fortius.txt'

Could you install via the install.sh script as per the readme.txt?

JamesBudge commented 7 years ago

Hello John,

I previous used the install script as per the readme. Strangely now when I try and run it it make the directory but there is nothing in the dir.

Here is the log from the terminal (thanks again!):

sudo wget -O - https://raw.githubusercontent.com/john-38787364/antifier/master/install.sh | sudo sh --2017-11-07 21:26:07-- https://raw.githubusercontent.com/john-38787364/antifier/master/install.sh Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.60.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.60.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1486 (1.5K) [text/plain] Saving to: ‘STDOUT’

2017-11-07 21:26:07 (15.9 MB/s) - written to stdout [1486/1486]

Reading package lists... Done Building dependency tree
Reading state information... Done python-tk is already the newest version (2.7.13-1). The following additional packages will be installed: python-pip-whl python3-pip The following packages will be upgraded: python-pip python-pip-whl python3-pip 3 upgraded, 0 newly installed, 0 to remove and 119 not upgraded. Need to get 1,720 kB of archives. After this operation, 4,096 B disk space will be freed. Do you want to continue? [Y/n] Abort. Requirement already satisfied: pyserial in /usr/lib/python2.7/dist-packages Requirement already satisfied: pyusb in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages Collecting scipy Using cached scipy-1.0.0.tar.gz Building wheels for collected packages: scipy Running setup.py bdist_wheel for scipy ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-TZZjtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpe5Waqlpip-wheel- --python-tag cp27: lapack_opt_info: lapack_mkl_info: libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf'] NOT AVAILABLE

openblas_lapack_info: libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf'] NOT AVAILABLE

atlas_3_10_threads_info: Setting PTATLAS=ATLAS libraries tatlas,tatlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries tatlas,tatlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib libraries tatlas,tatlas not found in /usr/lib/arm-linux-gnueabihf libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf <class 'numpy.distutils.system_info.atlas_3_10_threads_info'> NOT AVAILABLE

atlas_3_10_info: libraries satlas,satlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries satlas,satlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib libraries satlas,satlas not found in /usr/lib/arm-linux-gnueabihf libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf <class 'numpy.distutils.system_info.atlas_3_10_info'> NOT AVAILABLE

atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries ptf77blas,ptcblas,atlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib libraries ptf77blas,ptcblas,atlas not found in /usr/lib/arm-linux-gnueabihf libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf <class 'numpy.distutils.system_info.atlas_threads_info'> NOT AVAILABLE

atlas_info: libraries f77blas,cblas,atlas not found in /usr/local/lib libraries lapack_atlas not found in /usr/local/lib libraries f77blas,cblas,atlas not found in /usr/lib libraries lapack_atlas not found in /usr/lib libraries f77blas,cblas,atlas not found in /usr/lib/arm-linux-gnueabihf libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf <class 'numpy.distutils.system_info.atlas_info'> NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. self.calc_info() lapack_info: libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf'] NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning: Lapack (http://www.netlib.org/lapack/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [lapack]) or by setting the LAPACK environment variable. self.calc_info() lapack_src_info: NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning: Lapack (http://www.netlib.org/lapack/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [lapack_src]) or by setting the LAPACK_SRC environment variable. self.calc_info() NOT AVAILABLE

Running from scipy source directory. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 418, in setup_package() File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 414, in setup_package setup(*metadata) File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 135, in setup config = configuration() File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 336, in configuration config.add_subpackage('scipy') File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1001, in add_subpackage caller_level = 2) File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 970, in get_subpackage caller_level = caller_level + 1) File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py config = setup_module.configuration(args) File "scipy/setup.py", line 15, in configuration config.add_subpackage('linalg') File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1001, in add_subpackage caller_level = 2) File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 970, in get_subpackage caller_level = caller_level + 1) File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "scipy/linalg/setup.py", line 19, in configuration raise NotFoundError('no lapack/blas resources found') numpy.distutils.system_info.NotFoundError: no lapack/blas resources found


Failed building wheel for scipy Running setup.py clean for scipy Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-TZZjtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" clean --all:

setup.py clean is not supported, use one of the following instead:

- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
                    files that aren't checked into the git repo)

Add --force to your command to use it anyway if you must (unsupported).


Failed cleaning build dir for scipy Failed to build scipy Installing collected packages: scipy Running setup.py install for scipy ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-TZZjtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-bBBtKq-record/install-record.txt --single-version-externally-managed --compile:

Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:

  - `pip install .`       (from a git repo or downloaded source
                           release)
  - `pip install scipy`   (last SciPy release on PyPI)

lapack_opt_info:
lapack_mkl_info:
  libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
  NOT AVAILABLE

openblas_lapack_info:
  libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
  NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
  libraries tatlas,tatlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries tatlas,tatlas not found in /usr/lib
  libraries lapack_atlas not found in /usr/lib
  libraries tatlas,tatlas not found in /usr/lib/arm-linux-gnueabihf
  libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
  NOT AVAILABLE

atlas_3_10_info:
  libraries satlas,satlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries satlas,satlas not found in /usr/lib
  libraries lapack_atlas not found in /usr/lib
  libraries satlas,satlas not found in /usr/lib/arm-linux-gnueabihf
  libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
<class 'numpy.distutils.system_info.atlas_3_10_info'>
  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib
  libraries lapack_atlas not found in /usr/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/arm-linux-gnueabihf
  libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
<class 'numpy.distutils.system_info.atlas_threads_info'>
  NOT AVAILABLE

atlas_info:
  libraries f77blas,cblas,atlas not found in /usr/local/lib
  libraries lapack_atlas not found in /usr/local/lib
  libraries f77blas,cblas,atlas not found in /usr/lib
  libraries lapack_atlas not found in /usr/lib
  libraries f77blas,cblas,atlas not found in /usr/lib/arm-linux-gnueabihf
  libraries lapack_atlas not found in /usr/lib/arm-linux-gnueabihf
<class 'numpy.distutils.system_info.atlas_info'>
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  self.calc_info()
lapack_info:
  libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning:
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  self.calc_info()
lapack_src_info:
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:572: UserWarning:
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  self.calc_info()
  NOT AVAILABLE

Running from scipy source directory.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 418, in <module>
    setup_package()
  File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 414, in setup_package
    setup(**metadata)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 135, in setup
    config = configuration()
  File "/tmp/pip-build-TZZjtz/scipy/setup.py", line 336, in configuration
    config.add_subpackage('scipy')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1001, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 970, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/setup.py", line 15, in configuration
    config.add_subpackage('linalg')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1001, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 970, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/linalg/setup.py", line 19, in configuration
    raise NotFoundError('no lapack/blas resources found')
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-TZZjtz/scipy/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-bBBtKq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-TZZjtz/scipy/

john-38787364 commented 7 years ago

Scipy is failing to install and dumping you out of the install. It actually now isnt needed. Can you remove from install script and retry?

powerwindows commented 7 years ago

Hello John, Just want to tell you, I'm using a Raspberry Pi 3 with Linux Mint.Working perfectly! At the beginning i got a /dev/ttyUSB0 error, as a quick solution i did 'chmod 777 /dev/ttyUSB0' Thank you

john-38787364 commented 7 years ago

That's great to hear. I created /etc/udev/rules.d/garmin-ant2.rules in Raspbian and added SUBSYSTEM=="usb", ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1009", RUN+="/sbin/modprobe usbserial vendor=0x0fcf product=0x1009" and I can run it as the Pi user with no chmod: python antifier.py -l -c power_calc_factors_custom.txt

powerwindows commented 7 years ago

I used your dev rule before, but i found out that my user, not the Pi one, needs to be in the 'dialout' group. Working like a charm now with 'python antifier.py -l -c power_calc_factors_imagic.txt. By the way: System: Raspberry Pi 3 with Mint Linux, head unit Tacx 1932 and an I-Magic Trainer. Alex

JamesBudge commented 7 years ago

Dear John,

The raspberry pi is working now with the new ant+ sticks. Thanks again.

Only problem is the power curve i think as even out of the saddle i'm not getting many watts! And the motor brake seems to be erratically kicking in and out. Will see if I can find someone with a power meter to try and make a curve.