xiaoqiang tutorial (7) use PS3 joystick to control xiaoqiang
weijiz last edited by weijiz
use PS3 joystick to control Xiaoqiang
Principle: This tutorial involves 3 packages, ps3joy is responsible for converting ps3 bluetooth accept signals to standard linux devices (/dev/input/js0). The joy_node node is responsible for converting the above joy device data into the joy data type in ros. turtlebot_teleop_joy is responsible for converting the above joy data topic into motion instructions
0. The first time you use the joystick, you need to bind the joystick to the Bluetooth receiver. You can start directly from step 1 if you have bind the device before.
If you bought the joystick and xiaoqiang at the same time, Then we have already bind the device for you.
The binding method refers to
Quick use method step 1in this article
1. Start ps3joy and bind the ps3 joystick to the bluetooth receiver
# Make sure the Bluetooth receiver is plugged into the host usb port sudo bash rosrun ps3joy ps3joyfake_node.py
The following prompts appear normally
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 indicated Press the handle pairing key in the following figure
If the pairing is successful, the upper window will output a result similar to the following
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
2. Start joy_node and turtlebot_teleop_joy
roslaunch turtlebot_teleop ps3fakexiaoqiang_teleop.launch
After the normal start as shown in the figure below
ps3fakexiaoqiang_teleop.launchfile content is as follows
<launch> <node pkg="turtlebot_teleop" type="turtlebot_teleop_joy" name="turtlebot_teleop_joystick"> <param name="scale_angular" value="0.4"/> <param name="scale_linear" value="0.4"/> <param name="axis_deadman" value="10"/> <param name="axis_linear" value="1"/> <param name="axis_angular" value="0"/> <param name="axis_enbar" value="12"/> <param name="axis_disenbar" value="14"/> <remap from="turtlebot_teleop_joystick/cmd_vel" to="/cmd_vel"/> <remap from="turtlebot_teleop_joystick/joy" to="/joy"/> </node> </launch>
The parameters in the above launch file correspond to: Linear speed maximum (scale_linear)、Angular speed maximum (scale_angular)，Throttle key (axis_deadman)、Forward and backward axis (axis_linear)、Left and right shafts (axis_angular)，Platform infrared enable key (axis_enbar)，Platform infrared close button (axis_disenbar).
3. Hold down the handle throttle key (key 10 in the figure below) and now use the left pusher to control the platform’s back and forth movement and steering (-1、+1 rocker in the image below)
According to these button numbers, the relevant parameters in the launch file can be modified to change the button mapping relationship
Purchase ps3 mobile phone holder, Android mobile phone loaded Xiaoqiang picture app, so you can achieve remote control.