Note: This tutorial assumes that you have completed the previous tutorials: Creating a Workspace for Catkin, How to Pair the PS3 Joystick with a Bluetooth Dongle, Configuring A Linux Joystick, Arduino IDE Setup.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Musical Keyboard Operated by PS3 Controller

Description: In this tutorial, you will write a node (python) to control a buzzer via an Arduino using a PS3 controller. You will also write a node on the Arduino to make it play different notes when different keys on the PS3 controller are pressed, effectively making a 'musical keyboard'.

Tutorial Level: INTERMEDIATE

Before starting the tutorial, please take the time to create your ROS workspace using either the catkin or rosbuild method. You will need this workspace to build your package and node later.

Setting up the PS3 Controller

First, follow the instructions at How to Pair the PS3 Joystick with a Bluetooth Dongle to connect your PS3 controller with linux. Once you see the words Connection is Activated. your controller is ready to be used as a Linux-supported joystick.

Once this is done, follow the instructions at Configuring A Linux Joystick to start running 'joy_node'. This node publishes to a topic 'joy' with the message type 'sensor_msgs/Joy'. These messages consist of the int32[] buttons array which shows '1' for buttons that are pressed and '0' for buttons which are not pressed. Do not worry too much about which numbers correspond to which buttons for now.

test test test

   1 #!/usr/bin/env python
   2 import roslib; roslib.load_manifest('beginner_tutorials')
   3 import rospy
   4 from std_msgs.msg import String
   5 test test

Wiki: rosserial_arduino/Tutorials/Musical Keyboard Operated by PS3 Controller (last edited 2015-10-26 03:59:22 by Damian Boh)