xiaoqiang tutorial (7) use PS3 joystick to control xiaoqiang

Xiaoqiang Homepage

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 /cmd_vel

Steps:

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 1 in 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

0_1536151769196_7a9f8d9d-8632-4d7b-813f-a5b623bce7bf-image.png

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

0_1536151855253_de821344-dfef-4157-89ef-df27f40e4c2a-image.png

ps3fakexiaoqiang_teleop.launch file 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)

0_1536151920863_b976374a-e6ac-4e68-a87f-84e3da645577-image.png

0_1536151927577_4eaac52b-d22b-4d52-ab64-200b1214d718-image.png

0_1536151934738_9636f660-6794-45b1-b478-088cb0727193-image.png

According to these button numbers, the relevant parameters in the launch file can be modified to change the button mapping relationship

Pattern play:

Purchase ps3 mobile phone holder, Android mobile phone loaded Xiaoqiang picture app, so you can achieve remote control.

0_1536151967744_234a4968-c989-4c67-8e61-14fa28bea68a-image.png

Xiaoqiang Homepage Back To Index

results matching ""

    No results matching ""