チョロQ制御ライブラリの作成
KURO-RS
玄柴(KURO-SHEEVA)
ロボアクターと同様、チョロQ制御ライブラリを作る
ライブラリの作成
root@debian:~# cd /usr/local/lib/kuro-rs/choro-q_a/
root@debian:/usr/local/lib/kuro-rs/choro-q_a# vi libchoro-q_a.sh
:
:
root@debian:/usr/local/lib/kuro-rs/choro-q_a# cat !$
cat libchoro-q_a.sh
RS_SEND=${RS_SEND:-/usr/local/bin/rs_send}
CHOROQADIR=${CHOROQADIR:-/usr/local/lib/kuro-rs/choro-q_a}
CHOROQACHANNEL=${CHOROQACHANNEL:-1}
CHOROQAPORT=${CHOROQAPORT:-/dev/ttyUSB0}
choroqa_forward() {
$RS_SEND $CHOROQADIR/BUTTON_F $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_forwardleft() {
$RS_SEND $CHOROQADIR/BUTTON_FL $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_forwardright() {
$RS_SEND $CHOROQADIR/BUTTON_FR $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_forwarddash() {
$RS_SEND $CHOROQADIR/BUTTON_FD $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_back() {
$RS_SEND $CHOROQADIR/BUTTON_B $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_backleft() {
$RS_SEND $CHOROQADIR/BUTTON_BL $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_backright() {
$RS_SEND $CHOROQADIR/BUTTON_BR $CHOROQACHANNEL $CHOROQAPORT
}
choroqa_backdash() {
$RS_SEND $CHOROQADIR/BUTTON_BD $CHOROQACHANNEL $CHOROQAPORT
}
root@debian:/usr/local/lib/kuro-rs/choro-q_a#
テストプログラムの作成
root@debian:/usr/local/lib/kuro-rs/choro-q_a# cd
root@debian:~# mkdir choro-q_a
root@debian:~# cd !$
cd choro-q_a
root@debian:~/choro-q_a# vi test.sh
:
:
:
root@debian:~/choro-q_a# cat test.sh
#!/bin/sh
. /usr/local/lib/kuro-rs/choro-q_a/libchoro-q_a.sh
CHOROQAPORT=/dev/ttyUSB0
choroqa_forward
choroqa_forwardleft
choroqa_forwardright
choroqa_forwarddash
choroqa_back
choroqa_backleft
choroqa_backright
choroqa_backdash
root@debian:~/choro-q_a#
テスト
root@debian:~/choro-q_a# sh -x test.sh
+ . /usr/local/lib/kuro-rs/choro-q_a/libchoro-q_a.sh
+ RS_SEND=/usr/local/bin/rs_send
+ CHOROQADIR=/usr/local/lib/kuro-rs/choro-q_a
+ CHOROQACHANNEL=1
+ CHOROQAPORT=/dev/ttyUSB0
+ CHOROQAPORT=/dev/ttyUSB0
+ choroqa_forward
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_F 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_F - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_F]
+ choroqa_forwardleft
test.sh: 1: choroqa_forwardleft: not found
+ choroqa_forwardright
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_FR 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_FR - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_FR]
+ choroqa_forwarddash
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_FD 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_FD - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_FD]
+ choroqa_back
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_B 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_B - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_B]
+ choroqa_backleft
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_BL 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BL - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BL]
+ choroqa_backright
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_BR 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BR - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BR]
+ choroqa_backdash
+ /usr/local/bin/rs_send /usr/local/lib/kuro-rs/choro-q_a/BUTTON_BD 1 /dev/ttyUSB0
/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BD - 1 - /dev/ttyUSB0
Send File : [/usr/local/lib/kuro-rs/choro-q_a/BUTTON_BD]
root@debian:~/choro-q_a#
動くことは動くけど、
チョロQが KURO-RS の赤外線の届く範囲外に
出てしまってイマイチ制御できない。
CAUL と同じと言えば同じだが、、、
Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市