Remote Control iRobot Create 2 with PS4 Controller via ROS 2

Seriously though, who doesn’t want to be able to control an iRobot Create 2 robot with a PS4 controller? ‘nough said…let’s dive right in!


While the title is a bit of a spoiler, our objective in a nutshell is as follows:
User may navigate an iRobot Create 2 in both linear and angular motions using a PS4 controller.

To make this a little more interesting, we’ll aim for these objectives:

  • PS4 controller will be connected to a “server” machine, physically separate from the Create
  • ROS 2 server will receive and translate PS4 messages into cmd_vel messages for commanding the Create robot platform
  • Raspberry Pi “client”, mounted on the Create (or sitting on it for those in a hurry), also with ROS 2, will listen for cmd_vel messages and relay the commands to the Create platform
  • Write zero lines of custom code, using freely available ROS packages


For this robotic adventure, we’ll be using the following materials:

Software Setup

The software setup is surely the most time consuming part of this demo.

Server Machine

“Machine” here is a grandiose word for laptop; don’t worry, there won’t be any mainframe Cobol involved here.

  1. Setup ROS 2 (Galactic) on the server
    • If you have a Windows machine, install Oracle VirtualBox with Ubuntu as a base OS
  2. Install the ROS 2 package joystick_driver into your dev workspace
    The purpose of this package is to interpret signals from the PS4 controller and publish sensor_msgs/msg/Joy messages.
    You can find a ROS 2 Galactic-compatible version of this package at (go Oregon State Beavers!).
    Docs for this package available at .
  3. Install the ROS 2 package teleop_twist_joy into your dev workspace
    The purpose of this package is to translate the sensor_msgs/msg/Joy messages into cmd_vel messages that our Create package will be looking for. (Eegats…dangling participle!)
    Again, head over to Oregon State’s repository for a Galactic-compatible version.
    Docs for this package available at .

Raspberry Pi Client

There are often trials and tribulations involved with setting up ROS 2 on Raspberry Pi. This post is gonna skip all that and go right for an image which has Foxy pre-installed, which’ll work just fine with Galactic messages from the server. (Thank you Viet Anh Nguyen who apparently has more time than me for figuring out how get ROS 2 installed on Raspberry Pi!)

  1. Take a short-cut and load a ROS 2 Foxy image onto your Raspberry Pi 4 via …and spend the rest of the day drinking oat-milk lattes while your associates battle dependency issues. This image includes a pre-installed/setup VNC Server which you can remote desktop onto…thanks again Viet!!
  2. You’ll want to be able to remote desktop onto your Raspberry Pi, from your server machine, without having to plug it into a monitor. To do so, you’ll need to start the VNC Server on boot-up as well as being able to enable desktop mode without a monitor:
    1. To start the VNC server on boot: …after doing so, don’t forget to test out remoting onto it before going on to the next step.
    2. To enable desktop mode without a monitor: . Note that after you take this action, you’ll no longer be able to view the desktop with a monitor. (If you haven’t given the Raspberry Pi a static IP, you can hop onto your local router to find it’s new IP for connecting to its VNC Server.)
  3. Install the ROS 2 package create_robot (and libcreate) from into your dev workspace
    The purpose of this package is to provide a ROS wrapper for the libcreate C++ library for communicating with the iRobot Create platform.

For the hardware setup, the Create serial cable will connect to the Raspberry Pi USB and the Create’s serial port. (I know, shocker.)

Making the Magic Happen

That’s tech speak for “alrighty, let’s make that Create dance!” Well OK then…

  1. From the server:
    1. Plug in PS4 controller via USB cable (it’s easier than dealing with Bluetooth shenanigans)
    2. (Windows-only) Via Oracle VirtualBox, select Devices / USB / Sony Wireless Controller …
      Controller light should turn blue.
    3. Open terminal and CD to your dev workspace (that contains joy and teleop_twist_joy)
    4. Source the workspace with:
      . install/setup.bash
    5. Start the joy node:
      ros2 run joy joy_node
      Should output “Opened joystick: Sony…Wireless Controller”
    6. (optional) Open new terminal to monitor joystick messages:
      ros2 topic echo /joy
      If you press buttons and such on the PS4 controller, you’ll see the the sensor_msgs/msg/Joy messages output. Here’s a handy dandy cheat sheet for the mapping between PS4 buttons and the Joy messages:
    7. Open new terminal, source the workspace, and run the following to convert /joy messages into /cmd_vel messages, mapping the axis values into linear and angular values:
      ros2 run teleop_twist_joy teleop_node --ros-args -p axis_linear.x:=1 -p axis_angular.yaw:=0
      This should output 3 lines reflecting the button mappings. Note the two parameters that we passed in; these tell the telop_node where to fine the linear and angular inputs from the joystick inputs. If you’re using a joystick other than PS4, these parameters will likely be different…you’ve been warned!!
    8. (optional) Open new terminal to monitor /cmd_vel messages:
      ros2 topic echo /cmd_vel
  2. Remote desktop (via VNC Server) onto the Raspberry Pi client and then:
    1. Open terminal and CD to workspace that contains create_robot
    2. Source the workspace with:
      . install/setup.bash
    3. Start the create_robot node:
      ros2 launch create_bringup create_2.launch
      Should output lots of stats and reflect a successful connection.
    4. (optional) Open new terminal to monitor /cmd_vel messages:
      ros2 topic echo /cmd_vel
  3. On the PS4 controller, hold down R1 and move the left lever; cmd_vel messages should appear and the Create should be merrily obey.
  4. Jump up and down and yell “hell yeah!” (using the joyful explicative of your choice)

Billy McCafferty

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these

No Related Post