Hello @benedictdied ! So, in the end we followed the Docker method to solve the “it doesn’t run on my machine” issue. In our case, we have Ubuntu 24.04 LTS installed and we had to use Canonical’s app catalogue because Docker isn’t directly supported yet by the developer. Docker must be called as sudo
, but it works great, here is what I did:
sudo docker run -it --rm -p 8001:8001 -p 2222:22 -e HEADLESS=1 -e HTTP_PORT=8001 -e UPDATE_GIT=1 -e CONFIG_PATH=/config -v ~/Downloads:/config -e UPDATE_CONFIG=0 --privileged ghcr.io/openuc2/imswitch-noqt-x64:latest
At the end it gave us the following text:
INFO: Uvicorn running on https://0.0.0.0:8001 (Press CTRL+C to quit)
We accessed the URL and gave it access. Since the default configuration of the container is to use the example_virtual_microscope.json
config file, it worked right away when making use of the web interface from the following domain:
https://0.0.0.0:8001/imswitch/index.html
The file that stores which config .json
is going to be used is the one named imcontrol_options.json under the /Downloads/ImSwitchConfig/config path. So, to test my Daheng Camera and stage controller, I switched the parameters to point the correct config file. In this case:
1.- From imcontrol_options.json
{
"setupFileName": "example_uc2_lightsheet_gxipy.json",
"recording": {
"outputFolder": "./ImSwitch/ImSwitch/recordings",
"includeDateInOutputFolder": true
},
"watcher": {
"outputFolder": "/config/ImSwitchConfig/scripts"
}
}
2.- Added the respective .json
config file to the imcontrol_setups folder under the /Downloads/ImSwitchConfig/imcontrol_setups/ path.
After this, I rerun the previous steps to activate the docker container and as expected it used the new .json
configuration file. The camera does work but the stage controller still doesn’t.
When trying to locate the device with the flashing tool in a chrome based web browser, the window that pops up says that it’s unable to locate the device.
I can confirm this from the terminal’s output too that details the following:
2024-08-22 21:30:03 DEBUG [ESP32Manager -> ESP32] No USB device connected! Using DUMMY!
When trying to use the stage controller from the web interface it throws the following error:
INFO: 172.17.0.1:59728 - "GET / HTTP/1.1" 422 Unprocessable Entity
INFO: 172.17.0.1:59728 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO: 172.17.0.1:59728 - "GET /imswitch/index.html HTTP/1.1" 200 OK
INFO: 172.17.0.1:59728 - "GET /imswitch/static/js/main.fa009905.js HTTP/1.1" 200 OK
INFO: 172.17.0.1:59728 - "GET /path_to_your_logo.png HTTP/1.1" 404 Not Found
INFO: 172.17.0.1:59728 - "GET /path_to_your_logo.png HTTP/1.1" 404 Not Found
INFO: 172.17.0.1:36918 - "GET /PositionerController/movePositioner?axis=X&dist=1000&isAbsolute=false&isBlocking=false&speed=1000 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
return await self.app(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
raise exc
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
await self.app(scope, receive, _send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/middleware/cors.py", line 85, in __call__
await self.app(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/middleware/httpsredirect.py", line 19, in __call__
await self.app(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/routing.py", line 754, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/routing.py", line 774, in app
await route.handle(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/routing.py", line 295, in handle
await self.app(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/starlette/routing.py", line 74, in app
response = await f(request)
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
raw_response = await run_endpoint_function(
File "/opt/conda/envs/imswitch/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
File "/tmp/ImSwitch/imswitch/imcontrol/controller/server/ImSwitchServer.py", line 194, in wrapper
return func(*args, **kwargs)
File "/tmp/ImSwitch/imswitch/imcontrol/controller/controllers/PositionerController.py", line 218, in movePositioner
positionerName = self._master.positionersManager.getAllDeviceNames()[0]
IndexError: list index out of range
After some troubleshooting, the usb extensor that we used was broken, so we switched to another one and we were able to detect the usb connection from lsusb
:
Bus 001 Device 007: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
So I’m not sure why the flashing tool is not detecting it. I also tried switching to other versions just in case but nothing. lsmod
shows these entries:
cp210x 40960 0
usbserial 69632 1 cp210x
In the case of sudo dmesg | tail
:
[27190.409721] docker0: port 1(veth6e8ad5b) entered disabled state
[27190.409726] veth6e8ad5b: entered allmulticast mode
[27190.409762] veth6e8ad5b: entered promiscuous mode
[27190.512888] eth0: renamed from veth7beafa3
[27190.522877] docker0: port 1(veth6e8ad5b) entered blocking state
[27190.522880] docker0: port 1(veth6e8ad5b) entered forwarding state
[27209.048170] usb 6-1: reset SuperSpeed USB device number 4 using xhci_hcd
[27233.721187] audit: type=1400 audit(1724362228.994:495): apparmor="DENIED" operation="open" class="file" profile="snap-update-ns.firefox" name="/proc/24735/maps" pid=24735 comm="5" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[29029.235521] audit: type=1400 audit(1724364024.485:496): apparmor="DENIED" operation="open" class="file" profile="snap-update-ns.firmware-updater" name="/proc/25736/maps" pid=25736 comm="5" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[29029.365111] audit: type=1400 audit(1724364024.615:497): apparmor="DENIED" operation="open" class="file" profile="snap.firmware-updater.firmware-notifier" name="/proc/sys/vm/max_map_count" pid=25705 comm="firmware-notifi" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
And ls /dev/tty*
shows a /dev/ttyUSB0
file.
Thank you for your help and time. Looking forward to your comments.