orionrobots / python_usb_robot_arm

Python code to interact with the maplin robot arm.
Other
16 stars 11 forks source link

Docker Support #9

Open raindancer2204 opened 2 years ago

raindancer2204 commented 2 years ago

hello project,

you really did a great project for the OWI USB robotic arm.

Would it be possible for you to also provide the whole thing in a Docker container image?

For Intel and ARM? thus several could work on the project.

Thank you

dannystaple commented 2 years ago

Hello, That could be an interesting idea. I know this works a treat on a Raspberry Pi. It would require investigating USB device forwarding into a container, which sounds plausible but Ive not yet researched it. I can't take this on right now - but it's an interesting enhancement suggestion.

dannystaple commented 2 years ago

If someone was to create a related PR showing the container and readme info on how to work the USB forwarding - I would be happy to review this.

raindancer2204 commented 2 years ago

Hi,

it really simple to connect the USB to your Docker Container. I would prefer to do this with a docker compose.yaml. Here you can find the needed informations about it. https://www.homeautomationguy.io/docker-tips/accessing-usb-devices-from-docker-containers/

Here you can find the informations how to build a docker file: https://stackify.com/docker-build-a-beginners-guide-to-building-docker-images/

It would be good if you do this in two ways for arm or on X86. Because for example most of NAS Home Systems Work on Intel.

If you have question contact me via PN.

Regards

dannystaple commented 2 years ago

Hello, I'm no stranger to docker (other than this USB pass through aspect). However, I cannot take on further enhancement projects right now. The example passthrough you quotes looks like it's passing through a USB UART device - this robot arm is not a USB UART, and is using native USB.

It might be achievable with a privileged container, but may also fail where the host does not have a driver. One problem this had was no signed host drivers for Windows 10 due to the age of the software that comes with the arm. If the intent is only to support Linux, this may be easier as I think Linux will show the device with LSUSB even if it's not got a driver. That would require some testing.

Encapsulating some python plus libraries in a Dockerfile, easy. Getting github workflows to build an image for a couple of arches and upload to a registry, fairly easy (not sure if there's an ARM build arch environment for workflows, not looked for it). Testing out the passthrough, device and security semantics - that will be the tricky part. With a chunk of testing time I could say it supported ARM and certain Linux distro's on intel, but YMMV with a container on other platforms due to that hardware interaction. The native USB aspect makes it a bit of a different job from containerising a web service.