Using Nintendo Switch Joy Controller on ROS2. In this package, you can manipulate turtlesim.
- CPU: intel core i5 8250U
- OS : Ubuntu 20.04.3LTS
- ROS: ROS2 foxy
# Install the turtlesim package.
$ sudo apt update
$ sudo apt install ros-foxy-turtlesim
# Start turtlesim
$ ros2 run turtlesim turtlesim_node
$ . /opt/ros/foxy/setup.bash
$ mkdir -p ros2_ws/src && cd ros2_ws/src
$ git clone https://github.com/Azicode/joycon_controller.git
$ pip3 install pygame
$ cd ~/ros2_ws
$ rosdep install -i --from-path src --rosdistro foxy -y
$ colcon build --symlink-install
Open a new terminal, and source setup.
$ cd ros2_ws
$ . /opt/ros/foxy/setup.bash
$ . install/setup.bash
Next command will fail, if JoyCon is not connected to PC.
Please connnect by Bluetooth.
Run the joycon_controller Node!
$ ros2 run joycon_controller joycon_controller
When you want to use Joy-Con L or change the orentation,
look at line 16 in joycon_controller.py and edit the value of ROTATON.
11 #-------- Rotation --------#
12 # JoyCon R, Vertical => 0
13 # JoyCon L, Vertical => 1
14 # JoyCon R, Horizontal => 2
15 # JoyCon L, Horizontal => 3
16 ROTATION = 0
- Azi : Japanese student majoring in marine system engineering.
- Twitter : https://twitter.com/Azi_mark01
- Qiita (Japanese) : https://qiita.com/Azi