/joycon_controller

You can play turtlesim with Nintendo Switch Joy Controller.

Primary LanguagePython

joycon_controller

日本語(Qiita)

Introduction

Using Nintendo Switch Joy Controller on ROS2. In this package, you can manipulate turtlesim.

Dependencies

My Environment

  • CPU: intel core i5 8250U
  • OS : Ubuntu 20.04.3LTS
  • ROS: ROS2 foxy

Installation of turtlesim

# Install the turtlesim package.
$ sudo apt update
$ sudo apt install ros-foxy-turtlesim

# Start turtlesim
$ ros2 run turtlesim turtlesim_node

Installation of this package

$ . /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

Demo joycon_controller

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

Change Orientation

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

About writer