Access to Furuta Devices
Overview
This page documents the jupyter setup we use to access the Furuta Devices. After reading this document, the notebooks we provide should help you get started with practical usage.
The set up is chosen to enable remote working, so after a first attempt, verifying that you are able to run something, you should be able to do (at least almost) all of the remaining lab work from any (capable) web browser connected to the internet.
The lab will use a Furuta pendulum Links to an external site. as the process to be investigated and controlled. As our programming language of choice, we will use Julia Links to an external site., and for the software environment we will use Jupyter Links to an external site..
For simple things, like numerical linear algebra with some loops, function calls and plotting, Julia feels a lot like matlab or python. The detailed syntax is of course a bit different, and the differences between them become clearer when trying to solve more advanced problems.
This page will show you how to log in to our jupyter installation, how to get access to the notebooks used in the labs, and how to open the first notebook to run some python code.
Resource sharing
You will have 24/7 access to the room Lab A for remote working, with some exceptions to be communicated via Canvas or MS Teams (see below).
We currently have six furuta devices that are connected to six different computers located in the lab room. As more arrive, they will be set up next to different computers in the same room and accessed the same way as our initial set of six.
To enable remote work, you can log in from any web browser connected to the internet, as described below, but each computer only allows one logged in user running code at the same time. If two different programs would try to control the same device at the same time, there would be confusion and annoyance, and we prefer to avoid that.
(This is a fairly "soft" limitation, and there are of course ways for you to get around it if you try, but that would be impolite, and we expect you not to try.)
To coordinate access to the processes, we will use Microsoft Teams, which (among other things) is one of many group-chat software solutions. We have created a group in teams to which everyone of you should be invited (talk to us if you have not seen an invitation), and we will use the group chat to tell each other when the devices are busy.
To use MS Teams, you point a browser to, e.g., login.microsoftonline.com Links to an external site., log in with your LU login, find the icon to open Teams, and you should find the group easily, as you should already have been invited.
In the chat, you can post messages when you start using one of the devices, so that we can know which ones are busy, and if you plan to use them for an hour, or for an overnight experiment.
Using Jupyter
Logging in and starting jupyter
You should all have a user account to the university computers, and you use it to log in at one of the following computers, that are located in our lab-rooms. If you are sitting in the lab room, you can find the name on the computer at your desk and choose that computer.
We have six Furuta pendulums, and they are connected to the following computers
- heron-01 Links to an external site.
- heron-02 Links to an external site.
- heron-03 Links to an external site.
- heron-04 Links to an external site.
- heron-11 Links to an external site.
- heron-12 Links to an external site.
There will also be cameras to give a view of what is happening. The webcams can only be viewed using Firefox browser.
- heron-01 Links to an external site.
- heron-02 Links to an external site.
- heron-03 Links to an external site.
- heron-04 Links to an external site.
- heron-11 Links to an external site.
- heron-12 Links to an external site.
To access the cameras, enter the following
user: labwebcam
password: labA-livestream
Our lab-computers currently use self-signed certificates, so you will probably have to click on things to accept the certificate before your web browser will show you the web-page.
After the certificate is accepted, the links above should take you to login-pages for the respective jupyter installation, and you should log in with your university account.
After successful login, you may see a screen like the following:
That is your "home screen" or "hub control panel", and from here you can start a separate "jupyter server" which provides the compute environment for you to use. To start it, you click on "start server", and if it starts correctly, you should (probably) be automatically redirected to the "jupyter lab" page.
You might also sometimes see an error message like the following:
To avoid a situation where two students send control signals to the same Furuta pendulum, we only allow one user to run computations at any time. If someone else is logged in to the computer with their jupyter environment started, the above error message will be shown, and the situation can be resolved in one of two ways:
- The other person stops their compute environment (typically by logging out).
- One of the administrators logs in and stops the active server.
For this reason, it is important that you remember to save your work (e.g. using the File menu) and log out of the system when you stop using it, so that others can then use that process.
If there are problems with this way of managing access, talk to us, and we will work out a solution.
Jupyter Lab
If all works well, and you succeed in starting your environment, you should see a screen similar to the following
You have then arrived at the main page of jupyter lab, and we first list some important parts.
- There are menus containing many useful commands, but for now we will only mention that the File-menu contains the options "Hub Control Panel", which is the page show above where you can start and stop your jupyterlab environment, and "Log Out", which will stop your jupyterlab environment and log you out from the system.
- Apart from the menus and toolbars around the edges, the two areas shown are a file browser to the left (mine is empty as I have no files yet), and the so-called "main area" which now shows a launcher view from which I can start Notebooks, Consoles and other things, such as a terminal.
Accessing and opening the first notebook
The files used in another course are available in MS teams, and the links below also provide access to them. They introduce the environment and running a first experiment are available through canvas. There are two notebook files introducing the systems, and we may provide more later that try actual control tasks.
The notebooks are
- Lab0_NB1_Introduction.ipynb Download Lab0_NB1_Introduction.ipynb
- Lab0_NB2_FirstExperiment.ipynb Download Lab0_NB2_FirstExperiment.ipynb
The additional file used is FurutaProcess.jl. Download FurutaProcess.jl.
If you are currently working at a computer where your university home folder is available, you can place the four files in a directory under your home folder. Otherwise, you can use the file manager view in jupyterlab, by creating a new folder (if you want to), navigating into it, and clicking on the "Upload files" button (an arrow pointing upwards) above the file area.
Once you have the files somewhere under your home folder, you can open the first one, named Lab0_NB1_Introduction.ipynb, with a double click on the file in the file browser. That file should introduce jupyter a bit more and help you along.
After that file, the other notebook that you uploaded, Lab0_NB1_FirstExperiment.ipynb, will be used. The last file, FurutaProcess.jl, contains helper functions used for the experiments, and if you double click on that file in jupyterlab, it should open in a text editor.
There is a mistake in the first notebook, and the last code cell, adding packages, must be run before you can plot anything. If you do not do that, you will see an error message stating (correctly) that the "Plots" package has not been installed.
Saving your work
The jupyterlab environment runs from your home directory, so you can manipulate files using jupyterlab, or any other way you might prefer for accessing files.
When you work in a notebook in jupyterlab, it is automatically saved quite often, and if you want to manually save your open notebook, you can use the File menu, or use the disk-icon in the toolbar above the notebook, or you can close your open notebooks by clicking the dot or cross on the tab of the notebook, and if it has unsaved changes, you will be asked if you want to save it before closing.
Getting help
For all of the software parts we use, including jupyter hub, jupyter lab, git, python and julia, there are of course a lot of information available on the internet. We also encourage you to ask us questions and to discuss problems in the Teams channels.
Installing julia and jupyterlab at home
To use the physical processes, you need to use the jupyter installation on the lab computers. (Well technically, you do not, but doing it any other way might lead to confusion and is discouraged.)
However, all of the software is available to run anywhere you want, and the simplest way to install Jupyterlab with Julia and Python kernels is to
- Install Julia Links to an external site.: Packages are provided on the downloads Links to an external site. page. If you use Linux, your distribution might already provide packages.
- Start Julia to get to a command line prompt, either by clicking on a julia icon or by typing "julia" at a command line.
-
Run the following four lines in Julia (you may have to answer "yes" to some questions)
import Pkg Pkg.add("IJulia")
using IJulia
jupyterlab()
After some time, a web-browser should open, showing the jupyterlab interface. As the Julia kernel is already available, there is no need to run the command in the first python notebook that install a Julia kernel.
The file-browser area in jupyterlab should show the directory from which jupyterlab was started. In my test that was my home folder.
(If you want more detail, we can tell you that your julia installation has installed its own python environment which is encapsulated using conda so that it does not interfere with the rest of the system. I has then installed jupyterlab into its conda environment and started it.)
(There are of course other ways of installing jupyterlab and julia, and this is only the quickest way to get started if you do not already have installations of python and julia that you want to re-use.)
Installing Julia Packages
When using Julia, we provide you with some introductory notebooks used in labs. They use a small set of julia packages, and there are most likely others that you will want to use, such as the "ControlSystems" package.
The julia-environment is set up to only have access to the very limited set of packages used for the course-labs, and when you want to install other packages, you therefore have to work-around that limitation.
The procedure, the first time you want to break free, is as follows:
1) Launch a terminal. One way to do this is to use the jupyter menu, "File" --> "New" --> "Terminal".
2) Remove your local julia state. The rm command with the -rf flags used below removes files without asking, so do take care when using it.
- Change directory to your .julia folder with "cd .julia"
-
Your prompt should have changed from something like "jo6310gr@heron-02:~$"
to something like "jo6310gr@heron-02:~/.julia$"
- Delete all contents with "rm -rf artifacts compiled environments logs packages prefs"
3) Start a new environment without the restrictions
- Start julia in the terminal with "julia"
- Put the package manager in "online"-mode with "import Pkg; Pkg.offline(false)"
- Install some packages with commands like: Pkg.add(["Plots", "ControlSystems"])
After restarting all your jupyter kernels, you should now be able to install more packages from jupyter notebooks, as long as you run "Pkg.offline(false)" before trying to do so.
Final words
We hope that you will enjoy the course, and that you will enjoy working with the pendulums.
Have Fun!