From f833cd121445606412bb8a823e9317ea8f3f65eb Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 23 Jul 2021 13:09:08 +0700 Subject: [PATCH] add joytick --- docker-compose.yml | 19 +++++++++++++++++++ joystick/66-joystick.rules | 1 + joystick/Dockerfile | 28 ++++++++++++++++++++++++++++ joystick/holonomic.config.yaml | 15 +++++++++++++++ joystick/start.launch | 29 +++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 joystick/66-joystick.rules create mode 100644 joystick/Dockerfile create mode 100644 joystick/holonomic.config.yaml create mode 100644 joystick/start.launch diff --git a/docker-compose.yml b/docker-compose.yml index 891637e..e36b9dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,3 +32,22 @@ services: #- "11311:11311" - "8558:8558" - "9901:9901" + + joystick: + build: ./joystick + image: wn1980/joystick${TAG} + container_name: ros_joystick + restart: unless-stopped + privileged: true + #command: stdbuf -o L roslaunch --wait start.launch + #command: stdbuf -o L roslaunch --wait turtlebot_lidar_teleop joystick.launch + #command: stdbuf -o L roslaunch --wait teleop_twist_joy teleop.launch + depends_on: + - workspace + devices: + - "/dev/input:/dev/input" + volumes: + - "/dev/input:/dev/input" + - "/etc/localtime:/etc/localtime:ro" + environment: + - "ROS_MASTER_URI=http://workspace:11311" \ No newline at end of file diff --git a/joystick/66-joystick.rules b/joystick/66-joystick.rules new file mode 100644 index 0000000..71a527a --- /dev/null +++ b/joystick/66-joystick.rules @@ -0,0 +1 @@ +ATTRS{idVendor}=="0079", ATTRS{idProduct}=="0126", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="input" SYMLINK+="joystick" diff --git a/joystick/Dockerfile b/joystick/Dockerfile new file mode 100644 index 0000000..cb03ee8 --- /dev/null +++ b/joystick/Dockerfile @@ -0,0 +1,28 @@ +FROM ros:melodic-ros-core + +LABEL maintainer="Waipot Ngamsaad " + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + ros-$ROS_DISTRO-joy \ + ros-$ROS_DISTRO-joystick-drivers \ + ros-$ROS_DISTRO-teleop-twist-joy \ + joystick && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY ./start.launch ./holonomic.config.yaml / + +RUN usermod -aG dialout root && \ + usermod -aG plugdev root && \ + usermod -aG input root + +CMD ["roslaunch", "--wait", "start.launch"] \ No newline at end of file diff --git a/joystick/holonomic.config.yaml b/joystick/holonomic.config.yaml new file mode 100644 index 0000000..fbd9ef1 --- /dev/null +++ b/joystick/holonomic.config.yaml @@ -0,0 +1,15 @@ +axis_linear: + x: 1 + y: 0 +scale_linear: + x: 0.5 + y: 0.5 +scale_linear_turbo: + x: 1.0 + y: 1.0 +axis_angular: + yaw: 3 +scale_angular: + yaw: 1.0 +enable_button: 4 +enable_turbo_button: 5 diff --git a/joystick/start.launch b/joystick/start.launch new file mode 100644 index 0000000..424887c --- /dev/null +++ b/joystick/start.launch @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + +