process[rosout-1]: started with pid [4186]
started core service [/rosout]
process[gazebo-2]: started with pid [4194]
process[gazebo_gui-3]: started with pid [4211]
process[spawn_urdf-4]: started with pid [4220]
[ INFO] [1528459620.691972547]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1528459620.692481908]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
Error [parser.cc:581] Unable to find uri[model://sun]
Error [parser.cc:581] Unable to find uri[model://ground_plane]
[ INFO] [1528459622.261795752, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
Nintendo LABOのバイクToy-Conを使って、ロボットを操作できる様にしてみた。
アクセスハンドルをひねるとロボットが前に動き出し、ハンドルを左右に傾けるとロボットも左右に移動する様な使い勝手。
ハンドル加減と曲がり具合はまだ調整中ですが、体験価値としては面白いかと。
娘も楽しそうに遊んでくれてました!(息子にはまだ早いので、息子向けにはToy-Conの見直しから)
ちなみに、ROS上で動かしているので、将来的には自立移動等と組み合わせたりも出来そう♪
作成動機
前回記事 ogimotokin.hatenablog.com
の続きで、「さーて! GW中にencorderからodometryを作成して、いよいよnavigationと結合するか~」と意気込んでいたのですが、 Nintendo LABO発売!
によってすべての計画が崩れてしまいました!
これは面白い!
#include <ESP8266WiFi.h>
const char* ssid = ***************;
const char* password = **************;
const char* host = "192.168.0.**"; //リモコン制御用RaspberryのIPアドレス
const char* path = "/bedroom_call";
void setup() {
Serial.begin(115200);
delay(100);
// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.print("connecting to ");
Serial.println(host);
}
void loop() {
// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 1880; //Node-REDの使用ポート
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
String body = "bedroom_call=1";
// サーバにリクエストを送信(GET)
client.print(String("GET ") + path +" HTTP/1.1\r\n" +
"Host: " + host +":1880"+ "\r\n" +
"Connection: close\r\n\r\n");
delay(1000); // Can be changed
if (client.connected()) {
client.stop(); // DISCONNECT FROM THE SERVER
}
// 20秒待ち
delay(20000); // Can be changed
}
本体ラズパイ側では、Node-REDを使用。寝室ボタンからのGETメソッドを受信したら、あらかじめ用意していたwavファイル(「~ちゃんが呼んでるでー!」)を再生するだけ。Google homeでは任意の音声を再生できるのだか、Amazon echoでは現時点でできなそう。text to speechはあるけど機械っぽい発音がいまいちなので。なので、echoをBluetoothスピーカーにしてラズパイから音声再生させる手段にしたいと思う。