0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

備忘録 ラズパイ5 ROS2 勉強再開 ④ ゲーム・コントローラ その1 接続と情報

Posted at

 ROS2でXbox ワイヤレス コントローラを使います。ゲーム・パッドとも呼ばれているようです。
 まず、接続して、情報を見ます。

環境

  • Raspberry Pi 5 8GB
  • 追加ボード;NVMe Base for Raspberry Pi 5 (NVMe Base by Pimoroni)
  • Crucial クルーシャル P2シリーズ 500GB 3D NAND NVMe PCIe M.2 SSD CT500P2SSD8
  • Ubuntu Desktop 24.04LTS(64-bit)
  • ROS2;Jazzy

ラズパイに認識させる

 ラズパイの画面の右上に、電源アイコンがあります。
 そのアイコンをクリックし、Bluetoothの文字の横にある > をクリックします。
 この画面は、接続が終わった後なので、ゲーム・コントローラが表示されていますが、最初は、何も表示されていません。
 Bluetooth settingsをクリックします。

 この画面では、Devicesにコントローラが表示されていますが、最初は何も表示されていません。
 ゲーム・コントローラの接続ボタンを押します。すると、connectした下の画面になります。

 画面右上には、Bluetoothのアイコンが追加されました。

コマンドラインから情報を見る

$ hciconfig
hci0:	Type: Primary  Bus: UART
	BD Address: 2C:CF:67:30:D7:91  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:17722 acl:193 sco:0 events:813 errors:0
	TX bytes:72930 acl:87 sco:0 commands:586 errors:0
$ sudo systemctl status bluetooth
[sudo] password for yoshi: 
● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-10-17 08:59:22 JST; 24h ago
       Docs: man:bluetoothd(8)
   Main PID: 1074 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 9061)
     Memory: 3.3M (peak: 3.8M)
        CPU: 131ms
     CGroup: /system.slice/bluetooth.service
             └─1074 /usr/libexec/bluetooth/bluetoothd
$ bluetoothctl
Waiting to connect to bluetoothd...[bluetooth]# hci0 new_settings: powered bondable ssp br/edr le secure-conn 
[bluetooth]# Agent registered
[bluetooth]# [CHG] Controller 2C:CF:67:30:D7:91 Pairable: yes
[bluetooth]# list
Controller 2C:CF:67:30:D7:91 yoshi [default]
[bluetooth]# show
Controller 2C:CF:67:30:D7:91 (public)
	Manufacturer: 0x0131 (305)
	Version: 0x09 (9)
	Name: yoshi
	Alias: yoshi
	Class: 0x007c0000 (8126464)
	Powered: yes
	Discoverable: no
	DiscoverableTimeout: 0x000000b4 (180)
	Pairable: yes
	UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)
	UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	UUID: IrMC Sync                 (00001104-0000-1000-8000-00805f9b34fb)
	UUID: Vendor specific           (00005005-0000-1000-8000-0002ee000001)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
	UUID: OBEX File Transfer        (00001106-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v1D6Bp0246d0548
	Discovering: no
	Roles: central
	Roles: peripheral
Advertising Features:
	ActiveInstances: 0x00 (0)
	SupportedInstances: 0x05 (5)
	SupportedIncludes: tx-power
	SupportedIncludes: appearance
	SupportedIncludes: local-name


 ゲーム・コントローラは、ほったらかしにしていると、勝手に接続を切ります。
 一度connectしているので、ゲーム・コントローラの接続ボタンを押していると、自動で接続が行われます。

[bluetooth]# scan on
[bluetooth]# SetDiscoveryFilter success
[bluetooth]# Discovery started
[bluetooth]# [CHG] Controller 2C:CF:67:30:D7:91 Discovering: yes
[bluetooth]# devices
Device 68:6C:E6:43:52:0C Xbox Wireless Controller
[CHG] Device 68:6C:E6:43:52:0C Connected: yes
[CHG] Device 68:6C:E6:43:52:0C ServicesResolved: yes


info 68:6C:E6:43:52:0C
Device 68:6C:E6:43:52:0C (public)
	Name: Xbox Wireless Controller
	Alias: Xbox Wireless Controller
	Appearance: 0x03c4 (964)
	Icon: input-gaming
	Paired: yes
	Bonded: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000001-5f60-4c4f-9c83-a7953298d40d)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v045Ep0B13d0509
	ManufacturerData.Key: 0x0006 (6)
	ManufacturerData.Value:
  00                                               .               
	Battery Percentage: 0x4e (78)

 ゲーム・コントローラは、電池で動いています。USBケーブルを接続すると充電します。

ずっとWindows10 PCを利用してきましたが、もうすぐサポートがなくなるというのと、第4世代のCPUなので、そろそろ更新したいと思っていました。新規なCPUは2025年からだというので、つなぎに、AMD Ryzen 7 5700Xマシンを作って、Windows11を入れました。
 コマンドラインで、sshで接続しようとして、何度も失敗しました。そいうときにかぎって検索しても役立つ答えが見つかりません。
 teratermのsshだと、すんなり接続できました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?