Remy Sanchez によって開発された PHP クラスを使用して、シリアル ポート経由で iRobot Roomba と通信しようとしています。iRobot USB ケーブルがデータを受信して点灯しているので、データを送信していることは確かですが、ルンバはルンバ シリアル コマンド インターフェイス (SCI) 仕様マニュアルで定義されているコマンドを認識していないようです。これには考えられる理由がありますか?クラスが何らかの方法でデータを歪めますか、それとも PHP がサポートしていない特定のデータ型をルンバに送信する必要がありますか?
追加情報 (関連性があるかどうかはわかりません)
RealTerm を使用すると、Send Numbers 機能を使用してルンバと直接通信できます (他の方法で通信しようとすると、キーを押すたびに送信されます)。PuTTY を使用すると、ローカル エコー + 行編集を強制的にオンにしても、ルンバがコマンドを受け付けません。コマンドを受信しますが、ボー レートが正しく構成されていても、何もしません。
コード
require("php_serial.class.php");
$serial = new phpSerial();
$serial->deviceSet("COM1");
$serial->confBaudRate(115200); //Baud rate: 115200
$serial->confParity("none"); //Parity (this is the "N" in "8-N-1")
$serial->confCharacterLength(8); //Character length (this is the "8" in "8-N-1")
$serial->confStopBits(1); //Stop bits (this is the "1" in "8-N-1")
$serial->confFlowControl("none"); //Device does not support flow control
$serial->deviceOpen();
$start = sprintf("%c",128);
$power = sprintf("%c",133);
$serial->sendMessage("$start");
$time_start = microtime(true);
// Sleep for a while
usleep(1000000);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Did nothing in $time seconds <br>";
$serial->sendMessage("$power");
$serial->deviceClose();