dhague / vpower

ANT+ Virtual Power - currently for BT-ATS turbo & Kurt Kinetic. More to come...
MIT License
82 stars 34 forks source link

Syntax Error when trying to start vpower #16

Open mhanbury opened 3 years ago

mhanbury commented 3 years ago

Many thanks for pulling this together. Unfortunately I'm getting an error when trying to start on my PI.

pi@raspberrypi:/boot/vpower $ sudo python vpower.py ../vpower.cfg Traceback (most recent call last): File "vpower.py", line 10, in from PowerMeterTx import PowerMeterTx File "/boot/vpower/PowerMeterTx.py", line 66 print(f'Power: {int(power)} W \r', end="") ^ SyntaxError: invalid syntax pi@raspberrypi:/boot/vpower $

All files currently set to default values.

oldnapalm commented 3 years ago

Try sudo python3 vpower.py ../vpower.cfg

dhague commented 3 years ago

@oldnapalm you beat me to it by a few seconds :-)

oldnapalm commented 3 years ago

@dhague there was another post about this here https://github.com/dhague/vpower/issues/12#issuecomment-753512587

I don't have a Pi to confirm, but I suppose the commands (python and pip) should be updated in the README.

Also, the prints in https://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/bme280.py need to be updated.

mhanbury commented 3 years ago

Thanks for that getting a little further now..

I had run the requirements to build ant pi@raspberrypi:/boot/vpower $ sudo pip install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting git+https://github.com/mch/python-ant.git (from -r requirements.txt (line 1)) Cloning https://github.com/mch/python-ant.git to /tmp/pip-req-build-R3evt3 Requirement already satisfied (use --upgrade to upgrade): ant==0.1.1 from git+https://github.com/mch/python-ant.git in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1)) Requirement already satisfied: msgpack-python in /usr/local/lib/python2.7/dist-packages (from ant==0.1.1->-r requirements.txt (line 1)) (0.5.6) Requirement already satisfied: pyserial in /usr/lib/python2.7/dist-packages (from ant==0.1.1->-r requirements.txt (line 1)) (3.4) Requirement already satisfied: pyusb>=1.0.0b2 in /usr/local/lib/python2.7/dist-packages (from ant==0.1.1->-r requirements.txt (line 1)) (1.1.1) Requirement already satisfied: six>=1.7.0 in /usr/lib/python2.7/dist-packages (from ant==0.1.1->-r requirements.txt (line 1)) (1.12.0) Building wheels for collected packages: ant Running setup.py bdist_wheel for ant ... done Stored in directory: /tmp/pip-ephem-wheel-cache-7bOdUG/wheels/21/f5/ec/5b238f9b1e1002a526575734521172cc0e9feefd87d6d0303f Successfully built ant

However when I run sudo python3 vpower.py ../vpower.cfg I unfortunately see another error

pi@raspberrypi:/boot/vpower $ sudo python3 vpower.py ../vpower.cfg Traceback (most recent call last): File "vpower.py", line 5, in from ant.core import driver ModuleNotFoundError: No module named 'ant' pi@raspberrypi:/boot/vpower $

dhague commented 3 years ago

Apologies, the documentation needs updating to use Python 3. In this case, pip install ... becomes pip3 install ...

mhanbury commented 3 years ago

Thanks for the reply Duh Silly me I should have guessed that. Sorry to bother you again... Looks better now :-)

Are the speed values entered in kmh, mph or ms? I'm going to propose a formula for the trainer I use the Elite chrono fluid using a poly nominal formula as you've done for the kurt kinetic but for now I've just updated the curves file with values for my trainer.

oldnapalm commented 3 years ago

If you mean in curve.csv, speed is in km/h. If you mean in the polynomial, you can use what you want, power_from_speed takes revolutions per second (just notice that default wheel_circumference is in millimeters).

https://github.com/dhague/vpower/blob/master/KurtKineticPowerCalculator.py#L22