Welcome to Muto S2 Robot repository
4.Widgets configuration
4.Widgets configuration
1. Install ipywidgets
- Refer to
1.jupyter lab environment construction tutorialto install Jupyter lab. - Check whether
nodeandnmpare installed. If the version number is displayed, it means that it has been installed. You can continue the operation (the second part Installing Node.js can be skipped directly), otherwise you should jump first Go to the Second, Install Node.js section, install Node.js and then continue. (As shown in the figure, both versions can be used directly)
node -v && npm -v

- Install @jupyter-widgets/jupyterlab-manager (this step requires operating in jupyter lab)
First enable the third-party extension community
Then install (install) @jupyter-widgets/jupyterlab-manager management plug-in
After the installation is complete, the plug-in will appear in the INSTALLED (installed) area, as shown below.
Generally, after the installation is completed, you will be prompted to Build JupyterLab again. This process will take a long time, and there will be no prompt after success. It is recommended to wait for about 2-3 minutes before re-entering jupyterlab. If there is no prompt Build JupyterLab, it means Build was successful.

3.Install ipywidgets
xxxxxxxxxxpip3 install ipywidgets
4.Start up widgetsnbextension
xxxxxxxxxxjupyter nbextension enable --py widgetsnbextension
5.Delete temporary and static directories
xxxxxxxxxxjupyter lab cleanjupyter lab path
6.Restart Raspberry Pi
xxxxxxxxxxsudo reboot
2. Install Node.js
1.Looking at the architecture of the Raspberry Pi, you can see that my Raspberry Pi 4B is armv7.
xxxxxxxxxxuname -a

2.Enter the Nood.js official website [download page] (https://nodejs.org/en/download/) to find the corresponding version and download it.

3.Unzip the downloaded compressed file (the current Nood.js official website provides version 12.19.0, if subsequent versions change, please refer to the actual situation)
xxxxxxxxxxxz -d node-v12.19.0-linux-armv7l.tar.xztar -xavf node-v12.19.0-linux-armv7l.tar
4.将Delete the /usr/bin.node that originally existed in the system
xxxxxxxxxxsudo rm -rf /usr/bin/node
5.Move the binary package to /usr/local/node
xxxxxxxxxxsudo mv ./node-v12.19.0-linux-armv7l /usr/local/node
6.Create a soft connection between node and npm
xxxxxxxxxxsudo ln -s /usr/local/node/bin/node /usr/bin/nodesudo ln -s /usr/local/node/bin/npm /usr/bin/npm
3. Check
1.Enter jupyter lab
xxxxxxxxxxjupyter lab
2.Enter Notebook

3.Copy and paste the following sample code
xxxxxxxxxxfrom __future__ import print_functionfrom ipywidgets import interact, interactive, fixed, interact_manualimport ipywidgets as widgetsdef f(x):return xinteract(f, x=10);
4.Use the following shortcut key to start running.
If the result is as follows, the Jupyter Widgets configuration is complete.
Enter key + Shift key
