Add axidraw

This commit is contained in:
2022-12-02 10:18:56 +02:00
parent 73f95db51a
commit 656b3e528c
3 changed files with 22 additions and 0 deletions

View File

@@ -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}"

View File

@@ -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 && \

View File

@@ -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