Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to control Trainer by Bluetooth with Raspberry Pi [package-lock.json missing?] #372

Closed
decodeais opened this issue Feb 6, 2022 · 73 comments
Labels
help wanted Extra attention is needed

Comments

@decodeais
Copy link

decodeais commented Feb 6, 2022

When I made a new setup from scratch with the new PI OS ( Bullseye ) every thing worked, accept receiving grade from the training program (Rouvy). Downgrading to the last version ( Buster ) did not help. When I copied the old node directory from my "Buster" installation into the new setup every thing was ok. I found out that, if I copy the file package-lock.json into the node directory, the command npm install gives a good result.
I hope you know how to fix it. For me it looks like a version conflict, but there are no error messages.
You find this problem only if you start riding and the trainer remains in Power mode.

@decodeais decodeais changed the title Problem Node setup on Raspberry Impossible to control Trainer by Bluetooth with Raspberry Pi Feb 13, 2022
@decodeais
Copy link
Author

Has anybody succeeded in installing a new Raspberry Pi 4 with Bluetooth in the last time ?
Where reading from the training program worked.

@WouterJD WouterJD added the help wanted Extra attention is needed label Feb 15, 2022
@WouterJD
Copy link
Owner

You find this problem only if you start riding and the trainer remains in Power mode.

Hi @decodeais does this mean that powermode is correctly working?
Do you use a Rouvy training? Since usually Rouvy will use Grademode.

Please provide some more details

@decodeais
Copy link
Author

decodeais commented Feb 15, 2022

When I started riding a Rouvy route the program shows 100W for the beginning. This is defined in the software. When I rode, this should have changed to grade, but it did not. FortiusAnt was recognized as a smart trainer, but the messages seemed not to arrive at the program. When I added the following file https://github.com/decodeais/FortiusANT/blob/master/node/package-lock.json from my old installation to your node direction, your installation procedure works. Then I receive the grade values.
May be the bug would appear on your RPI4 when you erase the package_lock file and the module directory and then start a new node installation.
It was very confusing to me, but now it works for me.
I never used power mode. How could I test?
But I don't think so.

@WouterJD
Copy link
Owner

The file you mention is (I assume) created by the installation procedure of node.js.
Node.js is very loosely coupled and relatively complex for what it does, but solves the lack (at time of BLE implementation) of a native BLE-library for python.

I think there is not much I can do, other than using the recently available BLE libraries for python, which takes some time to implement

@WouterJD
Copy link
Owner

In the meantime I'm happy it now works for you.
You want this issue to remain open?

@decodeais
Copy link
Author

I think it's interesting whether I am the only one. My file would help someone else to solve the problem. When I have a little more time I will test power mode with rouvy or Golden Cheetah.
Feel free to change the header, I took this dramatic words to get faster response.
Is it possible to put the file to the installation?
I tested it with last 2 RPI OS versions.

@planetSammy
Copy link

Hello together,
I have exactly the same Problem by using the program with my RP Zero W and RGT-Cycling. When I start the Skript and finished the calibration, i start RGT-Cycling on my PC (Win 10) incl. pairing the "FortiusAnt" Trainer over BLE,
but the Application did not switch to GradeMode, it still shows me 100 Watt.

If I start RGT-Cycling on my iPhone, the Application switch to GradeMode (0%) after a few seconds (this is actually my workaround...)

I try your old JSON-file, maybe this will solve my Problem, too!

Best regards Sammy

@planetSammy
Copy link

Checked with the old Package-lock.json file from your repository, but same behaviour, IOS is okay, Win 10 not!

@decodeais
Copy link
Author

Checked with the old Package-lock.json file from your repository, but same behaviour, IOS is okay, Win 10 not!

Did you delete the directory from the old installation?

@planetSammy
Copy link

Checked with the old Package-lock.json file from your repository, but same behaviour, IOS is okay, Win 10 not!

Did you delete the directory from the old installation?

No, only replaced the file.

@decodeais
Copy link
Author

No you have to erase the directories from the old installation an make a complete new node installation. The installation will be modified by the package-lock.json file.

@WouterJD
Copy link
Owner

WouterJD commented Feb 16, 2022

Feel free to change the header, I took this dramatic words to get faster response.

Good idea; although I try to respond as quick as possible and monitor open issues on a regular basis.

Is it possible to put the file to the installation?

The file is explicitly excluded from distribution

After installation of the node.js package you have to execute the npm install command (Raspberry, iOS and Windows); this command takes the input definition "package.json" and generates Package-lock.json and the node_modules directory; both are explicitly excluded from distribution (see .gitignore) because they are considered platform-specific and npm-generated.

So even though your solution may work, I think distributing the mentioned file is not the correct solution to the problem; I would not like to distribute node_modules with the contain 1821 files and 349 folders either.

@WouterJD
Copy link
Owner

Has anybody succeeded in installing a new Raspberry Pi 4 with Bluetooth in the last time ?

I think this is the correct question.
First steps in solving it is to tell whether the file is not created at all or containing incorrect content

@decodeais
Copy link
Author

Feel free to change the header, I took this dramatic words to get faster response.

Good idea; although I try to respond as quick as possible and monitor open issues on a regular basis.

Is it possible to put the file to the installation?

The file is explicitly excluded from distribution

After installation of the node.js package you have to execute the npm install command (Raspberry, iOS and Windows); this command takes the input definition "package.json" and generates Package-lock.json and the node_modules directory; both are explicitly excluded from distribution (see .gitignore) because they are considered platform-specific and npm-generated.

So even though your solution may work, I think distributing the mentioned file is not the correct solution to the problem; I would not like to distribute node_modules with the contain 1821 files and 349 folders either.

I did not copy all the modules. The JSON file modifies the result of your normal installation script.

@WouterJD
Copy link
Owner

WouterJD commented Feb 16, 2022

Some stuff I found:

For me it's not clear whether node.js wants us to distribute the file yes/no;

  • package-lock.json is automatically generated...; suggests it's not needed
  • It was not required before and seems inconsistent over the platforms

@decodeais what happens if you remove node_modules AND package-lock.json and then run rpm install?

@WouterJD WouterJD changed the title Impossible to control Trainer by Bluetooth with Raspberry Pi Impossible to control Trainer by Bluetooth with Raspberry Pi [package-lock.json missing?] Feb 16, 2022
@decodeais
Copy link
Author

Some stuff I found: This is what node.js says about package-lock.json StackOverflow - do-i-commit-the-package-lock-json-file-created-by-npm-5 StackOverflow - npm-warn-old-lockfile-the-package-lock-json-file-was-created-with-an-old-version StackOverflow - npm-install-not-creating-a-new-package-lock-json

For me it's not clear whether node.js wants us to distribute the file yes/no;

  • package-lock.json is automatically generated...; suggests it's not needed
  • It was not required before and seems inconsistent over the platforms

@decodeais what happens if you remove node_modules AND package-lock.json and then run rpm install?

Some stuff I found: This is what node.js says about package-lock.json StackOverflow - do-i-commit-the-package-lock-json-file-created-by-npm-5 StackOverflow - npm-warn-old-lockfile-the-package-lock-json-file-was-created-with-an-old-version StackOverflow - npm-install-not-creating-a-new-package-lock-json <-- Read this one!!

For me it's not clear whether node.js wants us to distribute the file yes/no;

  • package-lock.json is automatically generated...; suggests it's not needed
  • It was not required before and seems inconsistent over the platforms

@decodeais what happens if you remove node_modules AND package-lock.json and then run rpm install?

I get a installation with a newer release of node, but then with the bug. When I replace the JSON file and the module directory again, start your script, everything works.

@decodeais
Copy link
Author

Some stuff I found: This is what node.js says about package-lock.json StackOverflow - do-i-commit-the-package-lock-json-file-created-by-npm-5 StackOverflow - npm-warn-old-lockfile-the-package-lock-json-file-was-created-with-an-old-version StackOverflow - npm-install-not-creating-a-new-package-lock-json
For me it's not clear whether node.js wants us to distribute the file yes/no;

  • package-lock.json is automatically generated...; suggests it's not needed
  • It was not required before and seems inconsistent over the platforms

@decodeais what happens if you remove node_modules AND package-lock.json and then run rpm install?

Some stuff I found: This is what node.js says about package-lock.json StackOverflow - do-i-commit-the-package-lock-json-file-created-by-npm-5 StackOverflow - npm-warn-old-lockfile-the-package-lock-json-file-was-created-with-an-old-version StackOverflow - npm-install-not-creating-a-new-package-lock-json <-- Read this one!!
For me it's not clear whether node.js wants us to distribute the file yes/no;

  • package-lock.json is automatically generated...; suggests it's not needed
  • It was not required before and seems inconsistent over the platforms

@decodeais what happens if you remove node_modules AND package-lock.json and then run rpm install?

I get a installation with a newer release of node, but then with the bug. When I replace the JSON file and the module directory again, start your script, everything works.

The JSON file is not missing, it shows a newer version.
I did this test with different fresh RPI OS installs. Only using your scripts.

@WouterJD
Copy link
Owner

The JSON file is not missing, it shows a newer version.
I did this test with different fresh RPI OS installs. Only using your scripts.

Really looks like a node.js problem...

@planetSammy
Copy link

My installation is from November 2021 and the Version of NPM is 6.14.15, which version do you have? Does the version depends to the RPi Model?

@decodeais
Copy link
Author

decodeais commented Feb 17, 2022

Npm 6.14.9
Node has the version 14.15.3
If you want to change the version node for testing you can install npm install -g n
If you want to install my node version You have to enter n 14.15.3.
With the command n you can switch easily from one version to another.

@WouterJD
Copy link
Owner

When writing the documentation, the versions were (see 3_InstallNodeJs.sh):

	node version: v14.15.3
	npm  version: 6.14.9

since I use a blackberry image, version is unchanged untill today.

Currently on Windows 10, I use:

	node version: v16.13.1
	npm  version: 8.1.2

@planetSammy
Copy link

I tested an old node version "14.15.3" and the newest 14.19.0 from here https://unofficial-builds.nodejs.org/download/release/

I think the error occours by using a new/different bleno version (see also my post in November 21 #57 (comment))

Can you tell me which bluetooth_hci_socket do you use when it works?

@WouterJD
Copy link
Owner

Can you tell me which bluetooth_hci_socket do you use when it works?

Oops... What do you refer to? I don't know.
If you explain, I will check

@planetSammy
Copy link

#57 (comment)

@MeanHat
Copy link

MeanHat commented Feb 17, 2022

I've just finished a re-install of FortiusANT on an RPi 0 W. In order to get is working I used the fix from @planetSammy in #57 (noting that it has to be run from the ~FortiusANT/node folder). I also had to run npm audit fix there. In order to get the display (ST7789 minitft 240x240) to work I ran sudo apt-get install fonts-dejavu as I mentioned in #379.
Now fully operational. Hope this is helpful.

@planetSammy
Copy link

I've just finished a re-install of FortiusANT on an RPi 0 W. In order to get is working I used the fix from @planetSammy in #57 (noting that it has to be run from the ~FortiusANT/node folder). I also had to run npm audit fix there. In order to get the display (ST7789 minitft 240x240) to work I ran sudo apt-get install fonts-dejavu as I mentioned in #379. Now fully operational. Hope this is helpful.

Hi Meanhat, which Software do you use (Zwift, Bkool, RGT, Rouvy) and switch "FortiusANT" automatic to GradeMode after connecting the VT sensors over BLE?
switch2gradeMode

@MeanHat
Copy link

MeanHat commented Feb 18, 2022

Hi @planetSammy, I use Zwift. Though I've been doing the testing in simulation (-s) mode and it has been fine running for a mile or so without any problems. However, in simulation, once connected the target power increases markedly from 100w to 200w-300w. I'll be testing it on a Fortius trainer next.

@decodeais
Copy link
Author

I had the typical problems with Cheetah, it's not very stable. After a reboot video with grade worked and erg mode controlled from Cheetah too. I used RPI4 with Bullseye with installation by my actual script , BT , Golden Cheetah on Windows with BT4.0 stick.

@Toetta
Copy link

Toetta commented Feb 23, 2022

Reinstalled with new Bullseye. Still did not work ok. Upgraded to wxpython4.1.1. Now it works over BLE giving resistance feedback =)

@decodeais
Copy link
Author

Is now every thing ok ? Whatever happend, it is a little starange because wxpython is for the grafik user interface and has nothing todo with communication.

@Toetta
Copy link

Toetta commented Feb 23, 2022 via email

@decodeais
Copy link
Author

I think it would be the easiest way to make one good self-expanding installation shrinked to 2GB. In my opinion this make sense because the RPI installation runs on RPI3 without any changes. It is a little complicate but has to be only one time. Ant then every thing is fixed for this release. There is only the question where to find a free server for it.

@WouterJD
Copy link
Owner

Is now every thing ok ? Whatever happend, it is a little starange because wxpython is for the grafik user interface and has nothing todo with communication.

Memory overwritten?

@WouterJD
Copy link
Owner

Hi guys, perhaps you are interested in following work on issue #366.
If so, please check my question: #366 (comment)

@decodeais
Copy link
Author

Is now every thing ok ? Whatever happend, it is a little starange because wxpython is for the grafik user interface and has nothing todo with communication.

Memory overwritten?

I don't think so, because the bullseye script uses a precompiled wheel for wxpyton.
When I heard from the problems I took a fresh SD-card put the OS on it and started the installation update. The script did the rest. Can someone else do a test too, before It tooks my mind. No idea what's going wrong.

@Toetta
Copy link

Toetta commented Feb 23, 2022 via email

@WouterJD
Copy link
Owner

I think it would be the easiest way to make one good self-expanding installation shrinked to 2GB. In my opinion this make sense because the RPI installation runs on RPI3 without any changes. It is a little complicate but has to be only one time. Ant then every thing is fixed for this release. There is only the question where to find a free server for it.

I understand the point.
What self-installers would you like to have:

OS: rpi0/1/2/3/4, windows 10/11, macOS, Linux
and then customized for what Tacx-model?

Professionally spoken, yes.
But how to create, where to store, who maintains and especially: who pays for the work?

@decodeais
Copy link
Author

If you really near to get the bleak/bless solution it is better to focus on this. I new this kind of solution from another project. Aim would have been in installation ready to parameterize and start. The image for RPI 2/3/4 are the same.
I think RPI 0 is similar.
I searched 1 month to get my new installation working.
After this it was clear to me why nobody had trouble with the grade scaling bug.
But I wish you fast success for the BT improvement . But there are many problems, what kind of development system, how to set up, how to debug. I' am fraid that you are ready when I have understood the Python IDE.

@WouterJD
Copy link
Owner

Hi @decodeais when I found FortiusAnt predecessor antifier, I did not know python, github or visual source code and had no clue what a raspberry would be.
So... don't feel intimidated and start off!

@decodeais
Copy link
Author

decodeais commented Feb 24, 2022

My first Kontakt with python was with RPI LEDs for your program.
Do you use a special tool like PyCharm, how to use you your debug outputs and so on.

@MeanHat
Copy link

MeanHat commented Feb 24, 2022

hi @decodeais - the RPi0 is different with armv6l architecture which requires a different install. @WouterJD 's shell script https://github.com/WouterJD/FortiusANT/blob/master/raspberry/3_InstallNodeJs.sh checks this and alters the install to suit the architecture.

@decodeais
Copy link
Author

hi @decodeais - the RPi0 is different with armv6l architecture which requires a different install. @WouterJD 's shell script https://github.com/WouterJD/FortiusANT/blob/master/raspberry/3_InstallNodeJs.sh checks this and alters the install to suit the architecture.

I can not test it because I have no RPI 0 and they are crazy expensive at the moment. I think I do not compile, I am only asking the nodemanager n to find it. What happens when you install npm install -g n and change the version, for example to latest version with n latest or n 14.15.3.

@MeanHat
Copy link

MeanHat commented Feb 24, 2022

hi @decodeais - the RPi0 is different with armv6l architecture which requires a different install. @WouterJD 's shell script https://github.com/WouterJD/FortiusANT/blob/master/raspberry/3_InstallNodeJs.sh checks this and alters the install to suit the architecture.

I can not test it because I have no RPI 0 and they are crazy expensive at the moment. I think I do not compile, I am only asking the nodemanager n to find it. What happens when you install npm install -g n and change the version, for example to latest version with n latest or n 14.15.3.

@decodeais - for RPi0 I've forced it to use an unofficial build as the regular builds do not support armv6. This still installs 14.15.3. This is reflected in the shell script. I've not experimented with any other variations as this works and is stable (other than requiring the fix I mentioned previously on 17 Feb https://github.com/WouterJD/FortiusANT/issues/372#issuecomment-1044205620)

@planetSammy
Copy link

I have all Installation commands step by step for RPi Zero, if someone need this, I can post it!

@decodeais
Copy link
Author

I tried to understand whats happening there. The best solution would be to change my script.
We can put there Wouters commands instead and try wether its still working or not. But after this we both have to test the script. I can't do this for for RPI 0.
I

@decodeais
Copy link
Author

decodeais commented Feb 24, 2022

I have all Installation commands step by step for RPi Zero, if someone need this, I can post it!

Are you sure ? I found out that is very very important to erase the nodepackage lockfile in node directory. This changes the behavior at the next installation. This confused me a long time.
Of course I would like to see. But how to post?

@WouterJD
Copy link
Owner

Is this issue still alive, anything I can do and/or integrate?

@decodeais
Copy link
Author

I have seen that node is still active in the bleak/bless release with the -b option. For me and some others node definitely does not work without the special packet-lock.json. Please put it into the node directory or provide a special script version which copy it into this directory.

@Toetta
Copy link

Toetta commented Mar 27, 2022 via email

@decodeais
Copy link
Author

@Toetta my workaround script for the node problem was only tested for 32bit bullseye . At this time 64 bit was still expetimental. This changed, but i have no time to test it now. There will be a problem with the gui on 64bit because I only searched for a 32 bit version of wxpython. I think there has to be opened a new issue for 64bit support.

@Toetta
Copy link

Toetta commented Mar 28, 2022 via email

@WouterJD
Copy link
Owner

I have seen that node is still active in the bleak/bless release with the -b option. For me and some others node definitely does not work without the special packet-lock.json. Please put it into the node directory or provide a special script version which copy it into this directory.

-b activates BLE, using node
-bb activates BLE, using bless/bleak

I have done this for compatibility purpose; even though I think that (as soon as bless/bleak is stable) -bb will be the preferred option.

@WouterJD
Copy link
Owner

I think there has to be opened a new issue for 64bit support.

Yes please, open a separate issue to discuss wxPython. Thanks

@WouterJD
Copy link
Owner

WouterJD commented Apr 11, 2022

please test with bless version, then this issue should be gone as well
If so I suggest to close this issue, since I cannot solve in FortiusAnt

@WouterJD
Copy link
Owner

WouterJD commented Aug 9, 2022

Implemented and released

@WouterJD WouterJD closed this as completed Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants