用手柄控制turtlebot运行

来源:互联网 发布:十七冶医院网络办公 编辑:程序博客网 时间:2024/04/28 23:17

在用手柄控制turtlesim运动时,已经讲述过了手柄的配置。

在turtlebot_teleop中已有使用手柄的launch文件,在indigo版本下:

keyboard_teleop.launch:用键盘控制turtlebot运动

logitech.launch:使用罗技的手柄控制运动

xbox360_teleop.launch:应用于xbox360型号的手柄

本人使用的手柄可以使用xbox360的驱动,因此对xbox360_teleop.launch文件进行修改。

在测试手柄时,需要判断键位功能,使能键是button:5  ,在运行过程中,只有在按下这个键时才能通过遥感控制turtlebot运行。

<launch>  <!--    Push the left frontal button labeled as 'LB' to activate cmd_vel publishing.    Move the left stick around to control the velocity.   -->  <!--  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_deadman" value="4"/>    <param name="axis_linear" value="1"/>    <param name="axis_angular" value="0"/>    <remap from="turtlebot_teleop_joystick/cmd_vel" to="teleop_velocity_smoother/raw_cmd_vel"/>  </node>  <node pkg="joy" type="joy_node" name="joystick"/></launch>

对以下语句进行修改:

1、

<param name="axis_deadman" value="4"/>
修改为:

<param name="axis_deadman" value="5"/>
2、

<node pkg="joy" type="joy_node" name="joystick"/>
修改为:

<node pkg="joy" type="joy_node" name="joystick">  <param name="dev" type="string" value="/dev/input/js0" /></node>


最后在启动turtlebot后运行命令即可使用手柄控制运动:

roslaunch turtlebot_bringup minimal.launchroslaunch turtlebot_teleop xbox360_teleop.launch





0 0
原创粉丝点击