< >
Home » ROS2与传感器教程 » ROS2与传感器教程-mocute蓝牙手柄控制

ROS2与传感器教程-mocute蓝牙手柄控制

说明

  • 介绍如何使用mocute蓝牙手柄
  • 环境: mocute手柄 + ubuntu20.04 + evdev

步骤

  • 1.蓝牙连接

  • 手柄拨向game模式,按下手柄电源开关,灯开始闪烁

  • 在PC上开启蓝牙,并找到手柄蓝牙名称为:MOCUTE-052FE-AUTO,进行连接并确认接入

  • 2.确认连接成功

  • 运行命令测试

~/tools/mocute$ jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (MOCUTE-052Fe-AUTO) has 8 axes (X, Y, Z, Rz, Gas, Brake, Hat0X, Hat0Y)
and 16 buttons (BtnA, BtnB, BtnC, BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off 15Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off 15Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off 15Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  

  • 控制各个按钮查看输出内容
    1. 控制小车
  • 安装joy驱动
curl -k https://www.ncnynl.com/rcm.sh | bash -
rcm ros2 install_mocute_joy
  • 运行命令
ros2 launch teleop_twist_joy teleop_mocute.launch.py
  • 查看/cmd_vel话题
ros2 topic echo /cmd_vel

---
linear:
  x: -0.38888415098190304
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 2.0
---

  • 查看joy话题
ros2 topic echo /joy_remote

---
header:
  stamp:
    sec: 1700715664
    nanosec: 770150598
  frame_id: joy
axes:
- -0.0
- -0.0
- -0.0
- -0.0
- 1.0
- 1.0
- 0.0
- 0.0
buttons:
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
---

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2与传感器教程