diff --git a/.docker/run.bash b/.docker/run.bash index 1825666..6cfab2a 100755 --- a/.docker/run.bash +++ b/.docker/run.bash @@ -75,6 +75,9 @@ GUI_ENVS=( # Synchronize timezone with host CUSTOM_VOLUMES+=("/etc/localtime:/etc/localtime:ro") +# Pass USB devices to container +USB_VOLUME+=("/dev/bus/usb:/dev/bus/usb") + ## Additional environment variables # Synchronize ROS_DOMAIN_ID with host if [ -n "${ROS_DOMAIN_ID}" ]; then @@ -111,6 +114,7 @@ DOCKER_RUN_CMD=( "${GPU_OPT}" "${GPU_ENVS[@]/#/"--env "}" "${CUSTOM_VOLUMES[@]/#/"--volume "}" + "${USB_VOLUME[@]/#/"--volume "}" "${CUSTOM_ENVS[@]/#/"--env "}" "${TAG}" "${CMD}" diff --git a/Dockerfile b/Dockerfile index 014f430..5260aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,12 @@ RUN apt-get update && \ RUN apt-get update && \ apt-get install -yq python3-pil.imagetk +### Install AxiDraw +RUN apt-get update && \ + apt-get install -yq python3-pip && \ + pip install --upgrade --upgrade-strategy eager packaging && \ + pip install https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip --upgrade --upgrade-strategy eager + ### Import and install dependencies, then build these dependencies (not ign_moveit2_examples yet) COPY ./drawing_robot_ros2.repos ${WS_SRC_DIR}/ign_moveit2_examples/drawing_robot_ros2.repos RUN vcs import --recursive --shallow ${WS_SRC_DIR} < ${WS_SRC_DIR}/ign_moveit2_examples/drawing_robot_ros2.repos && \ diff --git a/src/axidraw_controller/test.py b/src/axidraw_controller/test.py new file mode 100644 index 0000000..0db01e7 --- /dev/null +++ b/src/axidraw_controller/test.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +from pyaxidraw import axidraw # import module +ad = axidraw.AxiDraw() # Initialize class +ad.interactive() # Enter interactive context +if not ad.connect(): # Open serial port to AxiDraw; + quit() # Exit, if no connection. +ad.options.units = 1 # set working units to cm. + # Absolute moves follow: +ad.moveto(1, 1) # Pen-up move to (1 inch, 1 inch) +ad.lineto(2, 1) # Pen-down move, to (2 inch, 1 inch) +ad.moveto(0, 0) # Pen-up move, back to origin. +ad.disconnect() # Close serial port to AxiDraw