diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3335c43
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*.vscode
+bag/
+report/
+
+# ROS #
+#######
+build/
+install/
+log/
+
+# Python #
+##########
+*.pyc
+*.pyo
+__pycache__/
+localization-devel-ws/ydlidar_ros2_driver
+localization-devel-ws/YDLidar-SDK
diff --git a/docker/local-ros2/Dockerfile b/docker/local-ros2/Dockerfile
index af33058..e779433 100644
--- a/docker/local-ros2/Dockerfile
+++ b/docker/local-ros2/Dockerfile
@@ -64,6 +64,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
# ros-humble-laser-geometry \
libsuitesparse-dev \
ros-humble-libg2o \
+ ros-humble-rmw-cyclonedds-cpp\
# ros-humble-imu-tools \
libusb-1.0-0 libusb-1.0-0-dev -y && \
rm -rf /var/lib/apt/lists/*
diff --git a/docker/local-ros2/OdomComm/_run.sh b/docker/local-ros2/OdomComm/_run.sh
new file mode 100644
index 0000000..9e82b64
--- /dev/null
+++ b/docker/local-ros2/OdomComm/_run.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+## 1. make scripts & library executable
+echo "=== [COMMUNICATION] ==="
+find ../OdomComm -type f -name "*.sh" -exec sudo chmod +x {} \;
+
+## 2. environment setup
+export DISPLAY=:0
+xhost +local:docker
+cd docker
+
+## 3. deployment
+echo "[COMMUNICATION] Deploying..."
+docker compose -p communication up -d
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/build_and_run.sh b/docker/local-ros2/OdomComm/build_and_run.sh
new file mode 100644
index 0000000..a77990a
--- /dev/null
+++ b/docker/local-ros2/OdomComm/build_and_run.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+## 0. clean container within same group
+echo "=== [COMMUNICATION] Build & Run ==="
+echo "[COMMUNICATION] Remove Containers ..."
+docker compose -p communication down --volumes --remove-orphans
+
+## 1. make scripts & library executable
+find ../OdomComm -type f -name "*.sh" -exec sudo chmod +x {} \;
+
+## 2. environment setup
+export DISPLAY=:0
+xhost +local:docker
+cd docker
+
+## 3. build image
+echo "[COMMUNICATION] Building..."
+docker compose -p communication build
+
+## 4. deployment
+echo "[COMMUNICATION] Deploying..."
+docker compose -p communication up -d
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/docker/Dockerfile b/docker/local-ros2/OdomComm/docker/Dockerfile
new file mode 100644
index 0000000..43a1026
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/Dockerfile
@@ -0,0 +1,151 @@
+################################################################################################
+# - Base stage
+# - This stage serves as the foundational stage for all other stages.
+# - Base image: Ubuntu 22.04 Jammy Jellyfish
+# - https://hub.docker.com/_/ubuntu/tags?page=1&name=22.04
+################################################################################################
+
+FROM ubuntu:22.04 AS base
+
+LABEL org.opencontainers.image.authors="yuzhong1214@gmail.com"
+
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#set-locale
+ENV LC_ALL=en_US.UTF-8
+ENV LANG=en_US.UTF-8
+
+SHELL ["/bin/bash", "-c"]
+
+# Add user
+RUN useradd -ms /bin/bash user
+
+################################################################################################
+# - Build stage
+# - In this stage, I will build ROS Humble and ros1-bridge from source.
+# - Reference:
+# - https://docs.ros.org/en/humble/How-To-Guides/Using-ros1_bridge-Jammy-upstream.html
+# - https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html
+################################################################################################
+
+FROM base AS build
+
+# Install the required packages for the following command.
+RUN apt-get update && \
+ apt-get install -y \
+ curl \
+ locales \
+ software-properties-common \
+ lsb-release
+
+# Set locale.
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#set-locale
+RUN locale-gen en_US en_US.UTF-8 && \
+ update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
+
+# Add the ROS 2 apt repository.
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#add-the-ros-2-apt-repository
+RUN add-apt-repository universe && \
+ curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
+
+# Install development tools and ROS tools.
+# Note that we declare noninteractive mode to avoid apt asking for user input.
+# Additionally, install colcon from PyPI, rather than using apt packages.
+# Reference: https://docs.ros.org/en/humble/How-To-Guides/Using-ros1_bridge-Jammy-upstream.html#install-development-tools-and-ros-tools
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ build-essential \
+ cmake \
+ git \
+ python3-flake8 \
+ python3-flake8-blind-except \
+ python3-flake8-builtins \
+ python3-flake8-class-newline \
+ python3-flake8-comprehensions \
+ python3-flake8-deprecated \
+ python3-flake8-docstrings \
+ python3-flake8-import-order \
+ python3-flake8-quotes \
+ python3-pip \
+ python3-pytest \
+ python3-pytest-cov \
+ python3-pytest-repeat \
+ python3-pytest-rerunfailures \
+ python3-rosdep \
+ python3-setuptools \
+ ros-dev-tools
+RUN python3 -m pip install -U colcon-common-extensions vcstool
+
+# Create ros2_humble workspace, and clone all repositories from the list.
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#get-ros-2-code
+RUN mkdir -p /ros2_humble/src
+WORKDIR /ros2_humble
+RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
+
+# Install dependencies.
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#install-dependencies-using-rosdep
+RUN rosdep init && \
+ rosdep update && \
+ rosdep install --from-paths src --ignore-src -y --rosdistro humble --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
+
+# Build the ros2_humble workspace. (This will take a few minutes)
+# Note that we are using colcon build without the flag --symlink-install.
+# This is because we will copy the built files from the build stage to the release stage.
+# If we use the flag --symlink-install, the release stage will not be able to find the built files.
+# Reference: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#build-the-code-in-the-workspace
+RUN colcon build
+
+# Delete packages.ros.org from sources.list and remove conflicts packages manually.
+# Removing those conflicts packages is necessary for install ros-core-dev.
+# Here is the dicussion about this issue: https://github.com/j3soon/ros2-essentials/pull/9#discussion_r1375303858
+# Reference:
+# - https://docs.ros.org/en/humble/How-To-Guides/Using-ros1_bridge-Jammy-upstream.html#ros-2-via-debian-packages
+# - https://github.com/osrf/docker_images/issues/635#issuecomment-1217505552
+RUN rm -rf /etc/apt/sources.list.d/ros2.list && \
+ apt-get remove -y \
+ python3-catkin-pkg \
+ python3-catkin-pkg-modules
+
+# Install ROS 1 from Ubuntu packages.
+# Reference: https://docs.ros.org/en/humble/How-To-Guides/Using-ros1_bridge-Jammy-upstream.html#install-ros-1-from-ubuntu-packages
+RUN apt-get update && \
+ apt-get install -y ros-core-dev
+
+# Build ros1_bridge from source.
+# Reference: https://github.com/ros2/ros1_bridge/tree/3d5328dc21564d2130b4ded30afe5cd1c41cf033#building-the-bridge-from-source
+RUN git clone https://github.com/ros2/ros1_bridge src/ros1_bridge
+RUN source install/setup.bash && \
+ colcon build --packages-select ros1_bridge --cmake-force-configure
+
+# Other configurations
+COPY ./start-bridge.sh /start-bridge.sh
+RUN chmod +x /start-bridge.sh
+
+CMD ["/bin/bash"]
+
+################################################################################################
+# - Release stage
+# - In this stage, I will copy the built files from the build stage.
+# This is useful for reducing the size of the image.
+# - Reference:
+# - https://docs.docker.com/build/building/multi-stage/
+################################################################################################
+
+FROM base AS release
+
+# Install ROS core and packages with their dependencies.
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ libspdlog-dev \
+ python3-packaging \
+ ros-core-dev
+
+# Copy files from host and build stage
+COPY --from=build /ros2_humble/install /ros2_humble/install
+
+# Other configurations
+COPY ./start-bridge.sh /start-bridge.sh
+USER user
+RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc
+
+WORKDIR /
+CMD ["./start-bridge.sh"]
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/docker/Dockerfile-rosserial b/docker/local-ros2/OdomComm/docker/Dockerfile-rosserial
new file mode 100644
index 0000000..4560487
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/Dockerfile-rosserial
@@ -0,0 +1,55 @@
+################################################################################################
+# - Base stage
+# - This stage serves as the foundational stage for all other stages.
+# - Base image: OSRF ROS noetic Desktop Full
+# - https://hub.docker.com/r/osrf/ros/tags?page=1&name=noetic-desktop-full
+################################################################################################
+
+FROM osrf/ros:noetic-desktop-full AS base
+
+LABEL org.opencontainers.image.authors="yoseph.huang@gmail.com"
+
+ARG USERNAME=user
+ARG USER_UID=1000
+ARG USER_GID=$USER_UID
+
+SHELL ["/bin/bash", "-c"]
+
+
+################################################################################################
+# - User Setup stage
+# - In this stage, create a non-root user and configure passwordless sudo.
+################################################################################################
+
+FROM base AS user-setup
+
+## Create a non-root user
+RUN groupadd --gid $USER_GID $USERNAME && \
+ useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash && \
+ apt-get update && \
+ apt-get install -y sudo && \
+ echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
+ chmod 0440 /etc/sudoers.d/$USERNAME && \
+ rm -rf /var/lib/apt/lists/*
+
+FROM user-setup AS catkin
+
+USER ${USERNAME}
+# COPY comm-ws /home/$USERNAME/comm-ws
+RUN mkdir -p /home/$USERNAME/ws/src
+COPY odometry /home/$USERNAME/ws/src/odometry
+
+# catkin_make
+RUN /bin/bash -c "source /opt/ros/noetic/setup.bash && \
+ rosdep update && \
+ cd /home/$USERNAME/ws && \
+ rosdep install -y -r -q --from-paths src --ignore-src --rosdistro noetic && \
+ catkin_make"
+
+FROM catkin AS final
+
+COPY odometry/odometry/launch /home/$USERNAME/ws/src/odometry/launch
+
+## Final configurations
+USER $USERNAME
+CMD ["/bin/bash"]
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/docker/compose-serial.yaml b/docker/local-ros2/OdomComm/docker/compose-serial.yaml
new file mode 100644
index 0000000..f66f575
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/compose-serial.yaml
@@ -0,0 +1,29 @@
+services:
+ ros1:
+ image: ros1:serial
+ container_name: ros1
+ stdin_open: true
+ tty: true
+ network_mode: host
+ privileged: true
+ volumes:
+ # - ../comm-ws:/root/comm-ws
+ # - /dev/bus/usb:/dev/bus/usb
+ - /dev:/dev
+ stop_grace_period: 1s
+ # depends_on:
+ # ros-core:
+ # condition: service_healthy
+ # command: /bin/bash -c "
+ # chmod +x /root/comm-ws/devel/_setup_util.py &&
+ # find /root/comm-ws/devel -type f -name '*.sh' -exec chmod +x {} \; &&
+ # source /opt/ros/noetic/setup.bash &&
+ # source /root/comm-ws/devel/setup.bash &&
+ # cd /root/comm-ws &&
+ # sudo chmod 777 /dev/ttyACM0 &&
+ # roslaunch rosserial_server stm32.launch"
+ command: /bin/bash -c "
+ source /opt/ros/noetic/setup.bash &&
+ source ~/ws/devel/setup.bash &&
+ sudo chmod 777 /dev/ttyACM0 &&
+ roslaunch odometry odometry_comm.launch"
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/docker/compose.yml b/docker/local-ros2/OdomComm/docker/compose.yml
new file mode 100644
index 0000000..48f55dd
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/compose.yml
@@ -0,0 +1,104 @@
+services:
+ ros-core:
+ image: osrf/ros:noetic-desktop-full
+ container_name: ros-core
+ command: "rosmaster --core"
+ network_mode: host
+ stop_grace_period: 1s
+ healthcheck:
+ # The healthcheck is required for ros1-bridge to wait until roscore is ready.
+ test: /ros_entrypoint.sh bash -c "rostopic list || exit 1"
+ interval: 3s
+ timeout: 10s
+ retries: 5
+
+ ros1-bridge:
+ build:
+ context: .
+ target: release
+ image: pomelo925/ttennis-humble:communication
+ container_name: ros2-ros1-bridge-ws
+ stop_grace_period: 1s
+ depends_on:
+ ros-core:
+ # The healthcheck is required for ros1-bridge to wait until roscore is ready.
+ condition: service_healthy
+ command: ./start-bridge.sh
+ stdin_open: true
+ tty: true
+ network_mode: host
+ working_dir: /
+ volumes:
+ # Mount local timezone into container. ( Readonly )
+ # Reference: https://stackoverflow.com/questions/57607381/how-do-i-change-timezone-in-a-docker-container
+ - /etc/timezone:/etc/timezone:ro
+ - /etc/localtime:/etc/localtime:ro
+ # Direct Rendering Infrastructure
+ - /dev/dri:/dev/dri
+ # Shared Memory
+ - /dev/shm:/dev/shm
+ environment:
+ - ROS_DOMAIN_ID=43
+ # - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp=value
+
+ ros1:
+ image: jossiewang/eurobot2025-localization:ros1-serial
+ container_name: ros1
+ stdin_open: true
+ tty: true
+ network_mode: host
+ privileged: true
+ volumes:
+ - /dev:/dev
+ stop_grace_period: 1s
+ depends_on:
+ ros-core:
+ condition: service_healthy
+ command: /bin/bash -c "
+ source /opt/ros/noetic/setup.bash &&
+ source ~/ws/devel/setup.bash &&
+ sudo chmod 777 /dev/ttyACM0 &&
+ roslaunch odometry odometry_comm.launch"
+
+ ros2-localization-dev:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ args:
+ USERNAME: user
+ image: jossiewang/eurobot2025-localization:local-ros2-wSensors
+ container_name: localization-2025-dev-ros2
+ stdin_open: true
+ tty: true
+ privileged: true
+ stop_grace_period: 1s
+ restart: no
+ # entrypoint: ["./start.sh"]
+
+ network_mode: host
+ working_dir: /home/user/localization-ws
+ environment:
+ - DISPLAY=${DISPLAY}
+ # Set ros2 environment variables.
+ # References:
+ # - https://docs.ros.org/en/humble/Concepts/Intermediate/About-Domain-ID.html
+ # - https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html
+ # - ROS_LOCALHOST_ONLY=1
+ - ROS_DOMAIN_ID=43
+ - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
+ - ROS_WS=/home/user/localization-ws
+ volumes:
+ # Mount local timezone into container. ( Readonly )
+ # Reference: https://stackoverflow.com/questions/57607381/how-do-i-change-timezone-in-a-docker-container
+ - /etc/timezone:/etc/timezone:ro
+ - /etc/localtime:/etc/localtime:ro
+ # Mount X11 server
+ - /tmp/.X11-unix:/tmp/.X11-unix
+ # Direct Rendering Infrastructure
+ # - /dev/dri:/dev/dri
+ # Mount sound card to prevent Gazebo warning.
+ # - /dev/snd:/dev/snd
+ - /dev:/dev
+ # Mount workspace
+ - ../../../../localization-devel-ws:/home/user/localization-ws/src/localization-devel-ws
+ command: /bin/bash
\ No newline at end of file
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/CMakeLists.txt b/docker/local-ros2/OdomComm/docker/odometry/odometry/CMakeLists.txt
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/CMakeLists.txt
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/CMakeLists.txt
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/cfg/odometry_param.cfg b/docker/local-ros2/OdomComm/docker/odometry/odometry/cfg/odometry_param.cfg
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/cfg/odometry_param.cfg
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/cfg/odometry_param.cfg
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/include/odometry/odometry.h b/docker/local-ros2/OdomComm/docker/odometry/odometry/include/odometry/odometry.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/include/odometry/odometry.h
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/include/odometry/odometry.h
diff --git a/docker/local-ros2/OdomComm/docker/odometry/odometry/launch/odometry_comm.launch b/docker/local-ros2/OdomComm/docker/odometry/odometry/launch/odometry_comm.launch
new file mode 100644
index 0000000..a330490
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/odometry/odometry/launch/odometry_comm.launch
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ require:
+ publishers: [ driving_duaiduaiduai, odoo_googoogoo ]
+ subscribers: [ ]
+
+
+
+
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/lib/odometry.cpp b/docker/local-ros2/OdomComm/docker/odometry/odometry/lib/odometry.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/lib/odometry.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/lib/odometry.cpp
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/package.xml b/docker/local-ros2/OdomComm/docker/odometry/odometry/package.xml
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/package.xml
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/package.xml
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/param/odometry_comm.yaml b/docker/local-ros2/OdomComm/docker/odometry/odometry/param/odometry_comm.yaml
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/param/odometry_comm.yaml
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/param/odometry_comm.yaml
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/src/odometry_node.cpp b/docker/local-ros2/OdomComm/docker/odometry/odometry/src/odometry_node.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/odometry/src/odometry_node.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/odometry/src/odometry_node.cpp
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/CHANGELOG.rst b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/CHANGELOG.rst
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/CHANGELOG.rst
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/CHANGELOG.rst
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/CMakeLists.txt b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/CMakeLists.txt
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/CMakeLists.txt
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/CMakeLists.txt
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/msg/Log.msg b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/msg/Log.msg
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/msg/Log.msg
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/msg/Log.msg
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/msg/TopicInfo.msg b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/msg/TopicInfo.msg
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/msg/TopicInfo.msg
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/msg/TopicInfo.msg
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/package.xml b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/package.xml
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/package.xml
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/package.xml
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/srv/RequestParam.srv b/docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/srv/RequestParam.srv
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_msgs/srv/RequestParam.srv
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_msgs/srv/RequestParam.srv
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/CHANGELOG.rst b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/CHANGELOG.rst
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/CHANGELOG.rst
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/CHANGELOG.rst
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/CMakeLists.txt b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/CMakeLists.txt
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/CMakeLists.txt
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/CMakeLists.txt
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/async_read_buffer.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/async_read_buffer.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/async_read_buffer.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/async_read_buffer.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/msg_lookup.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/msg_lookup.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/msg_lookup.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/msg_lookup.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/serial_session.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/serial_session.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/serial_session.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/serial_session.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/session.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/session.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/session.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/session.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/tcp_server.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/tcp_server.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/tcp_server.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/tcp_server.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/topic_handlers.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/topic_handlers.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/topic_handlers.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/topic_handlers.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/udp_socket_session.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/udp_socket_session.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/udp_socket_session.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/udp_socket_session.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/udp_stream.h b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/udp_stream.h
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/include/rosserial_server/udp_stream.h
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/include/rosserial_server/udp_stream.h
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/serial.launch b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/serial.launch
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/serial.launch
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/serial.launch
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/socket.launch b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/socket.launch
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/socket.launch
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/socket.launch
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/udp_socket.launch b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/udp_socket.launch
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/launch/udp_socket.launch
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/launch/udp_socket.launch
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/package.xml b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/package.xml
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/package.xml
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/package.xml
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/msg_lookup.cpp b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/msg_lookup.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/msg_lookup.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/msg_lookup.cpp
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/serial_node.cpp b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/serial_node.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/serial_node.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/serial_node.cpp
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/socket_node.cpp b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/socket_node.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/socket_node.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/socket_node.cpp
diff --git a/localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/udp_socket_node.cpp b/docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/udp_socket_node.cpp
similarity index 100%
rename from localization-ws-ros1/src/localization-devel-ws/Eurobot-2024-Localization-main/local_filter/odometry/rosserial_server/src/udp_socket_node.cpp
rename to docker/local-ros2/OdomComm/docker/odometry/rosserial_server/src/udp_socket_node.cpp
diff --git a/docker/local-ros2/OdomComm/docker/start-bridge.sh b/docker/local-ros2/OdomComm/docker/start-bridge.sh
new file mode 100644
index 0000000..1cc90c5
--- /dev/null
+++ b/docker/local-ros2/OdomComm/docker/start-bridge.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+
+if [ $# = 1 ]; then
+ export ROS_MASTER_URI=$1
+else
+ export ROS_MASTER_URI=http://localhost:11311
+fi
+
+# Normally, sourcing the setup.bash file is sufficient to set up the ROS environment.
+# However, the ros1_bridge package can't be found by ROS 2 even if we source the file. Manual sourcing is required.
+source /ros2_humble/install/setup.bash
+source /ros2_humble/install/ros1_bridge/share/ros1_bridge/local_setup.bash
+
+ros2 run ros1_bridge dynamic_bridge
\ No newline at end of file
diff --git a/docker/local-ros2/OdomComm/pull_and_run.sh b/docker/local-ros2/OdomComm/pull_and_run.sh
new file mode 100755
index 0000000..213ad95
--- /dev/null
+++ b/docker/local-ros2/OdomComm/pull_and_run.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+## 0. clean container within same group
+echo "=== [COMMUNICATION] Pull & Run ==="
+echo "[COMMUNICATION] Remove Containers ..."
+docker compose -p communication down --volumes --remove-orphans
+
+## 1. make scripts & library executable
+find ../E.Communication -type f -name "*.sh" -exec sudo chmod +x {} \;
+
+## 2. environment setup
+export DISPLAY=:0
+xhost +local:docker
+cd docker
+
+## 3. build image
+echo "[COMMUNICATION] Pull Images ..."
+docker pull pomelo925/ttennis-humble:communication
+
+## 4. deployment
+echo "[COMMUNICATION] Deploying..."
+docker compose -p communication up
+# docker compose -p communication up -d
\ No newline at end of file
diff --git a/docker/local-ros2/docker-compose.yaml b/docker/local-ros2/docker-compose.yaml
index 96b77fe..b847559 100644
--- a/docker/local-ros2/docker-compose.yaml
+++ b/docker/local-ros2/docker-compose.yaml
@@ -1,13 +1,13 @@
version: '3'
services:
- ros2-localization-dev:
+ noComm-ros2-localization-dev:
build:
context: .
dockerfile: Dockerfile
args:
USERNAME: user
- image: jossiewang/eurobot2025-localization:local-ros2-wSensors
- container_name: localization-2025-dev-ros2
+ image: jossiewang/eurobot2025-localization:devel
+ container_name: noComm-localization-2025-dev-ros2
stdin_open: true
tty: true
privileged: true
@@ -24,8 +24,9 @@ services:
# - https://docs.ros.org/en/humble/Concepts/Intermediate/About-Domain-ID.html
# - https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html
# - ROS_LOCALHOST_ONLY=1
- # - ROS_DOMAIN_ID=42
+ - ROS_DOMAIN_ID=7
- ROS_WS=/home/user/localization-ws
+ - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
volumes:
# Mount local timezone into container. ( Readonly )
# Reference: https://stackoverflow.com/questions/57607381/how-do-i-change-timezone-in-a-docker-container
@@ -48,4 +49,5 @@ services:
# "source=${localWorkspaceFolder}/../cache/humble/log,target=/home/ws/log,type=bind"
# Mount workspace
- ../../localization-devel-ws:/home/user/localization-ws/src/localization-devel-ws
- command: /bin/bash
\ No newline at end of file
+ # command: /bin/bash
+ command: /bin/bash -c "ros2 launch /home/user/localization-ws/src/localization-devel-ws/cust_foxglove_launch.py"
\ No newline at end of file
diff --git a/docker/local-ros2/phidgets_drivers/LICENSE b/docker/local-ros2/phidgets_drivers/LICENSE
new file mode 100644
index 0000000..2863577
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/LICENSE
@@ -0,0 +1,5 @@
+The libphidgets22 library is licensed under the GNU Lesser General Public Licence v3 or later.
+See LICENSE.gplv3 and LICENSE.lgplv3 for the text of the license.
+
+The rest of the code in this repository is licensed under the 3-clause BSD license.
+See LICENSE.bsd for the text of the license.
diff --git a/docker/local-ros2/phidgets_drivers/LICENSE.bsd b/docker/local-ros2/phidgets_drivers/LICENSE.bsd
new file mode 100644
index 0000000..d06df08
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/LICENSE.bsd
@@ -0,0 +1,26 @@
+Copyright (c) 2019, Open Source Robotics Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/docker/local-ros2/phidgets_drivers/LICENSE.gplv3 b/docker/local-ros2/phidgets_drivers/LICENSE.gplv3
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/LICENSE.gplv3
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/docker/local-ros2/phidgets_drivers/LICENSE.lgplv3 b/docker/local-ros2/phidgets_drivers/LICENSE.lgplv3
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/LICENSE.lgplv3
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/docker/local-ros2/phidgets_drivers/README.md b/docker/local-ros2/phidgets_drivers/README.md
new file mode 100644
index 0000000..ccb9d82
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/README.md
@@ -0,0 +1,193 @@
+Phidgets drivers for ROS 2
+==========================
+
+Overview
+--------
+
+Drivers for various [Phidgets](https://www.phidgets.com) devices. This package includes:
+
+* `libphidget22`: a package which downloads and builds the Phidgets C API from
+ phidgets.com as an external project.
+
+* `phidgets_api`: a package that implements a C++ wrapper for the libphidgets22
+ C API, providing some base Phidget helper functions and various classes for
+ different phidget devices.
+
+* `phidgets_msgs`: a package that contains custom messages and services for
+ interacting with the nodes.
+
+* ROS 2 nodes exposing the functionality of specific phidgets devices:
+
+ * [`phidgets_accelerometer`](phidgets_accelerometer/README.md)
+
+ * [`phidgets_analog_inputs`](phidgets_analog_inputs/README.md)
+
+ * [`phidgets_analog_outputs`](phidgets_analog_outputs/README.md)
+
+ * [`phidgets_digital_inputs`](phidgets_digital_inputs/README.md)
+
+ * [`phidgets_digital_outputs`](phidgets_digital_outputs/README.md)
+
+ * [`phidgets_gyroscope`](phidgets_gyroscope/README.md)
+
+ * [`phidgets_high_speed_encoder`](phidgets_high_speed_encoder/README.md)
+
+ * [`phidgets_ik`](phidgets_ik/README.md)
+
+ * [`phidgets_magnetometer`](phidgets_magnetometer/README.md)
+
+ * [`phidgets_motors`](phidgets_motors/README.md)
+
+ * [`phidgets_spatial`](phidgets_spatial/README.md)
+
+ * [`phidgets_temperature`](phidgets_temperature/README.md)
+
+Concerning Phidgets
+-------------------
+
+Phidgets are typically plugged into USB on a host computer (though there are
+wireless ones, they will be ignored here). In the "old-style" Phidgets, there
+was one USB plug per device. So if you have a
+[temperature Phidget](https://www.phidgets.com/?tier=3&catid=14&pcid=12&prodid=1042),
+and an [accelerometer Phidget](https://www.phidgets.com/?tier=3&catid=10&pcid=8&prodid=1026),
+they take up 2 USB plugs on the computer. These "old-style" Phidgets are still
+around and still available for sale, but most of the new development and
+sensors are in "new-style" Phidgets. In "new-style" Phidgets, a
+[VINT hub](https://www.phidgets.com/?tier=3&catid=2&pcid=1&prodid=643) is
+connected to the host computer via USB, and then the other Phidgets connect to
+a port on the VINT hub. Most of the "old-style" Phidget functions (temperature,
+acclerometer, etc.) are also available as "new-style" Phidgets, and most new
+functionality is only available as VINT devices.
+
+### Identifying Phidgets devices ###
+
+All Phidgets that plug directly into a USB port (including the VINT hub) have a
+unique serial number. This serial number is printed on the back of the device,
+and is also printed out by the phidgets drivers when they start up. The serial
+number can be specified as a parameter when the driver starts up; otherwise, the
+default is to connect to *any* Phidgets that are of the correct type at startup.
+
+Uniquely identifying a "new-style" Phidget also requires one more piece of
+information, which is the VINT hub port it is connected to. This also must be
+provided as a parameter when starting up the driver.
+
+Note that there are "smart" and "simple" VINT hub devices. "Smart" devices have
+their own microcontrollers on board and use a protocol to communicate with the
+VINT hub.
+
+"Simple" VINT hub devices don't have a microcontroller. They just provide
+or accept a voltage from the VINT hub port (which can act as a digital input,
+digital output, or analog inputs).
+
+Whether the Phidget is "smart" or "simple" can be determined by looking at the
+"Connection and Compatibility" portion of the webpage for the individual sensor.
+If the device is "smart", then "is_hub_port_device" must be set to "false"
+when launching a driver; if the device is "simple", then "is_hub_port_device"
+must be set to "true".
+
+Installing
+----------
+
+### From packages ###
+
+Make sure you have ROS 2 Dashing or newer installed: https://docs.ros.org
+
+Then run:
+
+ sudo apt-get install ros--phidgets-drivers
+
+### From source ###
+
+Make sure you have ROS 2 Dashing or newer installed: https://docs.ros.org
+
+Also make sure you have git installed:
+
+ sudo apt-get install git-core
+
+Change directory to the source folder of your colcon workspace.
+If, for instance, your workspace is `~/colcon_ws`, make sure there is
+a `src/` folder within it, then execute:
+
+ cd ~/colcon_ws/src
+
+Clone the repository ( may be `dashing`, ...)
+
+ git clone -b https://github.com/ros-drivers/phidgets_drivers.git
+
+Install dependencies using rosdep:
+
+ rosdep install phidgets_drivers
+
+Alternatively, if rosdep does not work, install the following packages:
+
+ sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
+
+Compile your colcon workspace:
+
+ cd ~/colcon_ws
+ colcon build
+
+### Udev rules setup ###
+
+**Note:** The following steps are only required when installing the package
+from source. When installing a binary debian package of `phidgets_api` >= 0.7.8,
+the udev rules are set up automatically.
+
+Make sure your colcon workspace has been successfully compiled.
+To set up the udev rules for the Phidgets USB devices, run the following commands:
+
+ sudo cp ~/colcon_ws/src/phidgets_drivers/phidgets_api/debian/udev /etc/udev/rules.d/99-phidgets.rules
+ sudo udevadm control --reload-rules
+
+Afterwards, disconnect the USB cable and plug it in again (or run `sudo udevadm trigger`).
+
+Running
+-------
+
+You may notice that there are no executables installed by the various phidgets packages.
+Instead, all functionality is available via [ROS 2 components](https://docs.ros.org/en/rolling/Concepts/About-Composition.html).
+The reason for this is that when using phidget VINT hubs, only one process at a time can access the hub.
+Since the hub may have multiple devices connected to it, we need to load multiple different phidgets drivers into the same process.
+We do that through loading multiple components into a single ROS 2 component container.
+
+Luckily, to make things easier in the single device case, we have default launch files for running a single phidgets driver in a single process.
+For instance, you can run the phidgets_spatial node by running:
+
+ ros2 launch phidgets_spatial spatial-launch.py
+
+See the README files in the individual packages above for exact usage of each launch file.
+
+Developing
+----------
+
+To check formatting after modifying source code:
+
+ python3 clang-check-style.py
+
+To reformat source code:
+
+ find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format-6.0 -i -style=file $1
+
+
+pre-commit Formatting Checks
+----------------------------
+
+This repo has a [pre-commit](https://pre-commit.com/) check that runs in CI.
+You can use this locally and set it up to run automatically before you commit
+something. To install, use apt:
+
+```bash
+sudo apt install pre-commit
+```
+
+To run over all the files in the repo manually:
+
+```bash
+pre-commit run -a
+```
+
+To run pre-commit automatically before committing in the local repo, install the git hooks:
+
+```bash
+pre-commit install
+```
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/CHANGELOG.rst b/docker/local-ros2/phidgets_drivers/libphidget22/CHANGELOG.rst
new file mode 100644
index 0000000..324fe84
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/CHANGELOG.rst
@@ -0,0 +1,103 @@
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Changelog for package libphidget22
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+2.3.3 (2024-03-13)
+------------------
+* Update to libphidget22 1.19 (`#176 `_)
+* Contributors: Martin Günther
+
+2.3.2 (2023-11-27)
+------------------
+
+2.3.1 (2023-03-03)
+------------------
+* Update to libphidget22 1.13. (`#160 `_)
+* Contributors: Chris Lalancette
+
+2.3.0 (2022-04-13)
+------------------
+* Update to libphidgets 20220203 (`#138 `_)
+* Contributors: Chris Lalancette
+
+2.2.2 (2022-02-17)
+------------------
+* Remove outdated patch file (`#112 `_)
+* Update to libphidget22-1.7.20210816 (`#108 `_)
+ This is required to support new devices such as the MOT0109.
+ Fixes `#99 `_, fixes `#105 `_.
+ This is a forward-port of `#106 `_ to ROS2.
+* Make sure libphidget22 library can be found. (`#97 `_) (`#100 `_)
+ In Foxy and later, we need to provide the .dsv hook so that
+ the library can be found.
+* Contributors: Chris Lalancette, Martin Günther
+
+2.2.1 (2021-08-03)
+------------------
+* Update to the latest libphidgets 1.6 library. (`#91 `_)
+* Contributors: Chris Lalancette
+
+2.2.0 (2021-05-20)
+------------------
+
+2.1.0 (2021-03-29)
+------------------
+* Compile libphidget22 with -fPIC (`#88 `_)
+* Update to libphidget22 from 2020.
+* Contributors: Chris Lalancette, Scott K Logan
+
+2.0.2 (2020-06-01)
+------------------
+
+2.0.1 (2019-12-05)
+------------------
+
+2.0.0 (2019-12-05)
+------------------
+* Port libphidget22 vendor package to ament.
+* Ignore all packages for ROS 2 port.
+* Update maintainers in package.xml
+* Merge pull request `#39 `_ from clalancette/add-libphidget22
+* Patch warnings in libphidget22.
+* Fix up libphidget22 package.xml dependencies.
+* Add in libphidget22 package.
+* Contributors: Chris Lalancette, Martin Günther
+
+0.7.9 (2019-06-28)
+------------------
+
+0.7.8 (2019-05-06)
+------------------
+
+0.7.7 (2018-09-18)
+------------------
+
+0.7.6 (2018-08-09)
+------------------
+
+0.7.5 (2018-01-31)
+------------------
+
+0.7.4 (2017-10-04)
+------------------
+
+0.7.3 (2017-06-30)
+------------------
+
+0.7.2 (2017-06-02)
+------------------
+
+0.7.1 (2017-05-22)
+------------------
+
+0.7.0 (2017-02-17 17:40)
+------------------------
+
+0.2.3 (2017-02-17 12:11)
+------------------------
+
+0.2.2 (2015-03-23)
+------------------
+
+0.2.1 (2015-01-15)
+------------------
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/CMakeLists.txt b/docker/local-ros2/phidgets_drivers/libphidget22/CMakeLists.txt
new file mode 100644
index 0000000..d0640d5
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.5)
+project(libphidget22)
+
+find_package(ament_cmake REQUIRED)
+
+set(extra_c_flags "-g -O2 -Wno-incompatible-pointer-types -Wno-deprecated-declarations -Wno-format-truncation -fPIC")
+
+include(ExternalProject)
+ExternalProject_Add(EP_${PROJECT_NAME}
+ URL https://www.phidgets.com/downloads/phidget22/libraries/linux/libphidget22/libphidget22-1.19.20240304.tar.gz
+ URL_MD5 9b059eaef8cb8ce70b8abd7e4d309d1d
+
+ SOURCE_DIR ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src
+ CONFIGURE_COMMAND
+ /configure
+ CFLAGS=${extra_c_flags}
+ --prefix=${CMAKE_CURRENT_BINARY_DIR}/libphidget22_install
+ --disable-ldconfig
+ BUILD_COMMAND $(MAKE)
+ INSTALL_COMMAND $(MAKE) install
+)
+
+# The external project will install to the build folder, but we'll install that on make install.
+# Note that we install lib and include separately so we can add the extra level of indirection
+# to the include directory.
+install(
+ DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}/libphidget22_install/lib/
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/opt/libphidget22/lib/
+)
+
+install(
+ DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}/libphidget22_install/include/
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/opt/libphidget22/include/libphidget22/
+)
+
+ament_environment_hooks(env_hook/libphidget22_library_path.sh)
+set(ENV_VAR_NAME "LD_LIBRARY_PATH")
+set(ENV_VAR_VALUE "opt/libphidget22/lib")
+ament_environment_hooks(env_hook/libphidget22_library_path.dsv.in)
+
+ament_package(CONFIG_EXTRAS "cmake/libphidget22-extras.cmake.in")
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/cmake/libphidget22-extras.cmake.in b/docker/local-ros2/phidgets_drivers/libphidget22/cmake/libphidget22-extras.cmake.in
new file mode 100644
index 0000000..7a386fa
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/cmake/libphidget22-extras.cmake.in
@@ -0,0 +1,3 @@
+# TODO(clalancette): Does this work in general?
+list(APPEND @PROJECT_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/../../../opt/libphidget22/include")
+list(APPEND @PROJECT_NAME@_LIBRARIES "${@PROJECT_NAME@_DIR}/../../../opt/libphidget22/lib/libphidget22.so")
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.dsv.in b/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.dsv.in
new file mode 100644
index 0000000..92145c4
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.dsv.in
@@ -0,0 +1 @@
+prepend-non-duplicate;@ENV_VAR_NAME@;@ENV_VAR_VALUE@
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.sh b/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.sh
new file mode 100644
index 0000000..a6e0098
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/env_hook/libphidget22_library_path.sh
@@ -0,0 +1,16 @@
+# copied from libphidget22/env_hook/libphidget22_library_path.sh
+
+# detect if running on Darwin platform
+_UNAME=`uname -s`
+_IS_DARWIN=0
+if [ "$_UNAME" = "Darwin" ]; then
+ _IS_DARWIN=1
+fi
+unset _UNAME
+
+if [ $_IS_DARWIN -eq 0 ]; then
+ ament_prepend_unique_value LD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/opt/libphidget22/lib"
+else
+ ament_prepend_unique_value DYLD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/opt/libphidget22/lib"
+fi
+unset _IS_DARWIN
diff --git a/docker/local-ros2/phidgets_drivers/libphidget22/package.xml b/docker/local-ros2/phidgets_drivers/libphidget22/package.xml
new file mode 100644
index 0000000..027d8de
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/libphidget22/package.xml
@@ -0,0 +1,29 @@
+
+
+
+ libphidget22
+ 2.3.3
+ This package wraps the libphidget22 to use it as a ROS dependency
+
+ Martin Günther
+ Chris Lalancette
+
+ LGPL
+
+ http://ros.org/wiki/libphidget22
+ https://github.com/ros-drivers/phidgets_drivers.git
+ https://github.com/ros-drivers/phidgets_drivers/issues
+
+ Alexander Bubeck
+
+ ament_cmake
+
+ libusb-1.0-dev
+ libusb-1.0
+
+
+ ament_cmake
+
+
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/CHANGELOG.rst b/docker/local-ros2/phidgets_drivers/phidgets_api/CHANGELOG.rst
new file mode 100644
index 0000000..887aa45
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/CHANGELOG.rst
@@ -0,0 +1,179 @@
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Changelog for package phidgets_api
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+2.3.3 (2024-03-13)
+------------------
+
+2.3.2 (2023-11-27)
+------------------
+* added new parameters for spatial precision MOT0109 onwards
+* added support for phidget spatial onboard orientation estimation
+* Contributors: Malte kl. Piening, Martin Günther
+
+2.3.1 (2023-03-03)
+------------------
+* adding support for analog outputs for ROS2 (`#145 `_)
+* Contributors: Alexis Fetet
+
+2.3.0 (2022-04-13)
+------------------
+
+2.2.2 (2022-02-17)
+------------------
+* spatial: Add attach + detach handlers
+* Fix some clang-tidy warnings
+* Fix typo in error message (`#104 `_)
+* Contributors: Martin Günther
+
+2.2.1 (2021-08-03)
+------------------
+
+2.2.0 (2021-05-20)
+------------------
+
+2.1.0 (2021-03-29)
+------------------
+* Switch header guards to _HPP SUFFIX.
+* Remove unnecessary cstddef.
+* Contributors: Chris Lalancette
+
+2.0.2 (2020-06-01)
+------------------
+* Use '=default' for default destructors. (`#66 `_)
+* Contributors: Chris Lalancette
+
+2.0.1 (2019-12-05)
+------------------
+* Switch the buildtoo_depend to ament_cmake_ros. (`#65 `_)
+* Contributors: Chris Lalancette
+
+2.0.0 (2019-12-05)
+------------------
+* Remove unnecessary base-class initialization.
+* Get rid of C-style casts.
+* Make sure what() method is marked as override.
+* Rename method parameter name to match implementation.
+* Make sure to include cstddef for libphidget22.h include.
+* Make sure to initialize class member variables.
+* Reformat using clang
+* Make sure to set the VoltageRange to AUTO at the beginning.
+* Only publish motor_back_emf if supported by DC Motor device (`#53 `_)
+* Print out the serial number when connecting.
+* Port phidgets_api to ament.
+* Ignore all packages for ROS 2 port.
+* Update maintainers in package.xml
+* Merge pull request `#39 `_ from clalancette/add-libphidget22
+* Add in try/catch blocks for connecting.
+* Fixes from review.
+* Implement data interval setting for analog inputs.
+* Add in the license files and add to the headers.
+* Completely remove libphidget21.
+* Rewrite Motor Phidget to use libphidget22.
+* Rewrite High Speed Encoder to use libphidget22.
+* Rewrite IR to use libphidget22.
+* Rewrite IMU using libphidget22.
+* Add support for Phidgets Magnetometer sensors.
+* Add support for Phidgets Gyroscope sensors.
+* Add support for Phidgets Accelerometer sensors.
+* Add in support for Phidgets Temperature sensors.
+* Rewrite phidgets_ik on top of libphidget22 classes.
+* Add in support for Phidgets Analog inputs.
+* Add in support for Phidgets Digital Inputs.
+* Add in support for Phidgets Digital Outputs.
+* Add in libphidget22 helper functions.
+* Rename Phidget class to Phidget21 class.
+* Switch to C++14.
+* Merge pull request `#36 `_ from clalancette/phidget-cleanup2
+* Run clang-format on the whole codebase.
+* Switch to C++14 everywhere.
+* Remove unused indexHandler from Encoder class.
+* Change API from separate open/waitForAttachment to openAndWaitForAttachment.
+* Small cleanups throughout the code.
+* Push libphidgets API calls down to phidgets_api.
+* Quiet down the to-be-overridden callbacks.
+* Consistently use nullptr instead of 0.
+* Make the phidget_api destructors virtual.
+* Style cleanup.
+* Move libusb dependency into the libphidget21 package.xml.
+* Switch to package format 2.
+* Cleanup spacing in all of the CMakeLists.txt
+* Contributors: Chris Lalancette, Martin Günther, Peter Polidoro
+
+0.7.9 (2019-06-28)
+------------------
+* Add missing OnInputChange handler (`#33 `_)
+* Contributors: Kai Hermann
+
+0.7.8 (2019-05-06)
+------------------
+* Install udev rules on binary package installation
+* Contributors: Martin Günther
+
+0.7.7 (2018-09-18)
+------------------
+
+0.7.6 (2018-08-09)
+------------------
+
+0.7.5 (2018-01-31)
+------------------
+* Add support for the phidgets_ik (Phidgets Interface Kit)
+* Contributors: Russel Howe, James Sarrett, Martin Günther
+
+0.7.4 (2017-10-04)
+------------------
+* Fix typo and doxygen docs
+* Contributors: Jose Luis Blanco Claraco, Martin Günther
+
+0.7.3 (2017-06-30)
+------------------
+
+0.7.2 (2017-06-02)
+------------------
+
+0.7.1 (2017-05-22)
+------------------
+* Set event handlers for motor + encoder APIs
+* Added basic motor api
+* Added basic encoder board api
+* Contributors: Zach Anderson, Martin Günther
+
+0.7.0 (2017-02-17)
+------------------
+* Use our own libphidget21 instead of external libphidgets
+* Contributors: Martin Günther
+
+0.2.3 (2017-02-17)
+------------------
+* Add IMU diagnostics (`#24 `_)
+* Contributors: Mani Monajjemi, Keshav Iyengar, Martin Günther
+
+0.2.2 (2015-03-23)
+------------------
+* phidgets_api: updated build/installation rules to use 3rd party libphdigets ROS package
+* phidgets_api: updated package details
+* phidgets_api: added copy of udev rule to package and updated path in script
+* phidgets_api: updated path to libphidgets header file
+* phidgets_api: removed license and header file of phidgets library
+* Contributors: Murilo FM
+
+0.2.1 (2015-01-15)
+------------------
+* phidgets_api: add libusb dependency
+ This caused Jenkins CI tests to fail.
+* phidgets_api: fix case in CMakeLists
+* phidgets_api: added GNU LGPLv3 copy (phidget21.h)
+* phidgets_api: updated license and author information
+* phidgets_api: added script to setup udev rules for Phidgets devices
+* phidgets_api: added libphidget21 dependency as cmake external project
+* phidgets_api: updated path to libphidget header file
+* phidgets_api: added libphidget header file to package
+* phidgets_api: removed phidgets_c_api dependency
+* Deleted comments within files of all packages
+* Catkinised packages
+* added missing cmakelists
+* added api, imu and ir
+* removed deps directory
+* initial commit
+* Contributors: Ivan Dryanovski, Martin Günther, Murilo FM
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/CMakeLists.txt b/docker/local-ros2/phidgets_drivers/phidgets_api/CMakeLists.txt
new file mode 100644
index 0000000..c3232bf
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/CMakeLists.txt
@@ -0,0 +1,57 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(phidgets_api)
+
+# Default to C++14
+if(NOT CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 14)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ add_compile_options(-Wall -Wextra -Wpedantic)
+endif()
+
+find_package(ament_cmake_ros REQUIRED)
+find_package(libphidget22 REQUIRED)
+
+include_directories(include)
+
+add_library(phidgets_api src/accelerometer.cpp
+ src/analog_input.cpp
+ src/analog_inputs.cpp
+ src/analog_output.cpp
+ src/analog_outputs.cpp
+ src/digital_input.cpp
+ src/digital_inputs.cpp
+ src/digital_output.cpp
+ src/digital_outputs.cpp
+ src/encoder.cpp
+ src/encoders.cpp
+ src/gyroscope.cpp
+ src/ir.cpp
+ src/magnetometer.cpp
+ src/motor.cpp
+ src/motors.cpp
+ src/phidget22.cpp
+ src/spatial.cpp
+ src/temperature.cpp)
+
+ament_target_dependencies(phidgets_api
+ libphidget22
+)
+
+install(TARGETS phidgets_api
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+install(DIRECTORY include/
+ DESTINATION include
+)
+
+ament_export_dependencies(ament_cmake libphidget22)
+ament_export_include_directories(include)
+ament_export_libraries(phidgets_api)
+
+ament_package()
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/debian/udev b/docker/local-ros2/phidgets_drivers/phidgets_api/debian/udev
new file mode 100644
index 0000000..52074cc
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/debian/udev
@@ -0,0 +1,7 @@
+# Very old Phidgets
+SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="8101", MODE="666"
+SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="8104", MODE="666"
+SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0925", ATTRS{idProduct}=="8201", MODE="666"
+
+# All current and future Phidgets - Vendor = 0x06c2, Product = 0x0030 - 0x00af
+SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="06c2", ATTRS{idProduct}=="00[3-a][0-f]", MODE="666"
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/accelerometer.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/accelerometer.hpp
new file mode 100644
index 0000000..a0f5690
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/accelerometer.hpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ACCELEROMETER_HPP
+#define PHIDGETS_API_ACCELEROMETER_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Accelerometer final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Accelerometer)
+
+ explicit Accelerometer(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function data_handler);
+
+ ~Accelerometer();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void getAcceleration(double &x, double &y, double &z,
+ double ×tamp) const;
+
+ void setDataInterval(uint32_t interval_ms) const;
+
+ void dataHandler(const double acceleration[3], double timestamp) const;
+
+ private:
+ int32_t serial_number_;
+ std::function data_handler_;
+ PhidgetAccelerometerHandle accel_handle_{nullptr};
+
+ static void DataHandler(PhidgetAccelerometerHandle input_handle, void *ctx,
+ const double acceleration[3], double timestamp);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ACCELEROMETER_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_input.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_input.hpp
new file mode 100644
index 0000000..4664874
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_input.hpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ANALOG_INPUT_HPP
+#define PHIDGETS_API_ANALOG_INPUT_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class AnalogInput final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(AnalogInput)
+
+ explicit AnalogInput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel,
+ std::function input_handler);
+
+ ~AnalogInput();
+
+ int32_t getSerialNumber() const noexcept;
+
+ double getSensorValue() const;
+
+ void setDataInterval(uint32_t data_interval_ms) const;
+
+ void voltageChangeHandler(double sensorValue) const;
+
+ private:
+ int32_t serial_number_;
+ int channel_;
+ std::function input_handler_;
+ PhidgetVoltageInputHandle ai_handle_{nullptr};
+
+ static void VoltageChangeHandler(PhidgetVoltageInputHandle input_handle,
+ void *ctx, double sensorValue);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ANALOG_INPUT_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_inputs.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_inputs.hpp
new file mode 100644
index 0000000..a961932
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_inputs.hpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ANALOG_INPUTS_HPP
+#define PHIDGETS_API_ANALOG_INPUTS_HPP
+
+#include
+#include
+#include
+
+#include "phidgets_api/analog_input.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class AnalogInputs final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(AnalogInputs)
+
+ explicit AnalogInputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function input_handler);
+
+ ~AnalogInputs() = default;
+
+ int32_t getSerialNumber() const noexcept;
+
+ uint32_t getInputCount() const noexcept;
+
+ double getSensorValue(int index) const;
+
+ void setDataInterval(int index, uint32_t data_interval_ms) const;
+
+ private:
+ uint32_t input_count_{0};
+ std::vector> ais_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ANALOG_INPUTS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_output.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_output.hpp
new file mode 100644
index 0000000..fec7564
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_output.hpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ANALOG_OUTPUT_HPP
+#define PHIDGETS_API_ANALOG_OUTPUT_HPP
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class AnalogOutput final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(AnalogOutput)
+
+ explicit AnalogOutput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel);
+
+ ~AnalogOutput();
+
+ void setOutputVoltage(double voltage) const;
+
+ void setEnabledOutput(int enabled) const;
+
+ private:
+ PhidgetVoltageOutputHandle ao_handle_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ANALOG_OUTPUT_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_outputs.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_outputs.hpp
new file mode 100644
index 0000000..d93fa5f
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/analog_outputs.hpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ANALOG_OUTPUTS_HPP
+#define PHIDGETS_API_ANALOG_OUTPUTS_HPP
+
+#include
+#include
+
+#include "phidgets_api/analog_output.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class AnalogOutputs final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(AnalogOutputs)
+
+ explicit AnalogOutputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device);
+
+ ~AnalogOutputs();
+
+ uint32_t getOutputCount() const noexcept;
+
+ void setOutputVoltage(int index, double voltage) const;
+
+ void setEnabledOutput(int index, int enabled) const;
+
+ private:
+ uint32_t output_count_;
+ std::vector> aos_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ANALOG_INPUTS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_input.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_input.hpp
new file mode 100644
index 0000000..cca92b4
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_input.hpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_DIGITAL_INPUT_HPP
+#define PHIDGETS_API_DIGITAL_INPUT_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class DigitalInput
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(DigitalInput)
+
+ explicit DigitalInput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel,
+ std::function input_handler);
+
+ ~DigitalInput();
+
+ int32_t getSerialNumber() const noexcept;
+
+ bool getInputValue() const;
+
+ void stateChangeHandler(int state) const;
+
+ private:
+ int32_t serial_number_;
+ int channel_;
+ std::function input_handler_;
+ PhidgetDigitalInputHandle di_handle_{nullptr};
+
+ static void StateChangeHandler(PhidgetDigitalInputHandle input_handle,
+ void *ctx, int state);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_DIGITAL_INPUT_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_inputs.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_inputs.hpp
new file mode 100644
index 0000000..5188c6f
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_inputs.hpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_DIGITAL_INPUTS_HPP
+#define PHIDGETS_API_DIGITAL_INPUTS_HPP
+
+#include
+#include
+#include
+
+#include "phidgets_api/digital_input.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class DigitalInputs
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(DigitalInputs)
+
+ explicit DigitalInputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function input_handler);
+
+ ~DigitalInputs() = default;
+
+ int32_t getSerialNumber() const noexcept;
+
+ uint32_t getInputCount() const noexcept;
+
+ bool getInputValue(int index) const;
+
+ private:
+ uint32_t input_count_{0};
+ std::vector> dis_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_DIGITAL_INPUTS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_output.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_output.hpp
new file mode 100644
index 0000000..937967b
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_output.hpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_DIGITAL_OUTPUT_HPP
+#define PHIDGETS_API_DIGITAL_OUTPUT_HPP
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class DigitalOutput final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(DigitalOutput)
+
+ explicit DigitalOutput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel);
+
+ ~DigitalOutput();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void setOutputState(bool state) const;
+
+ private:
+ int32_t serial_number_;
+ PhidgetDigitalOutputHandle do_handle_{nullptr};
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_DIGITAL_OUTPUT_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_outputs.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_outputs.hpp
new file mode 100644
index 0000000..b87a57b
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/digital_outputs.hpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_DIGITAL_OUTPUTS_HPP
+#define PHIDGETS_API_DIGITAL_OUTPUTS_HPP
+
+#include
+#include
+
+#include "phidgets_api/digital_output.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class DigitalOutputs final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(DigitalOutputs)
+
+ explicit DigitalOutputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device);
+
+ ~DigitalOutputs() = default;
+
+ int32_t getSerialNumber() const noexcept;
+
+ uint32_t getOutputCount() const noexcept;
+
+ void setOutputState(int index, bool state) const;
+
+ private:
+ uint32_t output_count_{0};
+ std::vector> dos_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_DIGITAL_OUTPUTS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoder.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoder.hpp
new file mode 100644
index 0000000..6ed06ec
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoder.hpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ENCODER_HPP
+#define PHIDGETS_API_ENCODER_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Encoder final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Encoder)
+
+ explicit Encoder(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ int channel,
+ std::function position_change_handler);
+
+ ~Encoder();
+
+ int32_t getSerialNumber() const noexcept;
+
+ /** @brief Reads the current position of an encoder
+ */
+ int64_t getPosition() const;
+
+ /** @brief Sets the offset of an encoder such that current position is the
+ * specified value
+ * @param position The new value that should be returned by
+ * 'getPosition(index)' at the current position of the encoder*/
+ void setPosition(int64_t position) const;
+
+ /** @brief Gets the position of an encoder the last time an index pulse
+ * occured. An index pulse in this context refers to an input from the
+ * encoder the pulses high once every revolution.
+ */
+ int64_t getIndexPosition() const;
+
+ /** @brief Checks if an encoder is powered on and receiving events
+ */
+ bool getEnabled() const;
+
+ /** @brief Set the powered state of an encoder. If an encoder is not
+ * enabled, it will not be given power, and events and changes in position
+ * will not be captured.
+ * @param enabled The new powered state of the encoder*/
+ void setEnabled(bool enabled) const;
+
+ void positionChangeHandler(int position_change, double time,
+ int index_triggered);
+
+ private:
+ int32_t serial_number_;
+ int channel_;
+ std::function position_change_handler_;
+ PhidgetEncoderHandle encoder_handle_{nullptr};
+
+ static void PositionChangeHandler(PhidgetEncoderHandle phid, void *ctx,
+ int position_change, double time,
+ int index_triggered);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ENCODER_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoders.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoders.hpp
new file mode 100644
index 0000000..54a59c2
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/encoders.hpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_ENCODERS_HPP
+#define PHIDGETS_API_ENCODERS_HPP
+
+#include
+#include
+#include
+
+#include "phidgets_api/encoder.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Encoders final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Encoders)
+
+ explicit Encoders(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function position_change_handler);
+
+ ~Encoders() = default;
+
+ int32_t getSerialNumber() const noexcept;
+
+ /**@brief Gets the number of encoder input channels supported by this board
+ */
+ uint32_t getEncoderCount() const;
+
+ /** @brief Reads the current position of an encoder
+ * @param index The index of the encoder to read */
+ int64_t getPosition(int index) const;
+
+ /** @brief Sets the offset of an encoder such that current position is the
+ * specified value
+ * @param index The index of the encoder to set
+ * @param position The new value that should be returned by
+ * 'getPosition(index)' at the current position of the encoder*/
+ void setPosition(int index, int64_t position) const;
+
+ /** @brief Gets the position of an encoder the last time an index pulse
+ * occured. An index pulse in this context refers to an input from the
+ * encoder the pulses high once every revolution.
+ * @param index The index of the encoder to read */
+ int64_t getIndexPosition(int index) const;
+
+ /** @brief Checks if an encoder is powered on and receiving events
+ * @param index The index of the encoder to check */
+ bool getEnabled(int index) const;
+
+ /** @brief Set the powered state of an encoder. If an encoder is not
+ * enabled, it will not be given power, and events and changes in position
+ * will not be captured.
+ * @param index The index of the encoder to change
+ * @param enabled The new powered state of the encoder*/
+ void setEnabled(int index, bool enabled) const;
+
+ private:
+ uint32_t encoder_count_{0};
+ std::vector> encs_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_ENCODERS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/gyroscope.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/gyroscope.hpp
new file mode 100644
index 0000000..b0326a9
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/gyroscope.hpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_GYROSCOPE_HPP
+#define PHIDGETS_API_GYROSCOPE_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Gyroscope final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Gyroscope)
+
+ explicit Gyroscope(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function data_handler);
+
+ ~Gyroscope();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void getAngularRate(double &x, double &y, double &z,
+ double ×tamp) const;
+
+ void setDataInterval(uint32_t interval_ms) const;
+
+ void zero() const;
+
+ void dataHandler(const double angular_rate[3], double timestamp) const;
+
+ private:
+ int32_t serial_number_;
+ std::function data_handler_;
+ PhidgetGyroscopeHandle gyro_handle_{nullptr};
+
+ static void DataHandler(PhidgetGyroscopeHandle input_handle, void *ctx,
+ const double angular_rate[3], double timestamp);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_GYROSCOPE_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/ir.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/ir.hpp
new file mode 100644
index 0000000..050af4b
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/ir.hpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_IR_HPP
+#define PHIDGETS_API_IR_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class IR final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(IR)
+
+ explicit IR(int32_t serial_number,
+ std::function code_handler);
+
+ ~IR();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void codeHandler(const char *code, uint32_t bit_count, int is_repeat) const;
+
+ private:
+ int32_t serial_number_;
+ std::function code_handler_;
+ PhidgetIRHandle ir_handle_{nullptr};
+
+ static void CodeHandler(PhidgetIRHandle ir, void *ctx, const char *code,
+ uint32_t bit_count, int is_repeat);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_IR_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/magnetometer.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/magnetometer.hpp
new file mode 100644
index 0000000..f13684a
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/magnetometer.hpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_MAGNETOMETER_HPP
+#define PHIDGETS_API_MAGNETOMETER_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Magnetometer final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Magnetometer)
+
+ explicit Magnetometer(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function data_handler);
+
+ ~Magnetometer();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void setCompassCorrectionParameters(double cc_mag_field, double cc_offset0,
+ double cc_offset1, double cc_offset2,
+ double cc_gain0, double cc_gain1,
+ double cc_gain2, double cc_T0,
+ double cc_T1, double cc_T2,
+ double cc_T3, double cc_T4,
+ double cc_T5);
+
+ void getMagneticField(double &x, double &y, double &z,
+ double ×tamp) const;
+
+ void setDataInterval(uint32_t interval_ms) const;
+
+ void dataHandler(const double magnetic_field[3], double timestamp) const;
+
+ private:
+ int32_t serial_number_;
+ std::function data_handler_;
+ PhidgetMagnetometerHandle mag_handle_{nullptr};
+
+ static void DataHandler(PhidgetMagnetometerHandle input_handle, void *ctx,
+ const double magnetic_field[3], double timestamp);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_MAGNETOMETER_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motor.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motor.hpp
new file mode 100644
index 0000000..aab3ad5
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motor.hpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_MOTOR_HPP
+#define PHIDGETS_API_MOTOR_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Motor final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Motor)
+
+ explicit Motor(int32_t serial_number, int hub_port, bool is_hub_port_device,
+ int channel,
+ std::function duty_cycle_change_handler,
+ std::function back_emf_change_handler);
+
+ ~Motor();
+
+ int32_t getSerialNumber() const noexcept;
+
+ double getDutyCycle() const;
+ void setDutyCycle(double duty_cycle) const;
+ double getAcceleration() const;
+ void setAcceleration(double acceleration) const;
+ bool backEMFSensingSupported() const;
+ double getBackEMF() const;
+ void setDataInterval(uint32_t data_interval_ms) const;
+
+ double getBraking() const;
+ void setBraking(double braking) const;
+
+ void dutyCycleChangeHandler(double duty_cycle) const;
+
+ void backEMFChangeHandler(double back_emf) const;
+
+ private:
+ int32_t serial_number_;
+ int channel_;
+ std::function duty_cycle_change_handler_;
+ std::function back_emf_change_handler_;
+ PhidgetDCMotorHandle motor_handle_{nullptr};
+ bool back_emf_sensing_supported_;
+
+ static void DutyCycleChangeHandler(PhidgetDCMotorHandle motor_handle,
+ void *ctx, double duty_cycle);
+ static void BackEMFChangeHandler(PhidgetDCMotorHandle motor_handle,
+ void *ctx, double back_emf);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_MOTOR_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motors.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motors.hpp
new file mode 100644
index 0000000..c7a450d
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/motors.hpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_MOTORS_HPP
+#define PHIDGETS_API_MOTORS_HPP
+
+#include
+#include
+#include
+
+#include "phidgets_api/motor.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Motors final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Motors)
+
+ explicit Motors(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function duty_cycle_change_handler,
+ std::function back_emf_change_handler);
+
+ ~Motors() = default;
+
+ int32_t getSerialNumber() const noexcept;
+
+ uint32_t getMotorCount() const noexcept;
+ double getDutyCycle(int index) const;
+ void setDutyCycle(int index, double duty_cycle) const;
+ double getAcceleration(int index) const;
+ void setAcceleration(int index, double acceleration) const;
+ bool backEMFSensingSupported(int index) const;
+ double getBackEMF(int index) const;
+ void setDataInterval(int index, uint32_t data_interval_ms) const;
+
+ double getBraking(int index) const;
+ void setBraking(int index, double braking) const;
+
+ private:
+ uint32_t motor_count_{0};
+ std::vector> motors_;
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_MOTORS_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/phidget22.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/phidget22.hpp
new file mode 100644
index 0000000..7c31a26
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/phidget22.hpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_PHIDGET22_HPP
+#define PHIDGETS_API_PHIDGET22_HPP
+
+#include
+#include
+
+#include
+
+#define PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Classname) \
+ Classname(const Classname &) = delete; \
+ void operator=(const Classname &) = delete; \
+ Classname(Classname &&) = delete; \
+ void operator=(Classname &&) = delete;
+
+namespace phidgets {
+
+class Phidget22Error final : public std::exception
+{
+ public:
+ explicit Phidget22Error(const std::string &msg, PhidgetReturnCode code);
+
+ const char *what() const noexcept override;
+
+ private:
+ std::string msg_;
+};
+
+namespace helpers {
+
+void openWaitForAttachment(PhidgetHandle handle, int32_t serial_number,
+ int hub_port, bool is_hub_port_device, int channel);
+
+void closeAndDelete(PhidgetHandle *handle) noexcept;
+
+} // namespace helpers
+} // namespace phidgets
+
+#endif // PHIDGETS_API_PHIDGET22_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/spatial.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/spatial.hpp
new file mode 100644
index 0000000..ffb1302
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/spatial.hpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_SPATIAL_HPP
+#define PHIDGETS_API_SPATIAL_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+class Spatial final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Spatial)
+
+ explicit Spatial(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function
+ data_handler,
+ std::function algorithm_data_handler,
+ std::function attach_handler = nullptr,
+ std::function detach_handler = nullptr);
+
+ ~Spatial();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void setCompassCorrectionParameters(double cc_mag_field, double cc_offset0,
+ double cc_offset1, double cc_offset2,
+ double cc_gain0, double cc_gain1,
+ double cc_gain2, double cc_T0,
+ double cc_T1, double cc_T2,
+ double cc_T3, double cc_T4,
+ double cc_T5);
+
+ void setSpatialAlgorithm(const std::string algorithm);
+
+ void setAHRSParameters(double angularVelocityThreshold,
+ double angularVelocityDeltaThreshold,
+ double accelerationThreshold, double magTime,
+ double accelTime, double biasTime);
+
+ void setAlgorithmMagnetometerGain(double magnetometer_gain);
+
+ void setHeatingEnabled(bool heating_enabled);
+
+ void setDataInterval(uint32_t interval_ms) const;
+
+ void zero() const;
+
+ void dataHandler(const double acceleration[3], const double angular_rate[3],
+ const double magnetic_field[3], double timestamp) const;
+
+ void algorithmDataHandler(const double quaternion[4],
+ double timestamp) const;
+
+ virtual void attachHandler();
+ virtual void detachHandler();
+
+ private:
+ int32_t serial_number_;
+ std::function
+ data_handler_;
+
+ std::function
+ algorithm_data_handler_;
+
+ std::function attach_handler_;
+ std::function detach_handler_;
+
+ PhidgetSpatialHandle spatial_handle_{nullptr};
+
+ static void DataHandler(PhidgetSpatialHandle input_handle, void *ctx,
+ const double acceleration[3],
+ const double angular_rate[3],
+ const double magnetic_field[3], double timestamp);
+ static void AlgorithmDataHandler(PhidgetSpatialHandle input_handle,
+ void *ctx, const double quaternion[4],
+ double timestamp);
+ static void AttachHandler(PhidgetHandle input_handle, void *ctx);
+ static void DetachHandler(PhidgetHandle input_handle, void *ctx);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_SPATIAL_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/temperature.hpp b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/temperature.hpp
new file mode 100644
index 0000000..5d20404
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/include/phidgets_api/temperature.hpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PHIDGETS_API_TEMPERATURE_HPP
+#define PHIDGETS_API_TEMPERATURE_HPP
+
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+enum class ThermocoupleType {
+ J_TYPE = 1,
+ K_TYPE = 2,
+ E_TYPE = 3,
+ T_TYPE = 4,
+};
+
+class Temperature final
+{
+ public:
+ PHIDGET22_NO_COPY_NO_MOVE_NO_ASSIGN(Temperature)
+
+ explicit Temperature(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function temperature_handler);
+
+ ~Temperature();
+
+ int32_t getSerialNumber() const noexcept;
+
+ void setThermocoupleType(ThermocoupleType type);
+
+ double getTemperature() const;
+
+ void setDataInterval(uint32_t interval_ms) const;
+
+ void temperatureChangeHandler(double temperature) const;
+
+ private:
+ int32_t serial_number_;
+ std::function temperature_handler_;
+ PhidgetTemperatureSensorHandle temperature_handle_{nullptr};
+
+ static void TemperatureChangeHandler(
+ PhidgetTemperatureSensorHandle temperature_handle, void *ctx,
+ double temperature);
+};
+
+} // namespace phidgets
+
+#endif // PHIDGETS_API_TEMPERATURE_HPP
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/package.xml b/docker/local-ros2/phidgets_drivers/phidgets_api/package.xml
new file mode 100644
index 0000000..c1c096d
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/package.xml
@@ -0,0 +1,26 @@
+
+
+ phidgets_api
+ 2.3.3
+ A C++ Wrapper for the Phidgets C API
+
+ Martin Günther
+ Chris Lalancette
+
+ BSD
+
+ http://ros.org/wiki/phidgets_api
+ https://github.com/ros-drivers/phidgets_drivers.git
+ https://github.com/ros-drivers/phidgets_drivers/issues
+
+ Tully Foote
+ Ivan Dryanovski
+
+ ament_cmake_ros
+
+ libphidget22
+
+
+ ament_cmake
+
+
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/accelerometer.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/accelerometer.cpp
new file mode 100644
index 0000000..869c498
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/accelerometer.cpp
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "phidgets_api/accelerometer.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Accelerometer::Accelerometer(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function data_handler)
+ : serial_number_(serial_number), data_handler_(data_handler)
+{
+ PhidgetReturnCode ret = PhidgetAccelerometer_create(&accel_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Accelerometer handle", ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(accel_handle_), serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = PhidgetAccelerometer_setOnAccelerationChangeHandler(
+ accel_handle_, DataHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set change handler for acceleration",
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(accel_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for acceleration",
+ ret);
+ }
+ }
+}
+
+Accelerometer::~Accelerometer()
+{
+ PhidgetHandle handle = reinterpret_cast(accel_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Accelerometer::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void Accelerometer::getAcceleration(double &x, double &y, double &z,
+ double ×tamp) const
+{
+ double accel[3];
+ PhidgetReturnCode ret =
+ PhidgetAccelerometer_getAcceleration(accel_handle_, &accel);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get acceleration", ret);
+ }
+
+ x = accel[0];
+ y = accel[1];
+ z = accel[2];
+
+ double ts;
+ ret = PhidgetAccelerometer_getTimestamp(accel_handle_, &ts);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get acceleration timestamp", ret);
+ }
+
+ timestamp = ts;
+}
+
+void Accelerometer::setDataInterval(uint32_t interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetAccelerometer_setDataInterval(accel_handle_, interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval", ret);
+ }
+}
+
+void Accelerometer::dataHandler(const double acceleration[3],
+ double timestamp) const
+{
+ data_handler_(acceleration, timestamp);
+}
+
+void Accelerometer::DataHandler(PhidgetAccelerometerHandle /* input_handle */,
+ void *ctx, const double acceleration[3],
+ double timestamp)
+{
+ (reinterpret_cast(ctx))
+ ->dataHandler(acceleration, timestamp);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_input.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_input.cpp
new file mode 100644
index 0000000..4298bce
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_input.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "phidgets_api/analog_input.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+AnalogInput::AnalogInput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel,
+ std::function input_handler)
+ : serial_number_(serial_number),
+ channel_(channel),
+ input_handler_(input_handler)
+{
+ PhidgetReturnCode ret = PhidgetVoltageInput_create(&ai_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create AnalogInput handle for channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(ai_handle_),
+ serial_number, hub_port, is_hub_port_device,
+ channel);
+
+ if (!is_hub_port_device)
+ {
+ ret =
+ PhidgetVoltageInput_setVoltageRange(ai_handle_, VOLTAGE_RANGE_AUTO);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set analog input voltage range",
+ ret);
+ }
+ }
+
+ ret = PhidgetVoltageInput_setOnVoltageChangeHandler(
+ ai_handle_, VoltageChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set change handler for AnalogInput channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(ai_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get serial number for analog input channel " +
+ std::to_string(channel),
+ ret);
+ }
+ }
+}
+
+AnalogInput::~AnalogInput()
+{
+ PhidgetHandle handle = reinterpret_cast(ai_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t AnalogInput::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+double AnalogInput::getSensorValue() const
+{
+ double sensor_value;
+ PhidgetReturnCode ret =
+ PhidgetVoltageInput_getSensorValue(ai_handle_, &sensor_value);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get analog sensor value", ret);
+ }
+
+ return sensor_value;
+}
+
+void AnalogInput::setDataInterval(uint32_t data_interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetVoltageInput_setDataInterval(ai_handle_, data_interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set analog data interval", ret);
+ }
+}
+
+void AnalogInput::voltageChangeHandler(double sensorValue) const
+{
+ input_handler_(channel_, sensorValue);
+}
+
+void AnalogInput::VoltageChangeHandler(
+ PhidgetVoltageInputHandle /* input_handle */, void *ctx, double sensorValue)
+{
+ (reinterpret_cast(ctx))->voltageChangeHandler(sensorValue);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_inputs.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_inputs.cpp
new file mode 100644
index 0000000..a730b39
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_inputs.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "phidgets_api/analog_input.hpp"
+#include "phidgets_api/analog_inputs.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+AnalogInputs::AnalogInputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function input_handler)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetVoltageInputHandle ai_handle;
+
+ ret = PhidgetVoltageInput_create(&ai_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create AnalogInput handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(ai_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_VOLTAGEINPUT,
+ &input_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get AnalogInput device channel count",
+ ret);
+ }
+
+ ais_.resize(input_count_);
+ for (uint32_t i = 0; i < input_count_; ++i)
+ {
+ ais_[i] = std::make_unique(
+ serial_number, hub_port, is_hub_port_device, i, input_handler);
+ }
+}
+
+int32_t AnalogInputs::getSerialNumber() const noexcept
+{
+ return ais_.at(0)->getSerialNumber();
+}
+
+uint32_t AnalogInputs::getInputCount() const noexcept
+{
+ return input_count_;
+}
+
+double AnalogInputs::getSensorValue(int index) const
+{
+ return ais_.at(index)->getSensorValue();
+}
+
+void AnalogInputs::setDataInterval(int index, uint32_t data_interval_ms) const
+{
+ ais_.at(index)->setDataInterval(data_interval_ms);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_output.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_output.cpp
new file mode 100644
index 0000000..6e1619f
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_output.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/analog_output.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+AnalogOutput::AnalogOutput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel)
+{
+ PhidgetReturnCode ret;
+ ret = PhidgetVoltageOutput_create(&ao_handle_);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create AnalogOutput handle for channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(ao_handle_),
+ serial_number, hub_port, is_hub_port_device,
+ channel);
+}
+
+AnalogOutput::~AnalogOutput()
+{
+ PhidgetHandle handle = reinterpret_cast(ao_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+void AnalogOutput::setOutputVoltage(double voltage) const
+{
+ PhidgetReturnCode ret =
+ PhidgetVoltageOutput_setVoltage(ao_handle_, voltage);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set analog output voltage", ret);
+ }
+}
+
+void AnalogOutput::setEnabledOutput(int enabled) const
+{
+ PhidgetReturnCode ret =
+ PhidgetVoltageOutput_setEnabled(ao_handle_, enabled);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set analog output enabled", ret);
+ }
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_outputs.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_outputs.cpp
new file mode 100644
index 0000000..bb5cc89
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/analog_outputs.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+
+#include
+
+#include "phidgets_api/analog_output.hpp"
+#include "phidgets_api/analog_outputs.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+AnalogOutputs::AnalogOutputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetVoltageOutputHandle ao_handle;
+
+ ret = PhidgetVoltageOutput_create(&ao_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create AnalogOutput handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(ao_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_VOLTAGEOUTPUT,
+ &output_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get AnalogOutput device channel count",
+ ret);
+ }
+
+ aos_.resize(output_count_);
+ for (uint32_t i = 0; i < output_count_; ++i)
+ {
+ aos_[i] = std::make_unique(serial_number, hub_port,
+ is_hub_port_device, i);
+ }
+}
+
+AnalogOutputs::~AnalogOutputs()
+{
+}
+
+uint32_t AnalogOutputs::getOutputCount() const noexcept
+{
+ return output_count_;
+}
+
+void AnalogOutputs::setOutputVoltage(int index, double voltage) const
+{
+ aos_.at(index)->setOutputVoltage(voltage);
+}
+
+void AnalogOutputs::setEnabledOutput(int index, int enabled) const
+{
+ aos_.at(index)->setEnabledOutput(enabled);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_input.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_input.cpp
new file mode 100644
index 0000000..323cde3
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_input.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/digital_input.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+DigitalInput::DigitalInput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel,
+ std::function input_handler)
+ : serial_number_(serial_number),
+ channel_(channel),
+ input_handler_(input_handler)
+{
+ PhidgetReturnCode ret = PhidgetDigitalInput_create(&di_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create DigitalInput handle for channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(di_handle_),
+ serial_number, hub_port, is_hub_port_device,
+ channel);
+
+ ret = PhidgetDigitalInput_setOnStateChangeHandler(di_handle_,
+ StateChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set change handler for DigitalInput channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(di_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get serial number for digital input channel " +
+ std::to_string(channel),
+ ret);
+ }
+ }
+}
+
+DigitalInput::~DigitalInput()
+{
+ PhidgetHandle handle = reinterpret_cast(di_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t DigitalInput::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+bool DigitalInput::getInputValue() const
+{
+ int state;
+ PhidgetReturnCode ret = PhidgetDigitalInput_getState(di_handle_, &state);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get digital input state", ret);
+ }
+
+ return !!state;
+}
+
+void DigitalInput::stateChangeHandler(int state) const
+{
+ input_handler_(channel_, state);
+}
+
+void DigitalInput::StateChangeHandler(
+ PhidgetDigitalInputHandle /* input_handle */, void *ctx, int state)
+{
+ (reinterpret_cast(ctx))->stateChangeHandler(state);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_inputs.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_inputs.cpp
new file mode 100644
index 0000000..fd404aa
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_inputs.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/digital_input.hpp"
+#include "phidgets_api/digital_inputs.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+DigitalInputs::DigitalInputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function input_handler)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetDigitalInputHandle di_handle;
+
+ ret = PhidgetDigitalInput_create(&di_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create DigitalInput handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(di_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_DIGITALINPUT,
+ &input_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get DigitalInput device channel count",
+ ret);
+ }
+
+ dis_.resize(input_count_);
+ for (uint32_t i = 0; i < input_count_; ++i)
+ {
+ dis_[i] = std::make_unique(
+ serial_number, hub_port, is_hub_port_device, i, input_handler);
+ }
+}
+
+int32_t DigitalInputs::getSerialNumber() const noexcept
+{
+ return dis_.at(0)->getSerialNumber();
+}
+
+uint32_t DigitalInputs::getInputCount() const noexcept
+{
+ return input_count_;
+}
+
+bool DigitalInputs::getInputValue(int index) const
+{
+ return dis_.at(index)->getInputValue();
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_output.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_output.cpp
new file mode 100644
index 0000000..48daf40
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_output.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/digital_output.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+DigitalOutput::DigitalOutput(int32_t serial_number, int hub_port,
+ bool is_hub_port_device, int channel)
+ : serial_number_(serial_number)
+{
+ PhidgetReturnCode ret;
+
+ ret = PhidgetDigitalOutput_create(&do_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create DigitalOutput handle for channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(do_handle_),
+ serial_number, hub_port, is_hub_port_device,
+ channel);
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(do_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get serial number for digital output channel " +
+ std::to_string(channel),
+ ret);
+ }
+ }
+}
+
+DigitalOutput::~DigitalOutput()
+{
+ PhidgetHandle handle = reinterpret_cast(do_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t DigitalOutput::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void DigitalOutput::setOutputState(bool state) const
+{
+ PhidgetReturnCode ret = PhidgetDigitalOutput_setState(do_handle_, state);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set state for DigitalOutput", ret);
+ }
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_outputs.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_outputs.cpp
new file mode 100644
index 0000000..5f96ebd
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/digital_outputs.cpp
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/digital_output.hpp"
+#include "phidgets_api/digital_outputs.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+DigitalOutputs::DigitalOutputs(int32_t serial_number, int hub_port,
+ bool is_hub_port_device)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetDigitalOutputHandle do_handle;
+
+ ret = PhidgetDigitalOutput_create(&do_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create DigitalOutput handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(do_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_DIGITALOUTPUT,
+ &output_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get DigitalOutput device channel count",
+ ret);
+ }
+
+ dos_.resize(output_count_);
+ for (uint32_t i = 0; i < output_count_; ++i)
+ {
+ dos_[i] = std::make_unique(serial_number, hub_port,
+ is_hub_port_device, i);
+ }
+}
+
+int32_t DigitalOutputs::getSerialNumber() const noexcept
+{
+ return dos_.at(0)->getSerialNumber();
+}
+
+uint32_t DigitalOutputs::getOutputCount() const noexcept
+{
+ return output_count_;
+}
+
+void DigitalOutputs::setOutputState(int index, bool state) const
+{
+ dos_.at(index)->setOutputState(state);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoder.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoder.cpp
new file mode 100644
index 0000000..31731a5
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoder.cpp
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+
+#include
+
+#include "phidgets_api/encoder.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Encoder::Encoder(
+ int32_t serial_number, int hub_port, bool is_hub_port_device, int channel,
+ std::function position_change_handler)
+ : serial_number_(serial_number),
+ channel_(channel),
+ position_change_handler_(position_change_handler)
+{
+ // create the handle
+ PhidgetReturnCode ret = PhidgetEncoder_create(&encoder_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Encoder handle", ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(encoder_handle_), serial_number,
+ hub_port, is_hub_port_device, channel);
+
+ ret = PhidgetEncoder_setOnPositionChangeHandler(
+ encoder_handle_, PositionChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set change handler for Encoder channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(encoder_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get serial number for encoder channel " +
+ std::to_string(channel),
+ ret);
+ }
+ }
+}
+
+Encoder::~Encoder()
+{
+ PhidgetHandle handle = reinterpret_cast(encoder_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Encoder::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+int64_t Encoder::getPosition() const
+{
+ int64_t position;
+ PhidgetReturnCode ret =
+ PhidgetEncoder_getPosition(encoder_handle_, &position);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get position for Encoder channel " +
+ std::to_string(channel_),
+ ret);
+ }
+
+ return position;
+}
+
+void Encoder::setPosition(int64_t position) const
+{
+ PhidgetReturnCode ret =
+ PhidgetEncoder_setPosition(encoder_handle_, position);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set position for Encoder channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+int64_t Encoder::getIndexPosition() const
+{
+ int64_t position;
+ PhidgetReturnCode ret =
+ PhidgetEncoder_getIndexPosition(encoder_handle_, &position);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get index position for Encoder channel " +
+ std::to_string(channel_),
+ ret);
+ }
+
+ return position;
+}
+
+bool Encoder::getEnabled() const
+{
+ int enabled;
+ PhidgetReturnCode ret =
+ PhidgetEncoder_getEnabled(encoder_handle_, &enabled);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get enabled for Encoder channel " +
+ std::to_string(channel_),
+ ret);
+ }
+
+ return enabled == PTRUE;
+}
+
+void Encoder::setEnabled(bool enabled) const
+{
+ PhidgetReturnCode ret =
+ PhidgetEncoder_setEnabled(encoder_handle_, enabled ? PTRUE : PFALSE);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set enabled for Encoder channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+void Encoder::positionChangeHandler(int position_change, double time,
+ int index_triggered)
+{
+ position_change_handler_(channel_, position_change, time, index_triggered);
+}
+
+void Encoder::PositionChangeHandler(PhidgetEncoderHandle /* phid */, void *ctx,
+ int position_change, double time,
+ int index_triggered)
+{
+ (reinterpret_cast(ctx))
+ ->positionChangeHandler(position_change, time, index_triggered);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoders.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoders.cpp
new file mode 100644
index 0000000..548c472
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/encoders.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+
+#include "phidgets_api/encoder.hpp"
+#include "phidgets_api/encoders.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Encoders::Encoders(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function position_change_handler)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetEncoderHandle enc_handle;
+
+ ret = PhidgetEncoder_create(&enc_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create Encoder handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(enc_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_ENCODER,
+ &encoder_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get Encoder device channel count", ret);
+ }
+
+ encs_.resize(encoder_count_);
+ for (uint32_t i = 0; i < encoder_count_; ++i)
+ {
+ encs_[i] = std::make_unique(serial_number, hub_port,
+ is_hub_port_device, i,
+ position_change_handler);
+ }
+}
+
+int32_t Encoders::getSerialNumber() const noexcept
+{
+ return encs_.at(0)->getSerialNumber();
+}
+
+uint32_t Encoders::getEncoderCount() const
+{
+ return encoder_count_;
+}
+
+int64_t Encoders::getPosition(int index) const
+{
+ return encs_.at(index)->getPosition();
+}
+
+void Encoders::setPosition(int index, int64_t position) const
+{
+ return encs_.at(index)->setPosition(position);
+}
+
+int64_t Encoders::getIndexPosition(int index) const
+{
+ return encs_.at(index)->getIndexPosition();
+}
+
+bool Encoders::getEnabled(int index) const
+{
+ return encs_.at(index)->getEnabled();
+}
+
+void Encoders::setEnabled(int index, bool enabled) const
+{
+ return encs_.at(index)->setEnabled(enabled);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/gyroscope.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/gyroscope.cpp
new file mode 100644
index 0000000..5fca8a9
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/gyroscope.cpp
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "phidgets_api/gyroscope.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Gyroscope::Gyroscope(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function data_handler)
+ : serial_number_(serial_number), data_handler_(data_handler)
+{
+ PhidgetReturnCode ret = PhidgetGyroscope_create(&gyro_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Gyroscope handle", ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(gyro_handle_), serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = PhidgetGyroscope_setOnAngularRateUpdateHandler(gyro_handle_,
+ DataHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set Gyroscope update handler", ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(gyro_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for gyroscope",
+ ret);
+ }
+ }
+}
+
+Gyroscope::~Gyroscope()
+{
+ PhidgetHandle handle = reinterpret_cast(gyro_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Gyroscope::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void Gyroscope::zero() const
+{
+ PhidgetReturnCode ret = PhidgetGyroscope_zero(gyro_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to calibrate Gyroscope", ret);
+ }
+}
+
+void Gyroscope::getAngularRate(double &x, double &y, double &z,
+ double ×tamp) const
+{
+ double angular_rate[3];
+ PhidgetReturnCode ret =
+ PhidgetGyroscope_getAngularRate(gyro_handle_, &angular_rate);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get angular rate from gyroscope", ret);
+ }
+
+ x = angular_rate[0];
+ y = angular_rate[1];
+ z = angular_rate[2];
+
+ double ts;
+ ret = PhidgetGyroscope_getTimestamp(gyro_handle_, &ts);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get timestamp from gyroscope", ret);
+ }
+
+ timestamp = ts;
+}
+
+void Gyroscope::setDataInterval(uint32_t interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetGyroscope_setDataInterval(gyro_handle_, interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval", ret);
+ }
+}
+
+void Gyroscope::dataHandler(const double angular_rate[3],
+ double timestamp) const
+{
+ data_handler_(angular_rate, timestamp);
+}
+
+void Gyroscope::DataHandler(PhidgetGyroscopeHandle /* input_handle */,
+ void *ctx, const double angular_rate[3],
+ double timestamp)
+{
+ (reinterpret_cast(ctx))->dataHandler(angular_rate, timestamp);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/ir.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/ir.cpp
new file mode 100644
index 0000000..f80c0f3
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/ir.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+
+#include
+
+#include "phidgets_api/ir.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+IR::IR(int32_t serial_number,
+ std::function code_handler)
+ : serial_number_(serial_number), code_handler_(code_handler)
+{
+ // create the handle
+ PhidgetReturnCode ret = PhidgetIR_create(&ir_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create IR handle", ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(ir_handle_),
+ serial_number, 0, false, 0);
+
+ // register ir data callback
+ ret = PhidgetIR_setOnCodeHandler(ir_handle_, CodeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set code handler for ir", ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(ir_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for IR", ret);
+ }
+ }
+}
+
+IR::~IR()
+{
+ PhidgetHandle handle = reinterpret_cast(ir_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t IR::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void IR::codeHandler(const char *code, uint32_t bit_count, int is_repeat) const
+{
+ code_handler_(code, bit_count, is_repeat);
+}
+
+void IR::CodeHandler(PhidgetIRHandle /* ir */, void *ctx, const char *code,
+ uint32_t bit_count, int is_repeat)
+{
+ (reinterpret_cast(ctx))->codeHandler(code, bit_count, is_repeat);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/magnetometer.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/magnetometer.cpp
new file mode 100644
index 0000000..69fcb89
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/magnetometer.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "phidgets_api/magnetometer.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Magnetometer::Magnetometer(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function data_handler)
+ : serial_number_(serial_number), data_handler_(data_handler)
+{
+ PhidgetReturnCode ret = PhidgetMagnetometer_create(&mag_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Magnetometer handle", ret);
+ }
+
+ helpers::openWaitForAttachment(reinterpret_cast(mag_handle_),
+ serial_number, hub_port, is_hub_port_device,
+ 0);
+
+ ret = PhidgetMagnetometer_setOnMagneticFieldChangeHandler(
+ mag_handle_, DataHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set change handler for Magnetometer",
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(mag_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for magnetometer",
+ ret);
+ }
+ }
+}
+
+Magnetometer::~Magnetometer()
+{
+ PhidgetHandle handle = reinterpret_cast(mag_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Magnetometer::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void Magnetometer::setCompassCorrectionParameters(
+ double cc_mag_field, double cc_offset0, double cc_offset1,
+ double cc_offset2, double cc_gain0, double cc_gain1, double cc_gain2,
+ double cc_T0, double cc_T1, double cc_T2, double cc_T3, double cc_T4,
+ double cc_T5)
+{
+ PhidgetReturnCode ret = PhidgetMagnetometer_setCorrectionParameters(
+ mag_handle_, cc_mag_field, cc_offset0, cc_offset1, cc_offset2, cc_gain0,
+ cc_gain1, cc_gain2, cc_T0, cc_T1, cc_T2, cc_T3, cc_T4, cc_T5);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set magnetometer correction parameters",
+ ret);
+ }
+}
+
+void Magnetometer::getMagneticField(double &x, double &y, double &z,
+ double ×tamp) const
+{
+ double mag_field[3];
+ PhidgetReturnCode ret =
+ PhidgetMagnetometer_getMagneticField(mag_handle_, &mag_field);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get magnetic field", ret);
+ }
+
+ x = mag_field[0];
+ y = mag_field[1];
+ z = mag_field[2];
+
+ double ts;
+ ret = PhidgetMagnetometer_getTimestamp(mag_handle_, &ts);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get magnetic field timestamp", ret);
+ }
+
+ timestamp = ts;
+}
+
+void Magnetometer::setDataInterval(uint32_t interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetMagnetometer_setDataInterval(mag_handle_, interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval", ret);
+ }
+}
+
+void Magnetometer::dataHandler(const double magnetic_field[3],
+ double timestamp) const
+{
+ data_handler_(magnetic_field, timestamp);
+}
+
+void Magnetometer::DataHandler(PhidgetMagnetometerHandle /* input_handle */,
+ void *ctx, const double magnetic_field[3],
+ double timestamp)
+{
+ (reinterpret_cast(ctx))
+ ->dataHandler(magnetic_field, timestamp);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/motor.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/motor.cpp
new file mode 100644
index 0000000..3b14270
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/motor.cpp
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/motor.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Motor::Motor(int32_t serial_number, int hub_port, bool is_hub_port_device,
+ int channel,
+ std::function duty_cycle_change_handler,
+ std::function back_emf_change_handler)
+ : serial_number_(serial_number),
+ channel_(channel),
+ duty_cycle_change_handler_(duty_cycle_change_handler),
+ back_emf_change_handler_(back_emf_change_handler)
+{
+ PhidgetReturnCode ret = PhidgetDCMotor_create(&motor_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Motor handle for channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(motor_handle_), serial_number, hub_port,
+ is_hub_port_device, channel);
+
+ ret = PhidgetDCMotor_setOnVelocityUpdateHandler(
+ motor_handle_, DutyCycleChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set duty cycle update handler for Motor channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ back_emf_sensing_supported_ = true;
+ ret = PhidgetDCMotor_setBackEMFSensingState(motor_handle_, 1);
+ if (ret == EPHIDGET_UNSUPPORTED)
+ {
+ back_emf_sensing_supported_ = false;
+ } else if (ret == EPHIDGET_OK)
+ {
+ ret = PhidgetDCMotor_setOnBackEMFChangeHandler(
+ motor_handle_, BackEMFChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set back EMF update handler for Motor channel " +
+ std::to_string(channel),
+ ret);
+ }
+ } else
+ {
+ throw Phidget22Error(
+ "Failed to set back EMF sensing state Motor channel " +
+ std::to_string(channel),
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(motor_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get serial number for motor channel " +
+ std::to_string(channel),
+ ret);
+ }
+ }
+}
+
+Motor::~Motor()
+{
+ PhidgetHandle handle = reinterpret_cast(motor_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Motor::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+double Motor::getDutyCycle() const
+{
+ double duty_cycle;
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_getVelocity(motor_handle_, &duty_cycle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get duty cycle for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+ return duty_cycle;
+}
+
+void Motor::setDutyCycle(double duty_cycle) const
+{
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_setTargetVelocity(motor_handle_, duty_cycle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set duty cycle for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+double Motor::getAcceleration() const
+{
+ double accel;
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_getAcceleration(motor_handle_, &accel);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get acceleration for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+ return accel;
+}
+
+void Motor::setAcceleration(double acceleration) const
+{
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_setAcceleration(motor_handle_, acceleration);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set acceleration for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+bool Motor::backEMFSensingSupported() const
+{
+ return back_emf_sensing_supported_;
+}
+
+double Motor::getBackEMF() const
+{
+ if (!back_emf_sensing_supported_)
+ {
+ throw Phidget22Error("Back EMF sensing not supported",
+ EPHIDGET_UNSUPPORTED);
+ }
+ double backemf;
+ PhidgetReturnCode ret = PhidgetDCMotor_getBackEMF(motor_handle_, &backemf);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get back EMF for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+ return backemf;
+}
+
+void Motor::setDataInterval(uint32_t data_interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_setDataInterval(motor_handle_, data_interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+double Motor::getBraking() const
+{
+ double braking;
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_getBrakingStrength(motor_handle_, &braking);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to get braking strength for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+ return braking;
+}
+
+void Motor::setBraking(double braking) const
+{
+ PhidgetReturnCode ret =
+ PhidgetDCMotor_setTargetBrakingStrength(motor_handle_, braking);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to set braking strength for Motor channel " +
+ std::to_string(channel_),
+ ret);
+ }
+}
+
+void Motor::dutyCycleChangeHandler(double duty_cycle) const
+{
+ duty_cycle_change_handler_(channel_, duty_cycle);
+}
+
+void Motor::backEMFChangeHandler(double back_emf) const
+{
+ back_emf_change_handler_(channel_, back_emf);
+}
+
+void Motor::DutyCycleChangeHandler(PhidgetDCMotorHandle /* motor_handle */,
+ void *ctx, double duty_cycle)
+{
+ (reinterpret_cast(ctx))->dutyCycleChangeHandler(duty_cycle);
+}
+
+void Motor::BackEMFChangeHandler(PhidgetDCMotorHandle /* motor_handle */,
+ void *ctx, double back_emf)
+{
+ (reinterpret_cast(ctx))->backEMFChangeHandler(back_emf);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/motors.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/motors.cpp
new file mode 100644
index 0000000..4cfe6ad
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/motors.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/motors.hpp"
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Motors::Motors(int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function duty_cycle_change_handler,
+ std::function back_emf_change_handler)
+{
+ PhidgetReturnCode ret;
+
+ PhidgetDCMotorHandle motor_handle;
+
+ ret = PhidgetDCMotor_create(&motor_handle);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error(
+ "Failed to create Motor handle for determining channel "
+ "count",
+ ret);
+ }
+
+ PhidgetHandle handle = reinterpret_cast(motor_handle);
+
+ helpers::openWaitForAttachment(handle, serial_number, hub_port,
+ is_hub_port_device, 0);
+
+ ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_DCMOTOR,
+ &motor_count_);
+
+ helpers::closeAndDelete(&handle);
+
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get Motor device channel count", ret);
+ }
+
+ motors_.resize(motor_count_);
+ for (uint32_t i = 0; i < motor_count_; ++i)
+ {
+ motors_[i] = std::make_unique(
+ serial_number, hub_port, is_hub_port_device, i,
+ duty_cycle_change_handler, back_emf_change_handler);
+ }
+}
+
+int32_t Motors::getSerialNumber() const noexcept
+{
+ return motors_.at(0)->getSerialNumber();
+}
+
+uint32_t Motors::getMotorCount() const noexcept
+{
+ return motor_count_;
+}
+
+double Motors::getDutyCycle(int index) const
+{
+ return motors_.at(index)->getDutyCycle();
+}
+
+void Motors::setDutyCycle(int index, double duty_cycle) const
+{
+ motors_.at(index)->setDutyCycle(duty_cycle);
+}
+
+double Motors::getAcceleration(int index) const
+{
+ return motors_.at(index)->getAcceleration();
+}
+
+void Motors::setAcceleration(int index, double acceleration) const
+{
+ motors_.at(index)->setAcceleration(acceleration);
+}
+
+bool Motors::backEMFSensingSupported(int index) const
+{
+ return motors_.at(index)->backEMFSensingSupported();
+}
+
+double Motors::getBackEMF(int index) const
+{
+ return motors_.at(index)->getBackEMF();
+}
+
+void Motors::setDataInterval(int index, uint32_t data_interval_ms) const
+{
+ motors_.at(index)->setDataInterval(data_interval_ms);
+}
+
+double Motors::getBraking(int index) const
+{
+ return motors_.at(index)->getBraking();
+}
+
+void Motors::setBraking(int index, double braking) const
+{
+ motors_.at(index)->setBraking(braking);
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/phidget22.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/phidget22.cpp
new file mode 100644
index 0000000..243dc02
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/phidget22.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+
+namespace phidgets {
+
+Phidget22Error::Phidget22Error(const std::string &msg, PhidgetReturnCode code)
+{
+ const char *error_ptr;
+ PhidgetReturnCode ret = Phidget_getErrorDescription(code, &error_ptr);
+ if (ret == EPHIDGET_OK)
+ {
+ msg_ = msg + ": " + std::string(error_ptr);
+ } else
+ {
+ msg_ = msg + ": Unknown error";
+ }
+}
+
+const char *Phidget22Error::what() const noexcept
+{
+ return msg_.c_str();
+}
+
+namespace helpers {
+
+void openWaitForAttachment(PhidgetHandle handle, int32_t serial_number,
+ int hub_port, bool is_hub_port_device, int channel)
+{
+ PhidgetReturnCode ret;
+
+ ret = Phidget_setDeviceSerialNumber(handle, serial_number);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set device serial number", ret);
+ }
+
+ ret = Phidget_setHubPort(handle, hub_port);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set device hub port", ret);
+ }
+
+ ret = Phidget_setIsHubPortDevice(handle, is_hub_port_device);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set device is hub port device", ret);
+ }
+
+ ret = Phidget_setChannel(handle, channel);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set device channel", ret);
+ }
+
+ ret = Phidget_openWaitForAttachment(handle, PHIDGET_TIMEOUT_DEFAULT);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to open device", ret);
+ }
+}
+
+void closeAndDelete(PhidgetHandle *handle) noexcept
+{
+ Phidget_close(*handle);
+ Phidget_delete(handle);
+}
+
+} // namespace helpers
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/spatial.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/spatial.cpp
new file mode 100644
index 0000000..a0738d6
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/spatial.cpp
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+#include "phidgets_api/spatial.hpp"
+
+namespace phidgets {
+
+Spatial::Spatial(
+ int32_t serial_number, int hub_port, bool is_hub_port_device,
+ std::function
+ data_handler,
+ std::function algorithm_data_handler,
+ std::function attach_handler, std::function detach_handler)
+ : serial_number_(serial_number),
+ data_handler_(std::move(data_handler)),
+ algorithm_data_handler_(std::move(algorithm_data_handler)),
+ attach_handler_(std::move(attach_handler)),
+ detach_handler_(std::move(detach_handler))
+{
+ PhidgetReturnCode ret = PhidgetSpatial_create(&spatial_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create Spatial handle", ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(spatial_handle_), serial_number,
+ hub_port, is_hub_port_device, 0);
+
+ ret = PhidgetSpatial_setOnSpatialDataHandler(spatial_handle_, DataHandler,
+ this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set change handler for Spatial", ret);
+ }
+
+ if (algorithm_data_handler_ != nullptr)
+ {
+ ret = PhidgetSpatial_setOnAlgorithmDataHandler(
+ spatial_handle_, AlgorithmDataHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set algorithm handler for Spatial",
+ ret);
+ }
+ }
+
+ if (attach_handler_ != nullptr)
+ {
+ ret = Phidget_setOnAttachHandler(
+ reinterpret_cast(spatial_handle_), AttachHandler,
+ this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set attach handler for Spatial",
+ ret);
+ }
+ }
+
+ if (detach_handler_ != nullptr)
+ {
+ ret = Phidget_setOnDetachHandler(
+ reinterpret_cast(spatial_handle_), DetachHandler,
+ this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set detach handler for Spatial",
+ ret);
+ }
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(spatial_handle_), &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for spatial",
+ ret);
+ }
+ }
+}
+
+Spatial::~Spatial()
+{
+ auto handle = reinterpret_cast(spatial_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Spatial::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void Spatial::zero() const
+{
+ PhidgetReturnCode ret = PhidgetSpatial_zeroGyro(spatial_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to calibrate Gyroscope", ret);
+ }
+}
+
+void Spatial::setCompassCorrectionParameters(
+ double cc_mag_field, double cc_offset0, double cc_offset1,
+ double cc_offset2, double cc_gain0, double cc_gain1, double cc_gain2,
+ double cc_T0, double cc_T1, double cc_T2, double cc_T3, double cc_T4,
+ double cc_T5)
+{
+ PhidgetReturnCode ret = PhidgetSpatial_setMagnetometerCorrectionParameters(
+ spatial_handle_, cc_mag_field, cc_offset0, cc_offset1, cc_offset2,
+ cc_gain0, cc_gain1, cc_gain2, cc_T0, cc_T1, cc_T2, cc_T3, cc_T4, cc_T5);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set magnetometer correction parameters",
+ ret);
+ }
+}
+
+void Spatial::setSpatialAlgorithm(const std::string algorithm_name)
+{
+ Phidget_SpatialAlgorithm algorithm;
+
+ if (algorithm_name.compare("none") == 0)
+ {
+ algorithm = SPATIAL_ALGORITHM_NONE;
+ } else if (algorithm_name.compare("ahrs") == 0)
+ {
+ algorithm = SPATIAL_ALGORITHM_AHRS;
+ } else if (algorithm_name.compare("imu") == 0)
+ {
+ algorithm = SPATIAL_ALGORITHM_IMU;
+ } else
+ {
+ throw std::invalid_argument("Unknown spatial algorithm name");
+ }
+
+ PhidgetReturnCode ret =
+ PhidgetSpatial_setAlgorithm(spatial_handle_, algorithm);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set spatial algorithm", ret);
+ }
+}
+
+void Spatial::setAHRSParameters(double angularVelocityThreshold,
+ double angularVelocityDeltaThreshold,
+ double accelerationThreshold, double magTime,
+ double accelTime, double biasTime)
+{
+ PhidgetReturnCode ret = PhidgetSpatial_setAHRSParameters(
+ spatial_handle_, angularVelocityThreshold,
+ angularVelocityDeltaThreshold, accelerationThreshold, magTime,
+ accelTime, biasTime);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set AHRS parameters", ret);
+ }
+}
+
+void Spatial::setAlgorithmMagnetometerGain(double magnetometer_gain)
+{
+ PhidgetReturnCode ret = PhidgetSpatial_setAlgorithmMagnetometerGain(
+ spatial_handle_, magnetometer_gain);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set algorithm magnetometer gain", ret);
+ }
+}
+
+void Spatial::setHeatingEnabled(bool heating_enabled)
+{
+ PhidgetReturnCode ret =
+ PhidgetSpatial_setHeatingEnabled(spatial_handle_, heating_enabled);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set heating flag", ret);
+ }
+}
+
+void Spatial::setDataInterval(uint32_t interval_ms) const
+{
+ PhidgetReturnCode ret =
+ PhidgetSpatial_setDataInterval(spatial_handle_, interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval", ret);
+ }
+}
+
+void Spatial::dataHandler(const double acceleration[3],
+ const double angular_rate[3],
+ const double magnetic_field[3],
+ double timestamp) const
+{
+ data_handler_(acceleration, angular_rate, magnetic_field, timestamp);
+}
+
+void Spatial::algorithmDataHandler(const double quaternion[4],
+ double timestamp) const
+{
+ algorithm_data_handler_(quaternion, timestamp);
+}
+
+void Spatial::attachHandler()
+{
+ attach_handler_();
+}
+
+void Spatial::detachHandler()
+{
+ detach_handler_();
+}
+
+void Spatial::DataHandler(PhidgetSpatialHandle /* input_handle */, void *ctx,
+ const double acceleration[3],
+ const double angular_rate[3],
+ const double magnetic_field[3], double timestamp)
+{
+ (reinterpret_cast(ctx))
+ ->dataHandler(acceleration, angular_rate, magnetic_field, timestamp);
+}
+
+void Spatial::AlgorithmDataHandler(PhidgetSpatialHandle /* input_handle */,
+ void *ctx, const double quaternion[4],
+ double timestamp)
+{
+ ((Spatial *)ctx)->algorithmDataHandler(quaternion, timestamp);
+}
+
+void Spatial::AttachHandler(PhidgetHandle /* input_handle */, void *ctx)
+{
+ ((Spatial *)ctx)->attachHandler();
+}
+
+void Spatial::DetachHandler(PhidgetHandle /* input_handle */, void *ctx)
+{
+ ((Spatial *)ctx)->detachHandler();
+}
+
+} // namespace phidgets
diff --git a/docker/local-ros2/phidgets_drivers/phidgets_api/src/temperature.cpp b/docker/local-ros2/phidgets_drivers/phidgets_api/src/temperature.cpp
new file mode 100644
index 0000000..98a69d1
--- /dev/null
+++ b/docker/local-ros2/phidgets_drivers/phidgets_api/src/temperature.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019, Open Source Robotics Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include
+#include
+
+#include
+
+#include "phidgets_api/phidget22.hpp"
+#include "phidgets_api/temperature.hpp"
+
+namespace phidgets {
+
+Temperature::Temperature(int32_t serial_number, int hub_port,
+ bool is_hub_port_device,
+ std::function temperature_handler)
+ : serial_number_(serial_number), temperature_handler_(temperature_handler)
+{
+ PhidgetReturnCode ret =
+ PhidgetTemperatureSensor_create(&temperature_handle_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to create TemperatureSensor handle", ret);
+ }
+
+ helpers::openWaitForAttachment(
+ reinterpret_cast(temperature_handle_), serial_number,
+ hub_port, is_hub_port_device, 0);
+
+ ret = PhidgetTemperatureSensor_setOnTemperatureChangeHandler(
+ temperature_handle_, TemperatureChangeHandler, this);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set change handler for Temperature",
+ ret);
+ }
+
+ if (serial_number_ == -1)
+ {
+ ret = Phidget_getDeviceSerialNumber(
+ reinterpret_cast(temperature_handle_),
+ &serial_number_);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get serial number for temperature",
+ ret);
+ }
+ }
+}
+
+Temperature::~Temperature()
+{
+ PhidgetHandle handle = reinterpret_cast(temperature_handle_);
+ helpers::closeAndDelete(&handle);
+}
+
+int32_t Temperature::getSerialNumber() const noexcept
+{
+ return serial_number_;
+}
+
+void Temperature::setThermocoupleType(ThermocoupleType type)
+{
+ PhidgetReturnCode ret = PhidgetTemperatureSensor_setThermocoupleType(
+ temperature_handle_,
+ static_cast(type));
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set Temperature thermocouple type",
+ ret);
+ }
+}
+
+double Temperature::getTemperature() const
+{
+ double current_temperature;
+ PhidgetReturnCode ret = PhidgetTemperatureSensor_getTemperature(
+ temperature_handle_, ¤t_temperature);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to get temperature", ret);
+ }
+ return current_temperature;
+}
+
+void Temperature::setDataInterval(uint32_t interval_ms) const
+{
+ PhidgetReturnCode ret = PhidgetTemperatureSensor_setDataInterval(
+ temperature_handle_, interval_ms);
+ if (ret != EPHIDGET_OK)
+ {
+ throw Phidget22Error("Failed to set data interval", ret);
+ }
+}
+
+void Temperature::temperatureChangeHandler(double temperature) const
+{
+ temperature_handler_(temperature);
+}
+
+void Temperature::TemperatureChangeHandler(
+ PhidgetTemperatureSensorHandle /* temperature_handle */, void *ctx,
+ double temperature)
+{
+ (reinterpret_cast