M5Atomで作る四脚ロボット Wiiヌンチャクを繋げてコントロール
- 2021/08/09
- 18:19
M5Atomで作る四脚ロボット Wiiヌンチャクを繋げてコントロール
Control by connecting Wii Nunchuck, quadruped robot made with M5Atom.
こんにちはRoboTakaoです。M5Atomで作る四脚ロボットをブラッシュアップ中です。
今度はWii のコントローラ ヌンチャクを接続してロボットをコントロールしたいと思います。
Hello, I'm Robo Takao. I am brushing up a quadruped robot made with M5Atom.
Now I want to connect the Wii controller Nunchaku to control the robot.

構成としては以下のようにして、ロボットとは違うM5Atom LiteにWii ヌンチャクを繋げてrosserial経由で通信します。
The configuration is as follows. Connect the Wii Nunchuck to M5Atom Lite, which is different from the robot. And it communicates via rosserial.
構成 Configure

WiiヌンチャクとM5Atom Liteの接続
Wii Nunchuck and M5Atom Lite connection
実はだいぶ前にArduino nanoで接続テストをしていました。その時の投稿はこちら。WiiヌンチャクはI2Cで通信しています。M5AtomともI2Cで繋げれば使えます。
Previously, I did a connection test with Arduino nano. Click here for the post at that time. Wii Nunchuck communicates via I2C. You can use it by connecting it to M5Atom with I2C.

まずはテストtest
Arduino IDEのシリアルプロッターで動作確認
Confirmed operation with Arduino IDE serial plotter
ROS gazeboで四脚ロボットで動作できることを確認
Confirmed that ROS gazebo can operate with a quadruped robot
実機でも動作確認Operation check on the actual machine
ケースの作成 Case
Wiiヌンチャクに接続したM5Atomは乾電池(3個)で駆動します。
Fusion360でケースを設計して3Dプリントしました。
The M5Atom connected to the Wii Nunchuck is powered by 3 batteries.
I designed the case with Fusion 360 and printed it.




歩行制御テスト Walking control test
Wii ヌンチャクのボタンは歩行と停止およびターンかスライド歩行か切り替えるようにしました。
The Wii Nunchaku button now switches between walking and stopping and turning or sliding walking.

良い感じです。It feels good.
ソースコードSource code
https://github.com/RoboTakao/NX15A.git
ソースはgithubにアップしました。The source has been uploaded to github.
M5Atom用スケッチ Sketch for M5 Atom
For robot : nx15_rosserial_wifi_IMU.ino
For wii controller : nx15_rosserial_wifi_wii.ino
起動 Start-up
roslaunch nx15a nx15a_simulation_rosserial_wii_imu.launch
rosrun nx15a nx15a_walk_ik_wii_imu.py
スポンサードリンク
M5Atomで作る四脚ロボット 超音波距離センサーを動かして障害物回避 ホーム
4脚ロボット IMUで水平キープしつつのマウスでコントロール Quadruped Roboto, Control with mouse while keeping horizontal with IMU