在上面几篇已经详细了写到在Ubuntu 16.04 + ros kinetic中的驱动配置以及配置过程中遇到的问题;
废话不多说,在turtlebot_teleop中已有使用手柄的launch文件:
logitech.launch:使用罗技的手柄控制运动
原来的Logitech.launch做了以下修改,最终为:
<?xml version="1.0"?>
<!--
Driver for the logitech rumblepad2 joystick.
Use the D pad while pressing and holding the Right trigger button (5) to control.
-->
<launch>
<!-- smooths inputs from cmd_vel_mux/input/teleop_raw to cmd_vel_mux/input/teleop -->
<include file="$(find turtlebot_teleop)/launch/includes/velocity_smoother.launch.xml"/>
<node pkg="turtlebot_teleop" type="turtlebot_teleop_joy" name="turtlebot_teleop_joystick">
<param name="scale_angular" value="1.5"/>
<param name="scale_linear" value="0.5"/>
<param name="axis_linear" value="0.5"/>
<param name="axis_angular" value="0"/>
<param name="axis_deadman" value="5"/>
<remap from="turtlebot_teleop_joystick/cmd_vel" to="teleop_velocity_smoother/raw_cmd_vel"/>
</node>
<node pkg="joy" type="joy_node" name="joystick">
<param name="dev" type="string" value="/dev/input/js0"/>
<param name="deadzone" value="0.3" />
<param name="autorepeat_rate" value="20" />
</node>
</launch>
其中axis_deadman 实现判断键位功能,使能键设置button:5 也就是RB,在运行过程中,只有在按下这个键时才能通过操作左边摇杆控制turtlebot运动。
启动turtlebot底盘
roslaunch turtlebot_bringup minimal.launch
启动罗技手柄驱动
roslaunch turtlebot_teleop logitech.launch
右手按下RB 左手控制摇杆,turtlebot 就可以走了。