<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PS3 joystick ROS driver]]></title><description><![CDATA[<p dir="auto"><a href="http://www.bwbot.org/en/products/xiaoqiang-4-pro" target="_blank" rel="noopener noreferrer">Xiaoqiang Homepage</a></p>
<p dir="auto">The ros driver of the ps3 controller is ps3joy in the joystick_drivers package. This driver supports the original Sony handle, but there is a problem with the support of some others ps3 controllers. We have modified on the basis of ps3joy, added a <code>ps3joyfake_node.py</code> script as a driver for other joysticks, the package source code address is <a href="https://github.com/BlueWhaleRobot/joystick_drivers.git" target="_blank" rel="noopener noreferrer">here</a>. Let’s take Xiaoqiang as an example to demonstrate the installation steps and simple usage of this package.</p>
<h3>installation steps</h3>
<p dir="auto">ssh enters Xiaoqiang ros workspace, compile after downloading the source code. If you have install xiaoqiang system image, you can skip this step.</p>
<pre><code class="language-bash">ssh xiaoqiang@192.168.xxx.xxx
cd Documents/ros/src/
git clone https://github.com/BlueWhaleRobot/joystick_drivers.git
cd ..
catkin_make
If the following error is prompted
error spnav.h no such file
First install the following package, then re-execute catkin_makee
sudo apt-get install libspnav-dev
</code></pre>
<h3>Quick usage</h3>
<p dir="auto">After <code>ps3joyfake_node.py</code> starts, it converts the data of the joystick button received by bluetooth into the standard joy msg, and publishes it in ros with <code>/joy</code> as the topic, that is, a file of <code>ps3joyfake_node.py</code> is equivalent to two files of <code>ps3joy.py + joy_node</code>. It is no longer necessary to open the joy_node node in actual use.</p>
<ol>
<li>
<p dir="auto">Bind the joystick to the usb bluetooth adapter, just bind once, skip this step next time.</p>
<p dir="auto">Connect the joystick to the host through the usb data cable, and plug the USB bluetooth adapter into the host.</p>
<pre><code class="language-bash">sudo bash
rosrun ps3joy sixpair
</code></pre>
<p dir="auto">At this point, you will get an output similar to following. The current and setting mac addresses are the same.</p>
<pre><code class="language-bash">Current Bluetooth master: 00:22:b0:d0:5a:09
Setting master bd_addr to 00:22:b0:d0:5a:09

# If the following error occurs
Current Bluetooth master: 00:1b:dc:00:07:3c
Unable to retrieve local bd_addr from `hcitool dev`.
Please enable Bluetooth or specify an address manually.
# Run
hciconfig hci0 reset
# If you run hciconfig hci0 reset error
# Can't init device hci0: Operation not possible due to  
# Run 
rfkill unblock all 
# and run 
hciconfig hci0 reset
# rerun
rosrun ps3joy sixpair
</code></pre>
<p dir="auto">After the binding setting is completed, disconnect the handle and the usb connection of the host.</p>
<p dir="auto">Ctrl+D exits root mode</p>
</li>
<li>
<p dir="auto">Pair the handle with the usb Bluetooth adapter</p>
<pre><code class="language-bash"># Make sure the Bluetooth receiver is plugged into the host usb port
sudo bash
rosrun ps3joy ps3joyfake_node.py
</code></pre>
<p dir="auto">The following prompt will appear normally.</p>
<pre><code class="language-bash">root@xiaoqiang-desktop:~# rosrun ps3joy ps3joyfake_node.py 
No inactivity timeout was set. (Run with --help for details.)
Waiting for connection. Disconnect your PS3 joystick from USB and press     the pairing button.
If the following error is prompted
ImportError: No module named bluethooth
Please install the following packages first, then re-run
sudo apt-get install libbluetooth-dev
sudo pip install PyBluez
</code></pre>
<p dir="auto">Press the joystick pairing button in the image below</p>
<p dir="auto"><img src="/assets/uploads/files/1537779843283-e2a1873d-f564-4ba1-9d0c-ff7d3574f8e1-image.png" alt="0_1537779842259_e2a1873d-f564-4ba1-9d0c-ff7d3574f8e1-image.png" class=" img-responsive img-markdown" width="477" height="321" /></p>
<p dir="auto">If the pairing is successful, the above window will output a result similar to the following.</p>
<pre><code class="language-bash">root@xiaoqiang-desktop:~# rosrun ps3joy ps3joyfake_node.py 
No inactivity timeout was set. (Run with --help for details.)
Waiting for connection. Disconnect your PS3 joystick from USB and press the pairing button.
Connection activated
</code></pre>
</li>
<li>
<p dir="auto">View handle output</p>
<pre><code class="language-bash"># Open a new window and print the button output
rostopic echo /joy
</code></pre>
<p dir="auto">Normally the following similar results will appear</p>
<pre><code class="language-bash">header: 
  seq: 297
  stamp: 
    secs: 1488877867
    nsecs: 535818099
  frame_id: ''
axes: [0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.21316899359226227, 0.0]
buttons: [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
</code></pre>
<p dir="auto">As we can see that the fourth button was pressed.</p>
</li>
<li>
<p dir="auto">Start the relevant joy msg processing node</p>
<p dir="auto">Be careful not to start the joy_node again.</p>
<pre><code class="language-bash"># Take Xiaoqiang as an example. After launching the following launch file, you can remotely move Xiaoqiang.
roslaunch turtlebot_teleop ps3fakexiaoqiang_teleop.launch
</code></pre>
</li>
</ol>
<p dir="auto">For xiaoqiang user with a joystick you can also use the joystick according to this <a href="https://community.bwbot.org/topic/556" target="_blank" rel="noopener noreferrer">tutorial</a></p>
<p dir="auto">When step 1 is bound, if the prompt cannot find the handle device and cannot be bound, you can perform the following two steps to solve the problem: 1. Click the Bluetooth icon in the upper right corner of the system desktop to close the connected Bluetooth handle service.</p>
<p dir="auto"><img src="/assets/uploads/files/1537789926960-df37f5e8-5c58-469f-9156-408c2d6508d7-image-resized.png" alt="0_1537789925803_df37f5e8-5c58-469f-9156-408c2d6508d7-image.png" class=" img-responsive img-markdown" /></p>
<p dir="auto"><img src="/assets/uploads/files/1537789933094-a7e7225e-ecb2-4b86-9363-2afe70fb0e99-image-resized.png" alt="0_1537789931907_a7e7225e-ecb2-4b86-9363-2afe70fb0e99-image.png" class=" img-responsive img-markdown" /></p>
<p dir="auto"><a href="http://www.bwbot.org/en/products/xiaoqiang-4-pro" target="_blank" rel="noopener noreferrer">Xiaoqiang Homepage</a><br />
<a href="https://community.bwbot.org/topic/617" target="_blank" rel="noopener noreferrer">Back To Index</a></p>
]]></description><link>http://community.bwbot.org/topic/619/ps3-joystick-ros-driver</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 04:37:46 GMT</lastBuildDate><atom:link href="http://community.bwbot.org/topic/619.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 22 Sep 2018 11:34:59 GMT</pubDate><ttl>60</ttl></channel></rss>